Expand description
Per-entity version chain for authority editions.
Every authority record (a Grant, RoleMetadata, RoleOrder, Banlist, …) is a
sequence of editions. Each edition carries a monotonic version and the hash of its
predecessor (prev_hash), and the actor’s real-npub signature covers both — so the chain is over
signed content, not the outer wrap. Clients fold the fetched set into the current
head by the rules:
- refuse-downgrade on the version integer (never accept a version below the floor already held);
- equal-version fork resolves authority first (CORD-04 §1): the author’s
Edition::rank, which the caller resolves against its roster, then the lower inner edition id (a commitment hash over author+content+tags+time, NOT the author-settablecreated_at, so it can’t be cheaply biased); - a gap (a higher version whose
prev_hashdoesn’t link contiguously to what we hold) leaves the head at the highest contiguous version and is reported, so the caller can fail closed for that entity and refetch the missing prereqs from the quorum (H1/M8) rather than fail open.
Structs§
- Edition
- One fetched edition of an entity, reduced to what the fold needs. (Signature/authority validation happens before this — only editions whose real-npub signature verified are folded.)
- Fold
Result - The outcome of folding one entity’s editions.
Functions§
- bootstrap_
head - The head a bootstrapping client accepts: the per-version winner at the HIGHEST present
version ≥
floor, ignoring chain contiguity. A fresh joiner whose genesis was re-anchored away cannot verify lineage at all, so contiguity is the wrong test for it — the real gate is the edition’s signature (verified before folding) plus the author’s CURRENT authority, which the caller resolves against the roster + owner attestation. A relay cannot forge a higher version (no valid signature), so the worst case is a stale-but-valid head that the union + ratchet later upgrade. ReturnsNoneif no edition is ≥floor. Equal-version forks use the same deterministic tiebreak asfold(lower inner edition id) so every client converges on one head. - edition_
hash - SHA-256 of
edition_signing_bytes— the edition’s identity in the chain. The next edition’sprev_hashcites this value. - edition_
hash_ signed - A marked edition’s identity (CORD-04 §1): the same bytes, then the signer’s key, so a copy re-signed under another key is another edition, and nothing built on the original links to it.
- edition_
signing_ bytes - Domain-separated, length-prefixed canonical bytes an authority edition commits to.
- fold
- Fold a set of editions for one entity into its current head.
- fold_
linked fold_with_rivalswith the head taken only among the editionseligibleadmits, while every served edition carries the chain: an edition the Roster refuses still links what was built on it.- fold_
with_ rivals fold, taking the head at the highest version whose chain is intact (CORD-04 §1): every edition reachable byprev_hashlinks from the anchor counts, so a fork’s sibling that the chain went on to extend is followed rather than stranded, and the authority tiebreak decides only among the reachable editions at the top version.