Skip to content

Architecture

Amp edited this page Nov 18, 2026 · 2 revisions

Architecture

This page follows the master diagram of spec/00-index.md and the crate layers of spec/11-build.md §1.4. The spec is the source of truth; Spec 03: Architecture summarizes the full architecture chapter.

The master diagram (00-index)

                              ┌── one home region (the sun's) ──────────────────────────────────────┐
  clients (colo / cloud)      │  facility F1                                                        │
  each packet is sent twice   │  ┌── vyrn-seq ─────────────────────────────────┐                    │
                              │  │                                             │                    │
    1. to the sequencer ──────┼─►│ NICs ─► 49 lanes ─► BBO core ─► TX ─────────┼─► fills/acks ──────┼──► clients
    2. to a data node         │  │            │            ▲ │                 │                    │
      │                       │  │            └─► cut core─┘ └─► order frames ─┼───┐                │
      │                       │  └─────────────────────────────────────────────┘   │ 2 paths        │
      │                       │                                                    │                │
      │                       │  facilities F2 … Fn                                ▼                │
      │                       │  ┌── vyrn-data ──┐              ┌── vyrn-replica ×(n−1) ──────────┐ │
      └───────────────────────┼─►│ data tier     ├── payloads ─►│ replay engine (same code)       │ │
                              │  └───────────────┘              │ Simplex: 1 ms blocks, q votes   ├─┼─┐
                              │                                 │ state roots · market data       │ │ │
                              │                                 └───────────────┬─────────────────┘ │ │
                              │                                                 │                   │ │
                              │         finality ≤ 10 ms ◄── certificate ───────┘                   │ │
                              └─────────────────────────────────────────────────────────────────────┘ │
                                                                                                      │
   other homes (followers) ◄── finalized log over WAN ────────────────────────────────────────────────┘
   TYO ──8h──► LDN ──8h──► NYC ──8h──► TYO      handoff = certificate (e, S) + opening auction

How an order flows

  1. The client sends each packet twice (00-index; 07 §5): one copy to the sequencer vyrn-seq in facility F1, one to a vyrn-data node in another facility. A session's data home is never in the sequencer's facility (01 §14.16).
  2. A lane (one pinned core that owns a shard of accounts) runs deadline admission (01 §14.1), the session, MAC, sequence and risk checks, and classifies each message against its BBO snapshot. Joins and cancels stay in the lane; improves and crosses go to the BBO core (01 §14.2, 05). A lane never decides a fill (INV-LANE-NOMATCH).
  3. Two cut cores publish the cut: one LaneSeq per lane (01 §14.3). The BBO core executes every step and is the only writer of fills and of the BBO (INV-WRITER).
  4. Order-stream cores write each step's ordering frames to both replication paths before any response that depends on them leaves (INV-FRAME-FIRST, 01 §14.5). TX cores send fills and acks.
  5. Replicas (vyrn-replica, n − 1 of them plus R1 in F1) join the order frames with the payloads from the data tier, replay the log with the same engine code (01 §11.6), and run Simplex on 1 ms blocks. A quorum certificate makes a block final; the budget is ≤ 10 ms (FINALITY_MAX_MS). The sequencer never votes (01 §14.4).
  6. Follower homes receive the finalized log over the WAN. Every 8 hours the book moves to the next home; the handoff is a certificate over (e, S) plus an opening auction (08).

The fact that an execution is volatile, durable, final or settled is reported separately, never merged into one flag (01 §14.13 item 3). Spec 12 states the whole lifecycle.

Modes

Mode Voters Quorum Client split Source
BASE (off-chain) 4 replicas 3 2 Rust, 2 Vx 01 §5, §14.4
CHAIN (on-chain) 5 validators 4 3 Rust, 2 Vx 01 §5, §14.4

The binaries are the same in both modes; the mode is configuration (C-ONEBIN). Each home keeps a warm standby vyrn-seq in F2; failover promotes it and never a voting replica (01 §14.4).

Reference core map (01 §10, budgets)

Cores Use
0, 3, 5 fill TX cores C, A, B
1, 6 cut cores A (lanes 0–24) and B (lanes 25–48)
2 BBO core
4, 7 order-stream cores A and B
8–49 42 dedicated lanes, one firm each
50 order hasher
51 OS, IRQs, control; the only core that is not isolated
52–55 spares for planned lane evacuation
56–62 pooled lane group, lanes 42–48 (01 §14.15)
63 spare

Crate layers (11 §1.4)

An arrow means "depends on". This is the graph as the spec states it:

  layer 0   vyrn-types
  layer 1   vyrn-crypto · vyrn-cut · vyrn-risk · (all others) ──► vyrn-types
  layer 2   vyrn-wire ──► vyrn-crypto
            vyrn-bbo ───► vyrn-cut
            vyrn-log ───► vyrn-crypto
  layer 3   vyrn-nic (+ C shim) ──► vyrn-wire
            vyrn-lane ──► vyrn-wire, vyrn-cut, vyrn-risk, vyrn-bbo
  layer 4   vyrn-engine ──► vyrn-lane, vyrn-bbo, vyrn-cut, vyrn-wire
            vyrn-consensus ──► vyrn-log, Commonware
            vyrn-data ──► vyrn-log, vyrn-nic
  layer 5   vyrn-epoch ──► vyrn-consensus
  layer 6   vyrn-replica ──► vyrn-engine, vyrn-consensus, vyrn-epoch, libvyrn_vx_client
  layer 7   vyrn-md ──► vyrn-replica
            vyrn-chain ──► vyrn-replica, vyrn-epoch
  test-only:  vyrn-sim ──► everything above + libvyrn_vx_oracle
              vyrn-bench ──► engine crates, vyrn-nic, vyrn-log, libvyrn_vx_oracle

Three rules the graph encodes (11 §1.4): the engine never depends on a NIC (it uses vyrn-wire's ring traits); consensus never depends on the engine ("BFT finalizes the order, not the state"); only vyrn-replica sees both replay engines, through the ReplayEngine trait. tools/lint-engine checks the engine part of the graph in CI.

The graph on main at a9f0d61

Internal dependencies read from each crate's Cargo.toml:

Crate Layer Depends on (internal) Matches 11 §1.4?
vyrn-types 0 — yes
vyrn-crypto 1 types yes
vyrn-cut 1 types yes
vyrn-risk 1 types yes
vyrn-wire 2 types, crypto yes
vyrn-bbo 2 types, cut yes
vyrn-log 2 types, crypto yes
vyrn-nic 3 types, wire yes
vyrn-lane 3 types, wire, cut, risk, bbo yes
vyrn-engine 4 types, lane, bbo, cut, wire yes
vyrn-consensus 4 types, crypto, log yes
vyrn-data 4 types, crypto, wire, log, nic yes
vyrn-epoch 5 types, consensus, crypto yes
vyrn-replica 6 types, crypto, engine, epoch, wire, consensus, log almost: everything but libvyrn_vx_client, which does not exist; no ReplayEngine implementation yet
vyrn-md 7 types, nic not yet: no vyrn-replica; it owns a ReplayStream trait as the seam
vyrn-chain 7 types, crypto, epoch not yet: no vyrn-replica; it owns a Replica trait with no implementation
vyrn-sim test every crate yes
vyrn-bench test engine crates, nic, log yes (no Vx oracle link yet)

Binaries: vyrn-seq links engine, nic, log, consensus and epoch; vyrn-validator links replica and chain; both have an empty main. See Known Gaps.

Clone this wiki locally