Skip to content

Crate vyrn types

Amp edited this page Nov 18, 2026 · 1 revision

vyrn-types

Path: crates/engine/vyrn-types · Layer 0 (11 §1.4) · Pinned: yes (11 §1.3)

Purpose

vyrn-types holds the shared vocabulary of every other crate: the newtypes of 01 §3, the constants of 01 §5, the reject and step codes of 01 §6.5 and §14.10, and the record structs of 01 §6.6. Its only logic is checked arithmetic on Qty, Tick and notional (01 §11.4). It has no dependencies, and it is #![no_std] and #![forbid(unsafe_code)]. The constants are budgets unless 01 says otherwise; none of them is a measurement.

Spec sections it implements

  • 01 §3: newtypes (Tick, Qty, AccountId, SessionId, LaneId, LaneSeq, StepId, Handle, Epoch, Height, Nanos, BookId, PktHash, Tag, Hash)
  • 01 §5: constants as pub const (for example LAT_MAX_NS, N_LANES_REF = 49 as 42 dedicated + 7 pooled per 01 §14.15, CACHE_LINE)
  • 01 §6.5 and §14.10: RejectReason and StepKind codes
  • 01 §6.6: the record structs
  • 01 §11.4: checked arithmetic

Main public types

Type Role
Tick, Qty Price index in the book's tick ladder (tick 0 is "no bid") and quantity in lots, with checked arithmetic
Handle Lane-local order handle: bits 0–23 slot, bits 24–31 generation
LaneSeq, StepId Per-lane sequence of applied ops and per-book sequence of BBO-core steps; both start at 1 each epoch
Epoch Epoch number; low16() gives the epoch16 the wire carries
RejectReason, StepKind The Reject.reason codes and the BBO step kinds
HomeCode, Mode Home region and BASE/CHAIN mode
PacketRecord, StepRecord<N> Order-stream records of 01 §6.6
BlockHeader, HandoffRecord, AcctTake Block header, epoch handoff record and pooled-lane token record
Dense, DenseId Dense arrays indexed by an id's slot

Status on main (a9f0d61)

Implemented. Own version 0.1.0, released as vyrn-types-v0.1.0; publish = false. The crate notes one code that is reserved but not yet assigned: "25 is reserved for RESEND_RECOVERY (03 Request 10), not yet in 01" (src/codes.rs:39).

Tests: the crate has no tests/ directory. Unit tests sit in src/lib.rs, src/codes.rs and src/dense.rs: 10 #[test] functions in all.

Depends on

No workspace crates and no external crates. This matches 11 §1.4 (layer 0) and 11 §1.3 ("No dependencies").

Links

Clone this wiki locally