Skip to content

Crate vyrn engine

Amp edited this page Nov 18, 2026 · 2 revisions

vyrn-engine

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

Purpose

vyrn-engine joins lane, cut and BBO into one engine, in two modes: live and replay. It adds no matching rule: every decision is made by vyrn-lane or vyrn-bbo, and the engine plays the cores neither crate implements (the cut cores, the stream-core role, the snapshot fan-out). It owns seal(), the sealing allocator (INV-NOALLOC) and the core-role table. The mode is chosen by the call, not by a build flag (C-ONEBIN).

Spec sections it implements

  • 11 §1.3 (crate scope), §3.5 (sealing allocator), §3.1 (clock reads), §6.4 (single-threaded schedule)
  • 05 §1.1, §4.1 (shared lines), §4.13 and §7.1 (half-cuts, INV-CUT-MONO), §4.14 (snapshot), §4.15 (LaneCut, INV-FRAME-FIRST), §8.10 (responses), §10 (replay; rows 1–3 and 6), §14.3 (faults)
  • 01 §11.6 (live and replay modes), §6.6 (order stream)

Main public types

Type Role
Engine One box; ingest, step, poll_lanes, run (live) and replay
Shared Every line and ring of one box, built before seal()
Sink Where outputs go: lane responses, TX packets, order-stream records
Rec, OwnedRec One order-stream element as emitted; owned form for replay
Payloads Packet bytes by record, for replay
Diverged, Why Replay stopped at a record: Mismatch, NoPayload, SourceTooOld, BadRecord, NoStep, Fault
Fault Engine fault; the caller fail-stops the sequencer or replica
alloc::SealingAlloc, seal, seal_counting The global allocator; per-thread seal; counting form for tests and vyrn-sim
role::Role One core's role (including PoolLane, Spare)

Status on main (a9f0d61)

Implemented (partial). Version 0.1.0 from the workspace; publish = false.

  • Replay from the log (PR #47). Each step runs through vyrn_bbo::Bbo::replay_step with its cut, source, kind (including Shed and CONT) and Rescan band taken from the record (05 §10 rows 4–5). Each packet runs through vyrn_lane::Lane::replay_packet; an op is forwarded iff a later StepRecord names it, never by the lane's snapshot (05 §10 rows 1–3, 7). No clock is read; every output record is checked against the log.
  • New replay rejects: Why::BadStep, Why::Step (with vyrn_bbo::Diverge), Why::StepTooOld.
  • The crate doc's "Scope of this version (each is a PR follow-up)":
    • "Live mode is the single-threaded schedule of 11 §6.4 (vyrn-sim order)." Pinned threads belong to the binary.
    • A forwarded op's route is derived from its first step's kind, "because the log does not carry the live classification. A Cross that STP stops before any fill is logged as Improve … a known divergence until the spec logs the route."
    • "Pooled lanes (AcctTake), auction control steps, and the Sim visibility backend in tests."
  • Engine::replay reads the engine's own journal (OwnedRec), not 07's wire StepRecord; vyrn-replica's ports.rs says the wire record lacks fields this replay compares, so no RustReplay exists yet.

alloc is the only module allowed unsafe (UNSAFE.toml). Tests: tests/engine.rs and tests/alloc.rs, with tests/harness/. Total: 11 #[test] functions.

Depends on

Workspace: vyrn-types, vyrn-lane, vyrn-bbo, vyrn-cut, vyrn-wire; dev: vyrn-risk. This matches 11 §1.4 (layer 4, vyrn-engine → vyrn-lane, vyrn-bbo, vyrn-cut, vyrn-wire). It does not depend on vyrn-nic, as the graph requires.

Links

Clone this wiki locally