Skip to content

Spec 07 Replication

Amp edited this page Nov 18, 2026 · 1 revision

Spec 07: Replication

Source: spec/07-replication.md at commit a9f0d61. The file is the source of truth; this page is a summary.

What the chapter decides

Chapter 07 defines how the sequencer's decisions become a replicated, final log. The log has two parts. The sequencer sends a compact order stream on two independent paths, and the data tier carries the client payloads. Replicas join the two by (session, pkt_seq). Voting replicas run Simplex over ranges of headers the sequencer has signed, and every accepted order is final within 10 ms. The chapter also specifies the frame gate, which ensures no response leaves before its records do. It covers the finality gate, replay and state roots, storage, and the sequencer's self-fence and failover to a warm standby. It closes with Byzantine cases, the Rust/Vx client-diversity alarm, WAN followers and replica membership.

Key decisions

  • The log has two parts (§2.1, D1). The order stream (PacketRecord, StepRecord, headers and related records) comes from vyrn-seq. Payloads come from vyrn-data. They are checked by pkt_hash and data_root.
  • Compact encoding (§3, D2). The order stream is LEB128 delta-encoded per lane: a PacketRecord costs ~6 B. The 8-byte pkt_hash travels in separate HASH frames that lag behind their records, so hashing stays off the fill path (§3.7, D3).
  • Two stream cores and two substreams (§4.1, D4). Stream-A (core 4) carries lanes 0–24 and stream-B (core 7) carries lanes 25–48. Each writes its ORDER frames by CTPIO to both paths.
  • Every response is gated (§4.2–§4.3, §4.11). A TX core sends no fill of a step until both substreams have released the frames that step depends on (INV-REP-1). A lane sends no ack, reject or BUSY until LaneCut covers the op (INV-REP-11).
  • The gate is a maximum, not a percentile (§4.7, D5). Three rules make it a bound: an early StepRecord push, small frames and no blind flush. The gate opens ≤ 142 ns after the step starts.
  • Self-fence (§4.8, D14, INV-REP-6). The sequencer stops releasing unless it holds fresh acks, within 250 µs, from REP_FENCE_ACKS = n − Q + 1 + f = 3 voters. Acks from the co-located R1 alone never keep it alive.
  • Repair (§4.10, D6). A replica NACKs the sequencer first and then a peer.
  • Data tier (§5, D7–D8). There is one vyrn-data box per facility. A session's data home is outside the sequencer's facility. data_root covers the full 32-byte BLAKE3 of each packet, because an 8-byte hash is open to a birthday attack.
  • Only voters vote (§6.3, D9). Simplex runs among the n voting replicas. vyrn-seq, the standby and the spares are not participants.
  • Vote rule (§6.4, D10). A replica votes only when it holds every payload, every root checks, CHAIN tags verify and no divergence is flagged. Votes never wait for replay.
  • Finality takes 4 hops (§6.6, D11): header, proposal, notarize and finalize.
  • Finality gate in both modes (§6.8, D17, INV-REP-10). If more than FIN_GATE_BLOCKS = 8 closed blocks are not final, the book halts through a logged Control(Halt) step.
  • Durability and finality are separate facts (§6.9). DUR_PATHS, DUR_QUORUM and FINAL are reported separately and never merged into one flag.
  • State roots (§7.4, D12). A state root is certified every 1000 blocks. A missing root certificate stops votes after 5000 blocks, and a mismatch stops them at once.
  • Failover (§9, D13, D16). It finalizes the longest prefix that the reporters hold and promotes the warm standby vyrn-seq in F2, never a voter. §9.6 lists the exact conditions under which a fill reverts, cases (a)–(e).
  • Client diversity halts, never forks (§11). A root mismatch between the Rust and Vx clients halts the book.
  • Membership changes only at epoch boundaries (§13, D15). A dead replica restarts under the same key on its facility's spare box.

Key numbers

