Skip to content

Crate vyrn sim

Amp edited this page Nov 18, 2026 · 1 revision

vyrn-sim

crates/vyrn-sim · test-only in spec 11 §1.4 ("everything above + libvyrn_vx_oracle") · no production artifact links it (11 §1.3)

Purpose

11 §1.3 and §6.4 give this crate three jobs: the deterministic whole-cluster simulator (one thread, virtual time, seeded), the oracle binding, and the invariant checkers. On main (881 Rust lines) it holds the oracle binding and a scenario runner. The oracle binding loads libvyrn_vx_oracle and calls its C ABI from vx/abi/pbv.h. The scenario runner runs the hand-written scenarios of tests/golden/scenarios/*.scn against the oracle.

Spec sections it implements

  • 11 §5.2 (the oracle ABI and the rule that "the oracle is not trusted either": scenarios written from 05, 08 and 10)
  • 01 §6.5 and §14.10 (reject and Out codes, which the scenario parser resolves by name)
  • Not yet: 11 §6.4 (the whole-cluster deterministic simulator)

Main public types

Type Role
oracle::Oracle One oracle book in a dlopened library (pbo_new, pbo_apply, pbo_state_bytes, pbo_free)
oracle_abi::Config pbo_config, mirrored with the same sizes and offsets
oracle_abi::Account, Session pbo_account, pbo_session
oracle_abi::Event, Record pbo_event (56 bytes), pbo_record
oracle_abi::ABI_VERSION, E_CAP, E_EVENT, E_FULL, E_FAULT ABI version and the pbo_apply error results
scenario::run Runs one .scn file against the oracle library
scenario::golden_responses Reads expected responses from tests/golden/vyrn_proto_vectors.out

Status on main (a9f0d61)

Implemented (partial)

  • The oracle binding and the scenario runner are implemented. tests/golden/scenarios holds 14 .scn files.
  • The crate is not yet the simulator of 11 §6.4. There is no event loop, sim network, cluster boxes or invariant checker. The crate doc's first line still says "Deterministic whole-cluster simulator, oracle binding, invariant checkers."
  • The vyrn-sim binary is a stub: src/main.rs is fn main() {}.
  • tests/seeds.toml has seeds = [], and tools/sim-swarm has an empty main.
  • Tests: 2 #[test] in tests/oracle_scenarios.rs. scenarios_against_the_vx_oracle passes with a "skipped" message when target/vx/libvyrn_vx_oracle.{so,dylib} is missing, unless VYRN_REQUIRE_VX_ORACLE=1 is set. No CI workflow runs vx/build.sh or sets that variable.

Depends on

Crates
Code (Cargo.toml) vyrn-types, -crypto, -wire, -cut, -risk, -bbo, -lane, -engine, -nic, -log, -data, -consensus, -replica, -epoch, -chain, -md; commonware-runtime, libc (for dlopen)
11 §1.4 everything above, plus libvyrn_vx_oracle (Vx, C ABI)

The declared dependencies match the graph. The oracle library is loaded at run time, not linked. No source file uses the internal crates yet.

Links

Clone this wiki locally