Skip to main content

Module types

Module types 

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

  1. computed from one consensus state and another;
  2. serialized with rkyv;
  3. optionally compressed with a general-purpose compressor such as zstd;
  4. stored as an archival record; and
  5. later deserialized and applied to another compatible state.

§Delta model

Most types in this module represent the transformation:

base state + delta -> target state

Different 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§

ArchivedBalancesDiff
An archived BalancesDiff
ArchivedBitTagVec
An archived BitTagVec
ArchivedRandaoDiff
An archived RandaoDiff
ArchivedRootsDiff
An archived RootsDiff
ArchivedSlashingsDiff
An archived SlashingsDiff
ArchivedValidatorPatch
An archived ValidatorPatch
ArchivedValidatorsDiff
An archived ValidatorsDiff
BalancesDiff
Compact representation of the difference between two validator balance snapshots.
BalancesDiffResolver
The resolver for an archived BalancesDiff
BitTagVec
Packed two-bit operation tags used by BalancesDiff.
BitTagVecResolver
The resolver for an archived BitTagVec
RandaoDiff
Sequence of RANDAO mixes written while advancing through epochs.
RandaoDiffResolver
The resolver for an archived RandaoDiff
RootsDiff
Sequence of roots written while advancing through a circular root buffer.
RootsDiffResolver
The resolver for an archived RootsDiff
SlashingsDiff
Sparse updates for an Ethereum slashing ring buffer.
SlashingsDiffResolver
The resolver for an archived SlashingsDiff
ValidatorPatch
A modification to a single validator field.
ValidatorPatchResolver
The resolver for an archived ValidatorPatch
ValidatorsDiff
Compact representation of the difference between two validator registries.
ValidatorsDiffResolver
The resolver for an archived ValidatorsDiff

Enums§

ArchivedAttestationsDiff
An archived AttestationsDiff
ArchivedEth1DataVotesDiff
An archived Eth1DataVotesDiff
ArchivedHistoricalLogDiff
An archived HistoricalLogDiff
ArchivedInactivityDiff
An archived InactivityDiff
ArchivedParticipationDiff
An archived ParticipationDiff
ArchivedQueueDiff
An archived QueueDiff
ArchivedSyncCommitteeDiff
An archived SyncCommitteeDiff
ArchivedValidatorField
An archived ValidatorField
AttestationsDiff
Delta representation for Phase0 pending attestation lists.
AttestationsDiffResolver
The resolver for an archived AttestationsDiff
Eth1DataVotesDiff
Delta representation for an Ethereum Eth1 data vote list.
Eth1DataVotesDiffResolver
The resolver for an archived Eth1DataVotesDiff
HistoricalLogDiff
Delta representation for an append-only historical consensus log.
HistoricalLogDiffResolver
The resolver for an archived HistoricalLogDiff
InactivityDiff
Compact delta representation for validator inactivity scores.
InactivityDiffResolver
The resolver for an archived InactivityDiff
ParticipationDiff
Compact delta representation for Ethereum participation flags.
ParticipationDiffResolver
The resolver for an archived ParticipationDiff
QueueDiff
Universal delta representation for SSZ-serialized queue-like lists.
QueueDiffResolver
The resolver for an archived QueueDiff
SyncCommitteeDiff
Delta representation for an Ethereum sync committee.
SyncCommitteeDiffResolver
The resolver for an archived SyncCommitteeDiff
ValidatorField
Identifies a validator field modified by a ValidatorPatch.
ValidatorFieldResolver
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_epoch of 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 Validator record.