Item Value § Kind (as the spec labels it)
FINALITY_MAX_MS 10 ms §6.6 hard maximum (01 §5), while the metro meets its delay bound
Finality, no fault 2.59 ms typical, 5.65 ms max §6.6 budget
Finality, one fault (f = 1) 8.65 ms max §6.6 budget
REP_HOP_MAX_MS 0.8 ms one-way §6.6 budget
REP_FRAME_GATE_NS 60 ns past the 100 ns step §4.7 budget, max
Gate open after step start ≤ 142 ns (spanning step) §4.7 max (budget)
REP_ACK_GATE_NS 10 ns §4.11 max, budget
Stream core load 0.41 (core 4), 0.40 (core 7) against REP_STREAM_MAX_LOAD = 0.50 §4.7 budget
REP_SELF_FENCE_US, REP_FENCE_ACKS 250 µs, 3 voters §4.8 budget
FIN_GATE_BLOCKS 8 closed blocks §6.8 binding constant (01 §14.9)
FAILOVER_TARGET_MS 20 ms published outage; tail final ≤ 7.85 ms after the last frame §9.7 max (budget)
Order stream per path 3.3 GB/s framed §2.1, §3.13 budget
REP_ROOT_BLOCKS, REP_ROOT_GATE_BLOCKS 1000, 5000 §7.4 budget
REP_HOT_HOURS_PEAK, REP_HOT_HOURS ≥ 6 h (7.9 budget) at peak; 12 h at ≤ 20% load §8.3 budget

Draft 0.2 has no measured numbers. Every value above is a target or a bound, not a result.

Section map

    1. Decisions in one table
    1. Scope and hard constraints
    1. The log
    1. Order-stream wire encoding
    1. Order frames from the sequencer
    1. The data tier (vyrn-data)
    1. Blocks and consensus
    1. Determinism and replay
    1. Storage
    1. Sequencer failover
    1. Byzantine cases
    1. Client diversity (CLIENT_SPLIT)
    1. WAN followers
    1. Replica recovery and membership
    1. Failure matrix
    1. Benchmarks and tests owned here
  • Interfaces to other chapters
  • Local definitions (prefix REP_)
  • Requests to 01
  • Open questions

Where 01 §14 overrides or refines this chapter

  • §14.4, who votes. vyrn-seq never votes, and N_BASE/N_CHAIN count voters only. BASE has 4 voters (2 Rust, 2 Vx) with Q = 3. CHAIN has 5 validators (3 Rust, 2 Vx). Failover promotes the F2 warm standby. This replaces 07's earlier "the sequencer votes". The current text already follows it (D9, D16).
  • §14.5, frame gating. Every response, acks included, is gated, and an acked order survives a sequencer crash. §14.5 names core 4 as the core that drains every lane. 07 follows §14.15 item 3 instead and splits the work between stream-A (core 4) and stream-B (core 7).
  • §14.16. This section fixes INV-REP-6 (3 voters, and R1 alone never keeps the sequencer alive). It also requires the data home to be outside the sequencer's facility and sets replica retention to ≥ 6 h at peak and 12 h at ≤ 20% load. It redefines the frame gate as "written to both replication TX queues and, by B-REP-2W, on the wire no later than the dependent response", which replaces the wording "leave on both paths".
  • §14.19 B, reverts. A fill is undone only by a revert under 07 §9.6 cases (a)–(e) before its block is final, or by a CHAIN bust. 07 §9.6 is the complete list. A reverted trade is void, and nobody is compensated in cases (a)–(c). Case (c), a power loss inside the box while lead < 0, is the only revert that needs just one fault.
  • §14.19 C, withheld data. DAV-1 to DAV-4 apply to the data tier. A session that relies too often on sequencer repairs is closed with reject 26 DATA_MISSING. DAV-3 extends §9.4: the leader may mark such a session's packets unavailable.
  • §14.9. FIN_GATE_BLOCKS = 8 applies in both modes. §14.6 sets the hot ring and the recovery service (§8.5). §14.11 accepts INV-REP-1, INV-REP-6 and 4-hop finality.
  • Open items in §14.18. O1: stream-core load is 0.41, above §14.15's ≤ 0.25. O2: with 07's 142 ns gate the cross fill at index 9 takes 947 ns, not the 880 ns of §14.2. O4: the archive feed is smaller than ingest. O5: the finality gate counts closed blocks.

Implemented by

vyrn-log, vyrn-data, vyrn-consensus, vyrn-replica

Open questions

The chapter lists 12 open questions; see Open Questions.

Clone this wiki locally