Repository navigation
Spec 04 Protocol
Source: spec/04-protocol.md at commit a9f0d61. The file is the source of truth; this page is a summary.
Chapter 04 defines the order-entry protocol between a client and the home that runs the book. It covers UDP transport and ports, the dual send to the sequencer and the data tier, the order of checks in the lane, deadline admission and BUSY, lane classes and pacing, the session life cycle and keys, reliability across loss, failover and epoch handoff, message and response semantics, reject reasons, rate limits and fee classes, and conformance test vectors. The byte layouts live in 01 §6, and this chapter does not change them. The client-side contract: every received packet of 1–10 messages gets the first record of every message, or an explicit reject, within LAT_MAX_NS. The Spec 01 §14 decisions win wherever they differ from this chapter.
- Transport is UDP over IPv4 with one 16-byte header, up to 10 fixed 16-byte messages and two tags. TCP is rejected because failover and handoff already need application-level sequencing, and TCP adds head-of-line blocking and per-connection cost (P1, §2.1).
- The destination port selects the lane, so the NIC steers each packet with no software hop (P2, §2.2).
- Every packet is sent twice with identical logical content: once to the sequencer and once to the session's data home. Two validly tagged copies with different content close the session for equivocation (P3, D1–D6, §2.4).
- The cheapest checks run first (V0–V11, then M1–M9 per message). An unbound source never costs a SipHash. A bad MAC closes the session only when it comes from the bound address with a matching
epoch16(P4, §3.1, §3.4). - Deadline admission (test D) runs before V6. A lane shed is an out-of-stream
BUSYfor the whole packet, and nothing is applied. A BBO-core shed is an in-streamBUSYat the message's index. Both arrive withinLAT_MAX_NS(P11, §3.5). - Paced dedicated lanes follow
LANE_PACE: the gap between packets is at leastlane_ns+ 10 + 25 ns. The SDK puts a packet's cancels first (P13, §3.6). -
pkt_seqis gapless and the lane accepts onlyexpected. A gap getsBAD_SEQand the client goes back N. Each(session, pkt_seq)executes at most once, across failover and handoff (P5, §5.1–§5.2). -
resp_seqhas one allocator, the lane. TX cores send B-packets in reserved slots and maker fills from a 16-number relative credit (P6, §7.1). - Responses are kept in two tiers: a 4 GiB ring per lane on the sequencer and the recovery service on a replica.
RESEND_GONEis sent only when both have dropped the range (P8, §5.4). - After a failover, a sequencer-change
EpochNoticestarts the rewind rule: any response at or above itsresp_seqis void (§5.6, §7.4). - Handoff rules H1–H9: sessions survive the boundary, and packets staged at the new home form the auction window, the only window without a 1 µs answer (§5.7).
- Execution, durability, finality and settlement are separate attestations, reported in
Attest0x88 at levels 1–3 (P12, §7.5). - Rate limits are GCRA buckets on
rx_ts, so replicas reproduce everyRATE_LIMIT. 04 uses bucket ids 1–7 and 10 uses 8–11 (P10, §9.1). - The wire has no version field. The version is fixed at session open, and this chapter is protocol version 2 (§12).
| Name | Value | § | Status in the spec |
|---|---|---|---|
LAT_MAX_NS |
1 µs | intro, §3.5 | hard maximum |
MAX_REQ_PAYLOAD / PROTO_RESP_MAX_BYTES
|
192 B / 280 B | §2.3 | computed from 01 §6 |
| V6 SipHash-2-4 | 10 ns (n = 1) to 40 ns (n = 10) | §3.1 | budget |
PROTO_SHED_NS / PROTO_BUSY_TAIL_NS
|
20 ns / 460 ns | §3.5, §14 | budget |
Worst lane BUSY path |
320 + 180 + 20 + 460 = 980 ns | §3.5 | budget |
BBO-core BUSY path |
390 ns | §3.5 | budget |
E4 policer (LANE_POLICE_PPS, burst) |
40M packets/s, 8 | §3.4 | from 01 §14.1 |
PROTO_PACE_MARGIN_NS / PROTO_PACE_JITTER_NS
|
10 / 25 ns | §3.6 | budget |
RESP_HOT_RING_BYTES / RESP_RETAIN_PKTS
|
4 GiB per lane / 65,536 per session | §5.4 | budget |
PROTO_MAKER_RANGE / PROTO_MAKER_PKT_NS
|
16 numbers / 16 ns | §7.1 | budget |
PROTO_REQ_RTO_US, PROTO_REQ_RTO_MAX_MS
|
200 µs, 20 ms | §5.1 | budget |
PROTO_TIMEOUT_DEFAULT_MS |
350 ms | §4.8 | budget |
| Linux minimum TCP RTO | 200 ms | §2.1 | vendor (kernel default) |
All PROTO_* values are budgets unless marked otherwise. Draft 0.2 has no measured numbers.
-
- Scope and constraints
-
- Decisions at a glance
-
- Transport
-
- The validation pipeline in the lane
-
- Sessions
-
- Reliability
-
- Messages
-
- Responses
-
- Reject reasons
-
- Rate limits and fee classes
-
- The order as the client sees it
-
- Conformance test vectors
-
- Versioning
-
- Interfaces to other chapters
-
- Local definitions
-
- Requests to 01
-
- Open questions
- §14.19 A. This ruling sets the latency contract's scope: REQ-LAT-1 covers received packets, and a packet a policer drops is ingress loss with no response. The chapter's intro, §3.4 (E4) and §3.5 already follow it.
-
§14.19 B. A fill is undone only by a revert before finality or by a CHAIN
Bustwhose verdict is already final. Settlement never undoes a final fill. §7.3 and §7.5 follow this ruling. -
§14.19 C. Reject reason 26
DATA_MISSINGcomes from this ruling (§8). -
§14.15 item 1 (pacing). 01 says a paced client leaves at least
predicted_path_nsbetween packets. §3.6 paces bylane_nsplus margin and jitter instead, and Request 9 asks 01 to change its wording. 01's text stands until it does. - §14.17.5 (maker count). 01 says about 40 makers at index 9. §7.1 and Request 10 compute 18 at 16 ns on three TX cores (Q4).
- §14.14 (maker numbering). 01 describes a reserved 16-number range. §7.1 treats the range as a relative credit placed by a merge rule, and Request 7 asks 01 to say so.
-
§14.1 (BUSY stream). Request 6 asks 01 to state that a lane
BUSYis out of stream and a BBO-coreBUSYis in stream, as §3.5 does.
vyrn-wire, vyrn-lane, vyrn-data
The chapter lists 12 open questions (Q1–Q12; Q13 and Q14 are settled); 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.