feat(rpc-types-beacon): add SignedBeaconBlock and BeaconBlock types#3565
Merged
feat(rpc-types-beacon): add SignedBeaconBlock and BeaconBlock types#3565
Conversation
This adds the missing type definitions for and as requested in issue #3436. New types added: - - API response wrapper with version and finalization info - - Generic signed beacon block with message and signature - - Generic block with slot, proposer_index, parent_root, state_root, body - - Phase0 block body - - Altair block body with sync_aggregate - - Bellatrix block body with execution_payload - - Capella block body with bls_to_execution_changes - - Deneb block body with blob_kzg_commitments - - Electra block body with execution_requests Also includes supporting types: - Eth1Data, Checkpoint, AttestationData, Attestation, IndexedAttestation - ProposerSlashing, SignedBeaconBlockHeader, AttesterSlashing - DepositData, Deposit, VoluntaryExit, SignedVoluntaryExit - SyncAggregate, BlsToExecutionChange, SignedBlsToExecutionChange Type aliases for convenience: - SignedBeaconBlockPhase0, SignedBeaconBlockAltair - SignedBeaconBlockBellatrix, SignedBeaconBlockCapella - SignedBeaconBlockDeneb, SignedBeaconBlockElectra Closes #3436 Amp-Thread-ID: https://ampcode.com/threads/T-019be0a4-b308-7698-a02e-eae4195ef3f7 Co-authored-by: Amp <[email protected]>
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.
Motivation
Closes #3436
This adds the missing type definitions for
SignedBeaconBlockandBeaconBlockas requested in the issue.Solution
Added a new
block.rsmodule with comprehensive beacon block types based on the Beacon API spec and consensus specs.New types added:
Core types:
BlockResponse<T>- API response wrapper with version and finalization infoSignedBeaconBlock<T>- Generic signed beacon block with message and signatureBeaconBlock<T>- Generic block with slot, proposer_index, parent_root, state_root, bodyFork-specific block bodies:
BeaconBlockBodyPhase0- Phase0 block bodyBeaconBlockBodyAltair- Altair block body (addssync_aggregate)BeaconBlockBodyBellatrix- Bellatrix block body (addsexecution_payload)BeaconBlockBodyCapella- Capella block body (addsbls_to_execution_changes)BeaconBlockBodyDeneb- Deneb block body (addsblob_kzg_commitments)BeaconBlockBodyElectra- Electra block body (addsexecution_requests)Supporting types:
Eth1Data,Checkpoint,AttestationData,Attestation,IndexedAttestationProposerSlashing,SignedBeaconBlockHeader,AttesterSlashingDepositData,Deposit,VoluntaryExit,SignedVoluntaryExitSyncAggregate,BlsToExecutionChange,SignedBlsToExecutionChangeType aliases for convenience:
SignedBeaconBlockPhase0,SignedBeaconBlockAltairSignedBeaconBlockBellatrix,SignedBeaconBlockCapellaSignedBeaconBlockDeneb,SignedBeaconBlockElectraAll types use proper serde serialization with quoted decimals (
DisplayFromStr) as per the Beacon API format.Testing
Added comprehensive tests for serde serialization/deserialization of all major types.