fe95d7cb6d
This PR introduces a new `byte` type equivalent in all aspects to `uint8` except that it has additional intent and display semantics attached. On top of this, the PR adds a canonical JSON mapping to the SSZ specification, documenting current usage of JSON in tests, API:s and simplifying future interop work between clients and adjacent specifications such as the Beacon API. The encoding is appropriate to use with YAML as well. As an important property, this mapping contains a 1:1 mapping of SSZ type to JSON encoding - this allows round-tripping any object between JSON and SSZ based on the SSZ schema and usage of the core SSZ types alone. The encoding presented in this PR is used in tests and API:s with one exception: the `ParticipationFlags` type from the Altair spec - it is recommended we switch encoding in tests and eventually the beacon API to address this irregularity, so as to avoid a proliferation "special" primitive types in the SSZ spec that only appear in particular schemas (and thus making validating general-purpose `SSZ/JSON` parsers more complex) as well as differences in encoding between fields of the same SSZ type. The PR also clarifies that the introduction of new aliases does not lead to changes in their canonical JSON specification - this allows building general SSZ/JSON libraries that do not further depend on open-ended knowledge about aliases. This PR should be seen as an alternative to https://github.com/ethereum/consensus-specs/pull/2983. |
||
---|---|---|
.. | ||
_features | ||
altair | ||
bellatrix | ||
capella | ||
deneb | ||
phase0 | ||
.pages |