Skip to content

Spec 10 Accounts Risk MD

Amp edited this page Nov 18, 2026 · 1 revision

Spec 10: Accounts, Risk, Fees, Market Data, Drop Copy, Surveillance

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

Status: draft 0.2 (2026-11-13). Its normative base is 01, especially §12 and the binding decisions of §14.

What the chapter decides

The chapter covers who trades (accounts), with what (ledger balances and per-book allocations), under which limits (pre-trade risk in the lane), how a fill moves money (settlement), what trading costs (fees), and what everyone sees afterwards (market data, drop copy, surveillance, statements). Every risk check and every settlement runs on a lane core within the lane's per-message budget. No risk state lives on the BBO core. Market data, drop copy, surveillance and statements run on replica-class boxes, never on the sequencer. They are deterministic functions of the finalized log, so any replica can regenerate them byte for byte. Matching itself is Spec 05, sessions are Spec 04, and the log is Spec 07.

Key decisions

  • Every trading account is a leaf. A master never trades. AccountId 0 is reserved for control ops. A session belongs to one trading account. Accounts are created only by a finalized ledger transaction (§1.1).
  • lane_map gives each account a class (Dedicated on lanes 0–41, Pooled on queues 42–48 on REF). It changes only at an epoch boundary. Replicas compute it deterministically from the finalized log, and the sequencer never does (§1.3).
  • Balances. Deposits and withdrawals touch only the ledger. A book sees only allocations (escrow), held in the lane as a BookBal. All fees are charged in quote (§2.1, §2.2).
  • Epoch-settled balance domains with an optional router domain. Same-asset routes between books of a group run lane-local, and every router imbalance is settled within one epoch (§2.8).
  • Fixed risk check order (13 checks inside 04 §3.3's M1–M8, cheapest and most protective first), run in pass 1 (§3.1). The production code is branch-free over the checks, so every New costs the same 16 cycles whether it is accepted or rejected (§3.10).
  • Cancels are always accepted, during a halt, after a kill and over a rate limit. Mass cancels are chunked. Timers run on order-stream time, so cancel-on-disconnect fires at the same op in every replica (§3.7).
  • BUSY leaves no trace in risk state: no reservation, no rate-limit token, no fee. A BBO-core shed releases the reservation and refunds the fee and tokens (§3.11).
  • Settlement never rejects. A failed checked operation in settle is an engine bug, and it halts the book (§4.5).
  • Fees. Up to 8 tiers per book, selected by the master's trailing 30-day notional. A rebate never exceeds the lowest taker fee. RSK_FEE_PPM_MAX caps every rate at 1% (§5.1, §5.2).
  • v2 preview: isolated-margin linear perpetuals. Liquidation is an ordinary IOC cross from a lane's liquidation account (§6).
  • Market data is generated by a replica, never by the sequencer. One non-voting observer box per facility. The A feed comes from the sequencer's facility, the B feed from the next facility in failover order, and both are byte-identical. On bare metal the A observer reads passive optical taps (§7.1).
  • Drop copy labels four separate facts: execution, durability, finality, settlement. No record is re-sent to change its stage, and a DC_REVERT comes before the DC_FINAL that covers the step (§8.2).
  • Surveillance runs from the finalized log and feeds back into the engine only through finalized control ops. It computes the sequencer fairness statistics that 09 uses (§9, §9.1).
  • Retention. Only the log is archived (7 years). Market data, drop copy and statements are regenerated from it (§10).

Key numbers

The chapter labels numbers budget, measured, vendor or config (§0). None is measured.

Item Value § Kind
RSK_PASS1_CYCLES 16 cycles (3.2 ns at 5 GHz) §3.10 budget; stated as a maximum, not an average
RSK_PKT_NS 6 ns of the 45 ns per packet §3.10 budget
RSK_SETTLE_NS 12 ns per fill event §4.6 budget
Settlement load at the design point 1.2% of a lane §4.6 budget
ACC_LANE_TARGET_PPM 500_000 (50% of a lane) §1.3 budget
ACC_MAX_ACCOUNTS_PER_LANE 65_536 Local definitions budget
RSK_MAX_OPEN_HARD 1_048_576 §3.4 const (hard bound)
RSK_FEE_PPM_MAX 10_000 (1%) §5.1 const (hard cap)
Account kill, control core to lane ≤ 20 µs §3.7 budget
MBO feed at the design point ~1.0B records/s, ~140 Gbps §7.2 budget
MD_LAG_P99_NS 5_000 §7.8 budget
Drop-copy record after the Fill ≤ 20 µs (REQ-LAT-12: p99 ≤ 50 µs) §8.2 budget
__udivti3 libcall ~40–80 cycles §4.6 vendor

Section map

    1. Scope, constraints and number labels
    1. Accounts
    1. Balances and per-book allocations (escrow)
    1. Pre-trade risk in the lane (v1, fully collateralized spot)
    1. Settlement on fill events
    1. Fees
    1. v2 preview: isolated-margin linear perpetuals
    1. Market data (vyrn-md)
    1. Drop copy (vyrn-dropcopy)
    1. Surveillance
    1. Reports, statements and retention
  • Interfaces to other chapters
  • Local definitions
  • Requests to 01
  • Open questions

Where 01 §14 overrides or refines this chapter

  • §14.2: pass 1 costs LANE_PASS1_NS = 5 ns per message plus 45 ns per packet. Risk fits inside it.
  • §14.11, §14.16: accept QuoteAmt, BaseLots, BookSpec, the fill-event layout, control session 0 and the observer box (3 × dual-port ConnectX-6 Dx plus 3 × X2541).
  • §14.13 item 3, item 5: the four separate attestations, and epoch-settled balance domains with an optional router domain.
  • §14.15, §14.17 items 2 and 4: lane classes and their BUSY bounds, and the logged AcctTake. 10's Request 10 (BBO_CROSS_NS = 40, N_LANES_REF = 50) is stale: 00-index lists N_LANES_REF = 49 and BBO_CROSS_NS = 15 as already in 01.
  • §14.19 A: the 1 µs contract covers every received packet. The chapter text still says "every accepted packet" (§0).
  • §14.19 B: a fill is undone only by a 07 §9.6 revert before finality, or by a CHAIN bust whose verdict is final with it. This overrides §4.5's wording that "a fill is final when the BBO core writes it". In 01 terms the fill is only EXECUTED at that point.

Implemented by

vyrn-risk; market data: vyrn-md (MBO encoder, record codec, reference subscriber)

Open questions

The chapter lists 12 open questions. See Open Questions.

Clone this wiki locally