Repository navigation
Spec 07 Replication
Source: spec/07-replication.md at commit a9f0d61. The file is the source of truth; this page is a summary.
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.
-
The log has two parts (§2.1, D1). The order stream (
PacketRecord,StepRecord, headers and related records) comes fromvyrn-seq. Payloads come fromvyrn-data. They are checked bypkt_hashanddata_root. -
Compact encoding (§3, D2). The order stream is LEB128 delta-encoded per lane: a
PacketRecordcosts ~6 B. The 8-bytepkt_hashtravels 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
BUSYuntilLaneCutcovers the op (INV-REP-11). -
The gate is a maximum, not a percentile (§4.7, D5). Three rules make it a bound: an early
StepRecordpush, 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-databox per facility. A session's data home is outside the sequencer's facility.data_rootcovers 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 loggedControl(Halt)step. -
Durability and finality are separate facts (§6.9).
DUR_PATHS,DUR_QUORUMandFINALare 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-seqin 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.
| 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.
-
- Decisions in one table
-
- Scope and hard constraints
-
- The log
-
- Order-stream wire encoding
-
- Order frames from the sequencer
-
- The data tier (
vyrn-data)
- The data tier (
-
- Blocks and consensus
-
- Determinism and replay
-
- Storage
-
- Sequencer failover
-
- Byzantine cases
-
- Client diversity (
CLIENT_SPLIT)
- Client diversity (
-
- WAN followers
-
- Replica recovery and membership
-
- Failure matrix
-
- Benchmarks and tests owned here
- Interfaces to other chapters
- Local definitions (prefix REP_)
- Requests to 01
- Open questions
-
§14.4, who votes.
vyrn-seqnever votes, andN_BASE/N_CHAINcount 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.
vyrn-log, vyrn-data, vyrn-consensus, vyrn-replica
The chapter lists 12 open questions; see Open Questions.
Overview
Working on VYRN
Spec
- 00 Index
- 01 Conventions
- 02 Requirements
- 03 Architecture
- 04 Protocol
- 05 Engine
- 06 Platform
- 07 Replication
- 08 Epochs
- 09 Chain
- 10 Accounts, Risk, MD
- 11 Build
- 12 Commitment
- 13 Availability
- 14 Envelope
Engine crates
Other crates
- vyrn-nic
- vyrn-log
- vyrn-data
- vyrn-consensus
- vyrn-replica
- vyrn-epoch
- vyrn-chain
- vyrn-md
- vyrn-sim
- vyrn-bench
Binaries
- vyrn-seq (stub)
- vyrn-validator (stub)
- vyrn-admin
Outside Rust
Reflects main at a9f0d61.