Skip to content

Crate vyrn chain

Amp edited this page Nov 18, 2026 · 1 revision

vyrn-chain

crates/vyrn-chain · layer 7 of spec 11 §1.4 · not pinned (11 §1.3)

Purpose

CHAIN mode. On main the crate holds the L1-facing bridge codec and the balance SMT. It turns finalized VYRN state into the bytes that Ethereum L1 and light clients check, and it checks the bytes they produce. Every format is fixed by a spec section and by the conformance vectors in contracts/vectors/. Those vectors were computed without this crate.

Spec sections it implements

  • 09 §6.2, §6.5, §6.7: EIP-712 Post, Unpause, SignerSet digests and 4-of-5 bridge-key signatures
  • 09 §6.2: the keccak256 withdrawal Merkle tree (OpenZeppelin StandardMerkleTree)
  • 09 §9.3: the BLAKE3 sparse Merkle tree, depth 256, with AccountLeaf and BalanceLeaf
  • 09 §6.4, §6.5: Checkpoint → Post, and the guardian's veto decision
  • 01 §14.11: Keccak-256 only in the L1-facing code (RustCrypto sha3, 11 §2.2)

Main public types

Type Role
eip712::Domain, Post, Unpause, SignerSet EIP-712 typed data and digests
eip712::count_sigs, SigError 4-of-5 signature check, with the contract's errors in the contract's order
Withdrawal (wdtree) Withdrawal leaf of the keccak256 tree
Smt, Proof BLAKE3 SMT; Proof::root returns None on a sibling/bitmap mismatch
AccountLeaf, BalanceLeaf Leaf encodings of contracts/README §Leaf encoding
Checkpoint, build_post Finalized state → Post
Guardian, Verdict, VetoReason The guardian's review of a post
keccak256, keccak256_parts Ethereum Keccak-256
Replica, Epochs (traits) What the crate reads from vyrn-replica and vyrn-epoch

Status on main (a9f0d61)

Implemented (partial)

  • Bridge codec, withdrawal tree, SMT and guardian review are implemented. Epochs is implemented over vyrn_epoch::BridgeSignerTable, which owns the bridge signer table (moved there in PR #42).
  • Crate doc: "vyrn-replica is not a dependency yet, so [Replica] has no implementation here; wiring it is a follow-up."
  • Crate doc, "Not implemented yet": "Session open and wallet signatures (§5.2), K_seq/K_com derivation and TESLA disclosure (§5.3–§5.4, §5.10), the order LtHash (§9.4), StateCommit encoding and CommitCert verification (§9.5), the log hash chain (§9.2), slashing evidence (§8), forced inclusion (§7), L1 deposit attestation (§6.3), and the AllocLeaf/SessionLeaf/OperatorLeaf layouts."
  • Tests: 8 #[test] in tests/vectors.rs, against contracts/vectors.

Depends on

Crates
Code (Cargo.toml) vyrn-types, vyrn-crypto, vyrn-epoch; external k256, sha3
11 §1.4 vyrn-replica, vyrn-epoch

Missing: vyrn-replica. Cargo.toml says: "vyrn-replica is not a dependency yet: this crate reads it through its own Replica trait in src/lib.rs until it lands."

Links

Clone this wiki locally