Expand description
Core data structures used by eth_state_diff.
This module defines the serialized delta representations produced by the crate’s diff algorithms.
The structures in this module are deliberately independent of any specific
Ethereum consensus-client implementation. They contain only primitive Rust
values, byte buffers, and rkyv-archivable types. This allows a delta to be:
- computed from one consensus state and another;
- serialized with
rkyv; - optionally compressed with a general-purpose compressor such as zstd;
- stored as an archival record; and
- later deserialized and applied to another compatible state.
§Delta model
Most types in this module represent the transformation:
base state + delta -> target stateDifferent consensus-state fields have different update patterns, so the crate uses specialized representations rather than one universal encoding. For example:
- validator registries use field-level patches;
- balances use packed tags and varint-encoded differences;
- participation and inactivity scores use sparse updates;
- FIFO-like lists use consumed-item counts and appended bytes;
- circular buffers store only values written during the transition;
- append-only historical logs use protocol-defined append counts; and
- fields that change infrequently use unchanged/full-replacement variants.
§Serialization
All public delta structures derive rkyv::Archive, rkyv::Serialize,
and rkyv::Deserialize. They are therefore suitable for use as the
serialized representation of an archival state delta.
The structures themselves do not perform compression. Applications can
serialize a delta with rkyv and subsequently compress the resulting bytes
using a compressor such as zstd.
§Compatibility
The delta types describe the encoding used by this crate. They should be treated as part of the crate’s serialization format: changing field types, enum variants, or encoding invariants may affect the compatibility of previously stored deltas.
Structs§
- Archived
Balances Diff - An archived
BalancesDiff - Archived
BitTag Vec - An archived
BitTagVec - Archived
Randao Diff - An archived
RandaoDiff - Archived
Roots Diff - An archived
RootsDiff - Archived
Slashings Diff - An archived
SlashingsDiff - Archived
Validator Patch - An archived
ValidatorPatch - Archived
Validators Diff - An archived
ValidatorsDiff - Balances
Diff - Compact representation of the difference between two validator balance snapshots.
- Balances
Diff Resolver - The resolver for an archived
BalancesDiff - BitTag
Vec - Packed two-bit operation tags used by
BalancesDiff. - BitTag
VecResolver - The resolver for an archived
BitTagVec - Randao
Diff - Sequence of RANDAO mixes written while advancing through epochs.
- Randao
Diff Resolver - The resolver for an archived
RandaoDiff - Roots
Diff - Sequence of roots written while advancing through a circular root buffer.
- Roots
Diff Resolver - The resolver for an archived
RootsDiff - Slashings
Diff - Sparse updates for an Ethereum slashing ring buffer.
- Slashings
Diff Resolver - The resolver for an archived
SlashingsDiff - Validator
Patch - A modification to a single validator field.
- Validator
Patch Resolver - The resolver for an archived
ValidatorPatch - Validators
Diff - Compact representation of the difference between two validator registries.
- Validators
Diff Resolver - The resolver for an archived
ValidatorsDiff
Enums§
- Archived
Attestations Diff - An archived
AttestationsDiff - Archived
Eth1 Data Votes Diff - An archived
Eth1DataVotesDiff - Archived
Historical LogDiff - An archived
HistoricalLogDiff - Archived
Inactivity Diff - An archived
InactivityDiff - Archived
Participation Diff - An archived
ParticipationDiff - Archived
Queue Diff - An archived
QueueDiff - Archived
Sync Committee Diff - An archived
SyncCommitteeDiff - Archived
Validator Field - An archived
ValidatorField - Attestations
Diff - Delta representation for Phase0 pending attestation lists.
- Attestations
Diff Resolver - The resolver for an archived
AttestationsDiff - Eth1
Data Votes Diff - Delta representation for an Ethereum Eth1 data vote list.
- Eth1
Data Votes Diff Resolver - The resolver for an archived
Eth1DataVotesDiff - Historical
LogDiff - Delta representation for an append-only historical consensus log.
- Historical
LogDiff Resolver - The resolver for an archived
HistoricalLogDiff - Inactivity
Diff - Compact delta representation for validator inactivity scores.
- Inactivity
Diff Resolver - The resolver for an archived
InactivityDiff - Participation
Diff - Compact delta representation for Ethereum participation flags.
- Participation
Diff Resolver - The resolver for an archived
ParticipationDiff - Queue
Diff - Universal delta representation for SSZ-serialized queue-like lists.
- Queue
Diff Resolver - The resolver for an archived
QueueDiff - Sync
Committee Diff - Delta representation for an Ethereum sync committee.
- Sync
Committee Diff Resolver - The resolver for an archived
SyncCommitteeDiff - Validator
Field - Identifies a validator field modified by a
ValidatorPatch. - Validator
Field Resolver - The resolver for an archived
ValidatorField
Constants§
- HISTORICAL_
ROOTS_ SSZ_ SIZE - Size, in bytes, of an SSZ-serialized historical root.
- HISTORICAL_
SUMMARIES_ SSZ_ SIZE - Size, in bytes, of an SSZ-serialized historical summary.
- MIN_
VALIDATOR_ WITHDRAWABILITY_ DELAY - Minimum validator withdrawability delay used when reconstructing the
withdrawable_epochof a non-slashed validator. - SET_
NO_ CHANGE - Tag indicating that the corresponding balance is unchanged.
- SET_
TO_ DIFF - Tag indicating that the corresponding balance is reconstructed by applying an encoded signed difference.
- SET_
TO_ TARGET_ VALUE - Tag indicating that the corresponding balance is replaced with an absolute target value.
- SET_
TO_ ZERO - Tag indicating that the corresponding balance is replaced with zero.
- SLOTS_
PER_ EPOCH - Number of slots in an Ethereum consensus epoch.
- VALIDATOR_
SSZ_ SIZE - Size, in bytes, of an SSZ-serialized
Validatorrecord.