Skip to content

L1 Bridge Contracts

Amp edited this page Nov 18, 2026 · 1 revision

L1 bridge contracts

contracts/ · Foundry project, Solidity 0.8.30, EVM prague · the Ethereum L1 custody and bridge contract of CHAIN mode

Purpose

The L1 contract of CHAIN mode. It covers spec 09 §6 (custody and the bridge), the L1 side of §7 (forced inclusion), REQ-CHN-6 and B-CHN-4 (the escapeClaim gas report). The README says: "spec/11-build.md §1.2 gives Solidity no place in the tree, so the Foundry project lives in contracts/ at the repository root." VyrnBridge is immutable: no proxy, no admin, no upgrade (09 §6.1).

Spec sections it implements

  • 09 §6.1–§6.7: deposits, posts, veto, claims, pause and unpause, signer rotation, escape
  • 09 §6.2: the withdrawal tree (keccak256, OpenZeppelin StandardMerkleTree)
  • 09 §9.3: BLAKE3 SMT verification for escapeClaim
  • 09 §7: the escape hatch only. The contract has no forced-inclusion entry point
  • 09 §2.2: roles and keys (5 bridge keys, 4 of 5 needed; 5 guardian keys, any one may veto or pause)

Files

Path What
src/IVyrnBridge.sol The ABI: structs, events, errors, functions
src/VyrnBridge.sol The contract
src/SmtVerifier.sol, src/Smt.sol BLAKE3 SMT verifier, deployed by the bridge's constructor
src/Blake3.sol, src/SmtEmpty.sol Generated by script/gen_blake3.py and script/gen_smt.py
test/ VyrnBridge.t.sol, Escape.t.sol, Vectors.t.sol, Smt.t.sol, Blake3.t.sol
vectors/ blake3.json, eip712.json, smt.json, wdtree.json, computed without the contract (eth-account, cast, @openzeppelin/merkle-tree, Python blake3)

Status on main (a9f0d61)

Implemented

  • Every path in the README's behaviour table has code and tests: deposit, post, veto, re-propose, claim with the 24 h cap, pause, unpause, rotation, escape, escapeClaim, refundDeposit.
  • Tests: 40 test* functions. VyrnBridge.t.sol has 21, Escape.t.sol 8, Vectors.t.sol 5, Smt.t.sol 4 and Blake3.t.sol 2. Fuzz runs: 256 by default and 128 in the ci profile (foundry.toml).
  • CI job contracts runs forge fmt --check, forge build --sizes and FOUNDRY_PROFILE=ci forge test --gas-report.
  • The README lists six decisions "where the spec is silent or differs". For example: escapeClaim takes the AccountLeaf as well as the BalanceLeaf, and Unpause(uint64 pauseNo) is a message type 09 does not name. Another: the SMT verifier is a separate contract because the bridge with BLAKE3 inlined is over the EIP-170 limit. The README also proposes the SMT leaf encoding, which 09 §9.3 does not fix, and "which the vyrn-chain crate must use or replace through the spec".

Used by

  • Crate-vyrn-chain checks itself against contracts/vectors/ in tests/vectors.rs. That crate builds posts and checks signatures, but has no L1 deposit attestation (09 §6.3) yet.

Links

Clone this wiki locally