Skip to content

Crate vyrn wire

Amp edited this page Nov 18, 2026 · 1 revision

vyrn-wire

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

Purpose

vyrn-wire parses and builds the packets and records of 01 §6.1–6.5, and defines the RxRing and TxRing traits of 06 §6.1 that every NIC backend implements. Parsing uses zerocopy layouts, so it needs no unsafe (#![forbid(unsafe_code)]). Every parse returns a Result whose error is a 01 §6.5 reason with its 04 §14 detail, and nothing panics on input bytes. Every parse refuses a nonzero reserved field or bit (VR1) instead of ignoring it, so later versions can give those bits meaning.

Spec sections it implements

  • 01 §6.1 (ReqHeader, Request; checks V1 and V9 of 04 §3.1)
  • 01 §6.2 (Msg and its flags; checks M2 and M3 of 04 §3.3, flags 04 §6.1)
  • 01 §6.3 and 04 §1 (RespHeader, Response, MAX_RECS_PER_PKT, PROTO_RESP_MAX_BYTES)
  • 01 §6.4 and §14.10, 04 §7, 09 §17.2 (Record and its enums)
  • 01 §6.5, 04 §8 and §14 (WireError, PROTO_D_*)
  • 04 §4.1 (session_*), 04 §12 (PROTO_VERSION), 06 §6.1 (ring)

Main public types

Type Role
ReqHeader, Request, encode_request Request packet header, a length- and count-consistent request, and its encoder
Msg (Side, Tif, Stp, OrderFlags) One 16-byte request message
RespHeader, Response, encode_response Response packet header, response, encoder
Record (Liq, OutCause, AttestLevel) One response record; index is 0–9 or INDEX_NONE (0xFF)
RawRec The 16-byte shape shared by 01 §6.2 and §6.4
WireError Reject reason plus detail for bytes that did not parse
RxRing, TxRing One receive queue (lane or cut core) and one transmit queue (TX core)
RxPkt, NicCounters Received-frame descriptor and per-queue counters, same layouts as vyns_rx and vyns_counters in shim.h
PROTO_VERSION Protocol version this crate parses and builds; carried at session open, not in the packet

Status on main (a9f0d61)

Implemented. Own version 0.1.0, released as vyrn-wire-v0.1.0; publish = false. The crate docs name no missing piece or follow-up.

Protocol version mismatch. PROTO_VERSION is 2 (src/lib.rs:59); the changelog's last entry is "Bump PROTO_VERSION to 2 for the RATE_LIMIT id move". But every profile in deploy/profiles (aws, consumer, dev, ref) still says protocol = 1. 11 §10.1 says the binary refuses to start when the config's protocol version does not match the release.

Tests: tests/vectors.rs (3 #[test]), tests/props.rs (3, proptest), and unit tests in msg.rs, record.rs, ring.rs and session.rs (7). Total: 13 #[test] functions. tests/golden/README.md says how an independent implementation checks itself against the conformance vectors.

Depends on

Workspace: vyrn-types, vyrn-crypto. External: zerocopy; dev: proptest. This matches 11 §1.4 (layer 2, vyrn-wire → vyrn-crypto).

Links

Clone this wiki locally