feat(rpc-types-beacon): add SSZ support for beacon block types#3575
Merged
feat(rpc-types-beacon): add SSZ support for beacon block types#3575
Conversation
This adds SSZ encode/decode derives to beacon block types in the rpc-types-beacon crate behind the existing 'ssz' feature flag. Types with SSZ support: - Eth1Data, Checkpoint, AttestationData - Attestation, IndexedAttestation - ProposerSlashing, SignedBeaconBlockHeader, AttesterSlashing - DepositData, Deposit - VoluntaryExit, SignedVoluntaryExit - SyncAggregate - BlsToExecutionChange, SignedBlsToExecutionChange - BeaconBlockBodyPhase0, BeaconBlockBodyAltair - BeaconBlockHeader Note: Generic types (SignedBeaconBlock<T>, BeaconBlock<T>, and block body types with execution_payload: T) are excluded as they default to serde_json::Value which doesn't implement SSZ. Callers can use these with concrete SSZ-compatible types. Includes roundtrip SSZ tests for all supported types.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds SSZ encode/decode derives to beacon block types in the rpc-types-beacon crate behind the existing
sszfeature flag.Types with SSZ support added:
Eth1Data,Checkpoint,AttestationDataAttestation,IndexedAttestationProposerSlashing,SignedBeaconBlockHeader,AttesterSlashingDepositData,DepositVoluntaryExit,SignedVoluntaryExitSyncAggregateBlsToExecutionChange,SignedBlsToExecutionChangeBeaconBlockBodyPhase0,BeaconBlockBodyAltairBeaconBlockHeaderTypes intentionally excluded:
SignedBeaconBlock<T>,BeaconBlock<T>- generic types that default toserde_json::Value(doesn't implement SSZ). These can be used with concrete SSZ-compatible types by callers.BeaconBlockBodyBellatrix<T>,BeaconBlockBodyCapella<T>,BeaconBlockBodyDeneb<T>,BeaconBlockBodyElectra<T>- same reason; they contain anexecution_payload: Tfield.Tests added:
12 SSZ roundtrip tests covering all the non-generic types.
Related to #3436 (adds SSZ support following the beacon block types added in #3565)