Skip to content

Comments

feat(rpc-types-beacon): add SSZ support for beacon block types#3575

Merged
mattsse merged 1 commit intomainfrom
feat/beacon-block-ssz
Jan 21, 2026
Merged

feat(rpc-types-beacon): add SSZ support for beacon block types#3575
mattsse merged 1 commit intomainfrom
feat/beacon-block-ssz

Conversation

@mattsse
Copy link
Member

@mattsse mattsse commented Jan 21, 2026

Description

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 added:

  • Eth1Data, Checkpoint, AttestationData
  • Attestation, IndexedAttestation
  • ProposerSlashing, SignedBeaconBlockHeader, AttesterSlashing
  • DepositData, Deposit
  • VoluntaryExit, SignedVoluntaryExit
  • SyncAggregate
  • BlsToExecutionChange, SignedBlsToExecutionChange
  • BeaconBlockBodyPhase0, BeaconBlockBodyAltair
  • BeaconBlockHeader

Types intentionally excluded:

  • SignedBeaconBlock<T>, BeaconBlock<T> - generic types that default to serde_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 an execution_payload: T field.

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)

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.
@mattsse mattsse merged commit e00614c into main Jan 21, 2026
30 checks passed
@mattsse mattsse deleted the feat/beacon-block-ssz branch January 21, 2026 22:07
@github-project-automation github-project-automation bot moved this to Done in Alloy Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant