Confirm semantics of "zero values" when deserializing
ivnsch opened this issue · 1 comments
Given the API's behavior on receiver side ("zero value" fields have to be always mapped to "missing key") and some tests I did deserializing "zero value" fields(like on_complete
), it can be likely assumed that the API always uses "missing key" to represent "zero value", and that when deserializing we should interpret "missing key" depending on context (are we expecting a "zero value"? then it's a "zero value", otherwise the field really doesn't exist), but we should confirm, either testing on a per-field basis or with a specification of the node's mapping policy / inspecting the code base.
The API documentation is not helpful, as it states to use "zero values", which is incorrect:
https://developer.algorand.org/docs/reference/transactions/
https://developer.algorand.org/docs/reference/teal/specification/#oncomplete
Related documentation issues (to date unaddressed):
algorandfoundation/docs#454
algorandfoundation/docs#415
We also should resolve possible ambiguities around "zero values" by specifying what they are: in some cases it's not obvious, e.g. an Address
: is it an empty array or an array with 32 bytes set to 0? Is a struct with all the fields set to "zero value" a "zero value" (I remember that this was the case in the Java SDK)? etc.
Addressed by recent fixes. E.g. a non-existent application schema is interpreted as a schema with 0 values if the context indicates that a schema is expected. This is not ideal, but there's nothing that can be done on our side.