-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consistent JSON serialization of List[uint8, ...]
#219
Comments
There is a specification for how to encode the data: For has a JSON list of strings with decimal digits for a and for separately I do agree with you that "tightly packing" the |
Ah, I missed that one for some reason 👍 Hm. Changing is messy, but so is having different encodings for the same thing :/ |
Worth noting that in Teku we generate our JSON representations based off of the SSZ schema definitions and check they're right by parsing the YAML files in the reference tests (we use Jackson which supports both JSON and YAML support based on the same definitions). So I've got no problem changing and a more compact representation would certainly be good - especially since the participation flags are particularly human friendly even in List[number] form. But please can we keep the representation the same between the API and the reference tests. |
List[uint8, ...]
List[uint8, ...]
List[uint8, ...]
can be thought of either as byte string or a collection of (small) integers. In the former interpretation, one would serialize it as"0xabcd"
whereas the latter would be[0xab, 0xcd]
(string vs list).In
bellatrix
, we encodeExtraData
as a string - we also encode allVector[byte..]
as strings, for example hashes. However, in theBeaconState
for bellatrix+,*_epoch_participation
is also aList[byte, ...]
(by virtue ofParticipationFlags
andbyte
being aliases foruint8
) - the encoding of the Beacon Stateis left unspecified opening the scene for ambiguityuses the list encoding (correction).In general, it seems preferable to encode all
List[byte, N]
as"0x..."
together withVector[byte, ..]
as strings for consistency - the alternative is that each field that ventures near theuint8
type gets its own serialization is messier.The text was updated successfully, but these errors were encountered: