ethereum / ethereum/beacon-APIs
Consistent JSON serialization of `List[uint8, ...]`
- Dominant language
- HTML
- Stars
- 389
- Forks
- 224
- Avg merge
- 8h 29m
- Merged PRs (30d)
- 3
Description
`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 encode `ExtraData` as a string - we also encode all `Vector[byte..]` as strings, for example hashes. However, in the `BeaconState` for bellatrix+, `*_epoch_participation` is also a `List[byte, ...]` (by virtue of `ParticipationFlags` and `byte` being aliases for `uint8`) - the encoding of the Beacon State ~~is left unspecified opening the scene for ambiguity~~ uses the list encoding (correction).
In general, it seems preferable to encode all `List[byte, N]` as `"0x..."` together with `Vector[byte, ..]` as strings for consistency - the alternative is that each field that ventures near the `uint8` type gets its own serialization is messier.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the Bellatrix serialization rules for ExtraData, Vector[byte..], and BeaconState, including *_epoch_participation and the ParticipationFlags/byte aliases. Confirm the intended encoding for List[uint8, ...] and document the decision consistently across the affected API types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100