Skip to content

v0.9.0

Choose a tag to compare

@opacusio opacusio released this 01 Nov 06:10

Atomic swaps end to end on testnet: in-circuit swap hashlocks (WG-26), chain-level enforcement (WG-27), encrypted note transmission (WG-29) and monerod-facing CLSAG verification (WG-CLSAG).

Highlights

WG-26 — swap hashlock in-circuit (opacus-zk). A v4 spend can lock a note to a Poseidon hashlock H = Poseidon_3(dom_swap, s0, s1) over two canonical 16-byte lanes of the 32-byte swap preimage. Modes lock (1) / claim (2) / refund (3) are proven inside the v4 spend circuit; plain spends publish a zero swap tail and a swap-locked note is unspendable as a plain note. The public instance vector grows from 15 to 21 slots (flag, swap_idx, H, s0, s1, spent_swap_entry) — normative text now lives in spec Section 12.

WG-26 wire (opacus-wallet). TX_VERSION_V5 = the complete v4 layout plus a mandatory 130-byte tail (flag u8, swap_idx u8, H 32B, s0 32B, s1 32B, entry 32B) with strict per-mode canonical rules; sighash_v5 covers every tail field; v4 parsers reject v5 bytes (no trailing-byte ambiguity). Wallet surface: SwapIntent (Lock / Claim / Refund), build_zk_spend_v5, confirm_zk_tx_v5.

WG-27 — chain-level swap enforcement (opacus-consensus). CLAIM/REFUND validity is now a deterministic function of chain state and height, checked in confirm_v5_consensus: CLAIM only while h < T with T = H_lock + W_claim (testnet default 200), REFUND only while h >= T with no preimage, exactly-once terminalization via the open-swap registry keyed by H, unknown / duplicate LOCK rejected; consensus is the single source of truth (node/bridge admission may only be stricter). The WG-18 sweep mirrors the verdicts claim-strict / refund-inclusive. Test matrix N1–N8 / P1–P2 pins every boundary. No wire changes.

WG-29 — in-transaction note encryption. The v5 builder seals every output note to the recipient's note key (ristretto ECIES extracted to opacus-crypto/src/ecies.rs): a fixed 137-byte plaintext, a 217-byte wire blob (epk + nonce + ct + mac), MAC verified before any decryption. The v5 sighash extends over the sealed enotes — this closes the documented WG-26 R3 gap. After full confirmation the wallet recovers notes from raw tx bytes alone (leaf-match enforced), and consensus rejects any enc_note tamper or cross-output substitution via the covered sighash.

WG-CLSAG — monerod-facing CLSAG verification (opacus-bridge). A byte-compatible re-implementation of monerod's verRctCLSAGSimple + get_pre_mlsag_hash on the bridge's own fe25519 layer, so the OPACUS side cryptographically confirms the Monero legs of atomic swaps. Real mainnet fixture verifies (tx 43bd6f45..., height 3796485, ring 16, BulletproofPlus); fail-closed tamper / ring-substitution / non-canonical matrix is rejected; hash-to-point is monero's elligator map (known-answer tested). New xmr_rpc endpoints: get_transactions, get_outs. Fail-closed benchmark smoke: cargo bench -p opacus-bridge --bench clsag_bench.

Breaking

  • Testnet proofs: the 21-slot instance layout invalidates existing halo2 proofs on testnet (the instance column length is bound by the protocol). Pre-mainnet only; no migration path.

Numbers

  • Rows: 1551 -> 1605 at the full MAX topology (the WG-26 tail adds +54), required_k() stays 11
  • Proof bytes unchanged (22400) after WG-29 enotes
  • opacus-bridge: 67 -> 92 tests; consensus 26/26 (incl. the WG-27 matrix)
  • CLSAG bench: full verify_tx ~7.3 ms per 2-input mainnet tx (~137 tx/s, bench host)

Compatibility

  • WG-27 adds no wire changes: TX_VERSION_V5, the 130-byte swap tail, the 21-slot layout and sighash coverage stay frozen (WG-26 design v1)
  • Workspace, opacus-dex and opacus-zk versions bumped to 0.9.0

See CHANGELOG.md for the full [0.9.0] section.