Skip to main content

apply_validators

Function apply_validators 

Source
pub fn apply_validators(
    base: &mut Vec<u8>,
    delta: &ArchivedValidatorsDiff,
) -> Result<(), Error>
Expand description

Applies a validator delta to a contiguous SSZ byte buffer in place.

The buffer must represent the same base validator registry against which the delta was generated.

Existing validators are modified according to the delta’s field patches. Newly appended validators are added from their raw SSZ representations.

This function does not require deserializing the validator registry into Rust validator structures. Existing records are modified directly at their fixed SSZ offsets.

§Errors

Returns Error::MalformedDelta if a patch contains a value with an invalid width for its field.

Returns Error::InvalidDelta if a patch refers to a validator index that does not exist in the buffer.

§Correctness

The delta is expected to have been generated from the same base registry. This function does not verify that the current contents of the buffer correspond to the original base state.