pub trait DiffSource {
Show 23 methods
// Required methods
fn fork(&self) -> ForkName;
fn slot(&self) -> (u64, u64);
fn capella_fork_slot(&self) -> u64;
fn scalar_header(&self) -> Vec<u8> ⓘ;
fn balances(&self) -> (&[u64], &[u64]);
fn validators(&self) -> (&[u8], &[u8]);
fn block_roots(&self) -> &[[u8; 32]];
fn state_roots(&self) -> &[[u8; 32]];
fn randao_mixes(&self) -> &[[u8; 32]];
fn slashings(&self) -> (&[u64], &[u64]);
fn eth1_data_votes(&self) -> (&[u8], &[u8]);
fn historical_roots(&self) -> Option<&[u8]>;
fn previous_epoch_attestations(&self) -> Option<(&[u8], &[u8])>;
fn current_epoch_attestations(&self) -> Option<(&[u8], &[u8])>;
fn previous_participation(&self) -> Option<(&[u8], &[u8])>;
fn current_participation(&self) -> Option<(&[u8], &[u8])>;
fn inactivity_scores(&self) -> Option<(&[u64], &[u64])>;
fn current_sync_committee(&self) -> Option<(&[u8], &[u8])>;
fn next_sync_committee(&self) -> Option<(&[u8], &[u8])>;
fn historical_summaries(&self) -> Option<&[u8]>;
fn pending_deposits(&self) -> Option<(&[u8], &[u8])>;
fn pending_partial_withdrawals(&self) -> Option<(&[u8], &[u8])>;
fn pending_consolidations(&self) -> Option<(&[u8], &[u8])>;
}Expand description
Read-only view of two beacon states.
Implement this trait to allow create to compute a
BeaconStateDelta between two states.
Each method exposes the state component required by the corresponding delta encoder without imposing any storage layout on the implementation.
Return None for fields that do not exist in the state’s current fork.
Required Methods§
fn fork(&self) -> ForkName
fn slot(&self) -> (u64, u64)
fn capella_fork_slot(&self) -> u64
Sourcefn scalar_header(&self) -> Vec<u8> ⓘ
fn scalar_header(&self) -> Vec<u8> ⓘ
Returns the serialized SSZ bytes for consensus state fields that are not covered by specialized diffing algorithms.
§Required SSZ Layout
To ensure deterministic reconstruction across clients, the bytes MUST be concatenated in the exact order defined by the consensus spec for the target state’s fork. The fields generally include:
genesis_time(8 bytes)genesis_validators_root(32 bytes)slot(8 bytes)fork(Fork struct, variable bytes)latest_block_header(BeaconBlockHeader struct)eth1_data(Eth1Data struct)eth1_deposit_index(8 bytes)justification_bits(BitVector)- Checkpoints:
previous_justified,current_justified,finalized latest_execution_payload_header(ExecutionPayloadHeader struct)- Electra+ scalar fields:
next_withdrawal_index,next_withdrawal_validator_index,deposit_requests_start_index,deposit_balance_to_consume, etc.
Note: Fields that have dedicated diffing algorithms (e.g., balances,
historical_summaries, pending_deposits) MUST NOT be included in this blob.
fn balances(&self) -> (&[u64], &[u64])
fn validators(&self) -> (&[u8], &[u8])
fn block_roots(&self) -> &[[u8; 32]]
fn state_roots(&self) -> &[[u8; 32]]
fn randao_mixes(&self) -> &[[u8; 32]]
fn slashings(&self) -> (&[u64], &[u64])
fn eth1_data_votes(&self) -> (&[u8], &[u8])
fn historical_roots(&self) -> Option<&[u8]>
fn previous_epoch_attestations(&self) -> Option<(&[u8], &[u8])>
fn current_epoch_attestations(&self) -> Option<(&[u8], &[u8])>
fn previous_participation(&self) -> Option<(&[u8], &[u8])>
fn current_participation(&self) -> Option<(&[u8], &[u8])>
fn inactivity_scores(&self) -> Option<(&[u64], &[u64])>
fn current_sync_committee(&self) -> Option<(&[u8], &[u8])>
fn next_sync_committee(&self) -> Option<(&[u8], &[u8])>
fn historical_summaries(&self) -> Option<&[u8]>
fn pending_deposits(&self) -> Option<(&[u8], &[u8])>
fn pending_partial_withdrawals(&self) -> Option<(&[u8], &[u8])>
fn pending_consolidations(&self) -> Option<(&[u8], &[u8])>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".