Skip to main content

diff_validators_iter

Function diff_validators_iter 

Source
pub fn diff_validators_iter<I1, I2, V1, V2>(
    base: I1,
    target: I2,
) -> ValidatorsDiff
where I1: ExactSizeIterator<Item = V1>, I2: ExactSizeIterator<Item = V2>, V1: ValidatorSnapshot, V2: ValidatorSnapshot,
Expand description

Computes a compact validator delta using client-provided validator views.

This is the native-storage counterpart to diff_validators. Instead of requiring the validator registries to be represented as contiguous SSZ buffers, the caller supplies iterators of ValidatorSnapshot values.

Only the fields exposed by ValidatorSnapshot are inspected. Validators that occur only in the target iterator are serialized through ValidatorSnapshot::to_ssz_bytes and stored in the resulting delta.

The iterators must report their exact validator counts through ExactSizeIterator.

This function is useful when a consensus client stores validators in a persistent list, tree, or another non-contiguous data structure and wants to avoid materializing the complete registry as SSZ bytes.

diff_validators ValidatorSnapshot