Skip to main content

fold

Function fold 

Source
pub fn fold(
    editions: &[Edition],
    floor: u64,
    floor_hash: Option<&[u8; 32]>,
) -> FoldResult
Expand description

Fold a set of editions for one entity into its current head.

floor is the highest version the client has already accepted (0 = none yet) and floor_hash is that held edition’s Edition::self_hash (so a new edition can be proven to link to it). Editions below the floor are ignored (refuse-downgrade), equal-version forks pick the deterministic tiebreak winner, and the head walks the contiguous prev_hash chain upward.

gap is the safety signal. It is set whenever the head is NOT chain-anchored — either the lowest edition isn’t a genesis / doesn’t link to floor_hash, or a link breaks mid-chain. A tracking client (one that already holds the floor) MUST fail closed on gap (suspend the entity and refetch the missing prereqs from the quorum — H1/M8), since an unanchored head can be a forged or rolled-back edition (a hostile relay serving only a high version). A bootstrapping client (a new joiner, floor == 0, who legitimately lacks history because the state was re-anchored under a later epoch) may accept the head despite gap only after independently verifying its author’s current authority against the roster + owner attestation.