Skip to main content

Module validators

Module validators 

Source
Expand description

Delta encoding for Ethereum validator records.

This module operates directly on the canonical SSZ byte representation of validators rather than materializing Rust validator structs.

Working directly on SSZ bytes provides several advantages:

  • avoids per-validator deserialization,
  • performs only fixed-offset memory comparisons,
  • minimizes allocations, and
  • integrates naturally with consensus clients that already store validator registries as contiguous SSZ data.

Only mutable validator fields defined by the Ethereum consensus protocol are encoded. Immutable fields such as the validator public key are never included in generated patches.

Certain protocol-derived fields are reconstructed deterministically during application instead of being stored explicitly. For example, withdrawable_epoch for non-slashed validators is recomputed from exit_epoch according to the Ethereum consensus specification, reducing the size of the encoded delta without losing information.

Functionsยง

apply_validators
Applies a validator delta to an SSZ validator registry in-place.
diff_validators
Computes a compact delta between two validator registry SSZ buffers.