Repository navigation
Crate vyrn md
crates/vyrn-md · layer 7 of spec 11 §1.4 · split: publisher threads pinned (11 §1.3) · binaries vyrn-md and vyrn-dropcopy
Market data and drop copy from a replica's replay events. On main the crate turns a stream of replayed events for one book into MBO packets. The output is a pure function of the stream, so the A and B observers emit identical bytes. The crate also ships a reference subscriber that applies the merge rule and rebuilds the replica's book after every step. It was merged in PR #40.
- 10 §7.3 (packet framing, flush rules, heartbeats)
- 10 §7.4 (MBO lane channels, the step channel, the merge rule)
- 10 §7.5 (16-byte record layouts)
- Not yet: 10 §8 (drop copy)
| Type | Role |
|---|---|
ReplayStream (trait), Event, EventKind, BookOp
|
The input seam that the observer replica will implement |
MboEncoder, PacketSink, StreamError
|
Event stream → MBO packets; rejects streams that break ordering rules 1–2 |
Header, Packet, Channel, Feed, PacketError
|
32-byte header, up to 88 records per packet |
Record, RecordError, Side, DeleteCause, AttestKind, BookStatus
|
The 16-byte record codec |
MboSubscriber, SubError
|
Reference reader, implementing the 10 §7.4 merge rule |
Book, Order, BookError
|
The book that the subscriber rebuilds |
NO_WATERMARK |
"No watermark yet" for interval 0 (a labeled spec gap) |
Implemented (partial)
- The MBO encoder, the record codec and the reference subscriber are implemented.
Feeddefines codes forMBO-C,MBP-10,TOB,TRADESandSTATS, but onlyMBOhas an encoder. - Drop copy is not implemented. src/dropcopy.rs is one line,
//! Drop copy (10). - Both binaries are stubs: src/bin/vyrn-md.rs and src/bin/vyrn-dropcopy.rs are
fn main() {}. - The crate doc lists five spec gaps. Gap 2: "A quiet lane channel advances its watermark only by heartbeat (
MD_HEARTBEAT_MS = 1), which can hold steps for up to 1 ms, againstMD_LAG_P99_NS = 5_000. [Likely] Not solved here." - Tests: 14
#[test]. tests/mbo.rs has 12, and tests/vectors.rs has 2, which usetests/mbo_vectors.txtandtests/record_vectors.txt.
| Crates | |
|---|---|
Code (Cargo.toml) |
vyrn-types, vyrn-nic (vyrn-nic is declared, but no source file uses it) |
| 11 §1.4 | vyrn-replica |
| 11 §1.3 binaries |
vyrn-md: vyrn-md, vyrn-replica (replay core), vyrn-nic; vyrn-dropcopy: vyrn-md::dropcopy, vyrn-replica
|
Missing: vyrn-replica. Cargo.toml says it "returns when its replay core lands; until then the replica implements ReplayStream (src/stream.rs) and nothing here links it."
- Code: crates/vyrn-md
- Spec: Spec-10-Accounts-Risk-MD, Spec-11-Build
- Related: Crate-vyrn-replica, Crate-vyrn-nic, Known-Gaps
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.