Skip to content

Opacus v0.8.0 - wallet keys, prover & audit hardening

Latest

Choose a tag to compare

@opacusio opacusio released this 03 Nov 13:26
· 48 commits to main since this release

[0.8.0] - 2026-10-28

Added

  • bip39 3.0 dependency (rust-bitcoin org, zeroize feature) via
    [workspace.dependencies].
  • Official BIP-39 English test vectors in opacus-crypto: seed round-trips,
    12/15/18/24-word acceptance, checksum/wordlist rejection, passphrase
    separation, v1 rejection, deterministic-RNG generate test.

Changed

  • BREAKING (wallet keys): SpendingKey now uses standard BIP-39 English
    mnemonics (ADR r5-bip39-mnemonics, WG-25). generate() draws 256-bit entropy
    from the injected CSPRNG and yields a 24-word phrase; the restore path
    (from_mnemonic) enforces wordlist membership AND checksum, deriving the seed
    via PBKDF2-HMAC-SHA512 (2048 iterations, 64 bytes). Spend/view derivation is
    re-tagged to opacus_spend_derive_v2 / opacus_view_derive_v2 over the BIP-39
    seed. v1 pseudo-mnemonics ("opacus ") are rejected - testnet-only
    keys, no migration path.

  • opacus-zk (WG-17): process-wide keyset cache for the v4 spend prover -
    Params keyed by k, vk/pk keyed by (DEPTH, n_in, n_out). Keygen is a
    pure function of the circuit structure (never of witness values), so
    cached keysets are bit-for-bit identical to freshly built ones. The
    first prove of a process pays the one-time keygen (~16 s cold at
    mainnet depth); every later call runs at steady-state 7.3-8.0 s prove
    and ~0.1 s verify, inside the 10 s budget [S4 8]. The bench now
    enforces the budget on the steady-state number and records the
    cold-start figure for the future EC-chain column count /
    membership-path count work. Also fixes the stale row-budget doc
    (rows_needed(32) = 5103, not 5006).

  • Docs (mainnet gate): SECURITY.md gains a "Mainnet gate (mandatory)"
    section - an independent external security audit of the current main
    MUST be completed and triaged before any mainnet use; testnet burner
    keys are strictly one-time, never reused across rounds and never
    promoted to a network carrying real value. README roadmap marks the
    WG-17 prover budget as delivered.

  • Contracts (WG-16 stage 1): the wrapped native token is rebranded to
    wOPACUS ("Wrapped Opacus", contracts/wOPACUS.sol). Redeploy hardening
    (audit WG-16): quorum fixed N-of-M at deployment (constructor range
    checks, QuorumConfigured event, no updateQuorum), the mint digest
    binds block.chainid under the "opacus-lock-v1" domain, the EIP-2
    low-s range is enforced, and the forge suite grew to 10 tests. The
    legacy wOPACUS Sepolia deployment cannot be renamed in place (the name
    compiles into the deployed bytecode); its address record stays in
    contracts/wopacus.address until the redeploy round.

  • opacus-dex: wopacus module renamed to wopacus (WOPACUS_ADDRESS env,
    legacy WOPACUS_ADDRESS fallback); ABI encoder gained dynamic string
    support (two-pass head/tail); burn() and topics match the contract.

Fixed

  • Security (C-01): the Schnorr nonce of the cross-group DLEq proof
    (opacus-bridge::xmr_dleq) was derived from blake3(nano-time + pid),
    making it predictable. A predictable nonce lets an observer recover
    the node secret scalar from the public handshake Auth proof via
    s = r + c*x. The nonce source now draws 32 bytes from the OS CSPRNG
    (rand::rngs::OsRng, already a workspace dependency) and a regression
    test pins nonce non-determinism.
  • Security (H-01): the per-node replay cache was locked for the whole
    handshake phase, so one stalled inbound connection could freeze every
    handshake on the node for the socket timeout (a rolling pool of
    stalled dials meant a permanent handshake blackout). The replay-cache
    critical section is now narrowed to the check-and-insert only, the
    handshake phase runs under a dedicated 10 s read budget, and inbound
    handshakes are bounded by a half-open cap (MAX_HALF_OPEN = 64), with
    a regression test per fix.
  • Chore (M-09): a merged .gitignore line (".log.bak-tx") left neither
    pattern effective, so debug.log (and any other .log build artifact)
    was not ignored. The line is split into "
    .log" and "*.bak-tx"; both
    rules now work as intended.
  • Chore (M-04, M-05, CI): the contracts job no longer swallows failures
    (continue-on-error removed). Foundry is installed from the pinned
    v1.8.5 release and verified against its published SHA-256 before
    unpacking (previously foundry-toolchain@v1 fetched mutable builds
    unchecked). The Rust job gained a cargo fmt --check gate, and a new
    audit job runs cargo audit (RustSec) against Cargo.lock.
  • Audit (L-12): tokio bumped 1.54.0 -> 1.54.1 in Cargo.lock (RUSTSEC-2026-0384) and
    a documented audit ignore for RUSTSEC-2026-0387 (crypto-bigint) was added in
    .cargo/audit.toml (transitive dependency, re-evaluate before the next
    release). cargo audit now exits clean.
  • Docs (Infra-1): SECURITY.md added - private vulnerability reporting
    procedure (GitHub private advisory channel, supported versions,
    response targets, scope, safe harbor); deny.toml added - cargo-deny
    supply-chain policy (advisories mirror the RUSTSEC-2026-0387
    documented exception, licenses allowlist derived from the locked
    dependency tree, bans/sources at warn). Wiring cargo-deny into CI is
    a tracked follow-up.
  • Chore (Infra-2, CI): all workflow actions pinned to full commit SHAs
    (actions/checkout v4.4.0, dtolnay/rust-toolchain stable,
    Swatinem/rust-cache v2.9.3) - mutable tag/branch refs eliminated.
  • Chore (Infra-3, CI): cargo-deny wired as a dedicated job (advisories /
    licenses / bans) reading the repository deny.toml policy;
    EmbarkStudios/cargo-deny-action pinned to a full commit SHA (v2.1.1) -
    supply-chain policy now enforced on every push and PR.
  • Security (Net-3): the authenticated-connection pool is bounded -
    NetNodeConfig.max_conns (default 128) caps ESTABLISHED connections
    (the H-01 half-open cap bounded only the handshake phase), and a
    duplicate connection from an already-connected peer is rejected
    instead of replacing the live entry (two handler threads for one
    node_id would race the idle-timeout cleanup against the fresh
    entry). The admission decision (try_clone + check-and-insert) runs
    under a single lock acquisition; regression tests cover both guards.
  • Chore (Infra-4): the cargo-deny CI job failed on its first run - the
    licenses check reported every workspace member crate as "unlicensed".
    deny.toml assumed the members inherit Apache-2.0 from
    [workspace.package], but no member manifest actually declared
    license.workspace = true (opacus-dex and opacus-zk pin their fields
    directly). All eleven member manifests now declare the license
    (workspace inheritance or an explicit Apache-2.0 field); cargo-deny
    0.20.2 (the exact CI version) verifies clean locally: advisories ok,
    bans ok, licenses ok, sources ok.
  • Security (Net-2): the swap plane's session registry grew without
    bound - every inbound Offer (including one arriving through the
    authenticated Upgrade plane) inserted a new tracked session, so a
    single flooding peer could balloon node memory without limit.
    SwapNodeConfig.max_sessions (default 64) now caps the registry: a
    NEW offer arriving at cap is dropped before the state machine (no
    reply, connection kept open, Rejected event), already-tracked offers
    keep their exact DuplicateOffer semantics, and non-Offer frames keep
    flowing on the same connection. v0.1 never evicts sessions, so the
    cap also bounds the registry's lifetime; restart or raise the cap to
    admit new offers again. Regression tests cover the flood drop and
    the preserved duplicate semantics.
  • Security (Node-1): the daemon silently ignored DaemonConfig.network -
    whatever the operator configured (or typo'd), the node always ran the
    same hardcoded mix of a mainnet-shaped state over testnet parameters.
    The configured network is now validated strictly ("mainnet" |
    "testnet", case/whitespace normalized) BEFORE any side effect - an
    unknown value refuses startup (InitFailed) and leaves no data dir
    behind - and the consensus bundle flows through one documented
    selection point (pre-mainnet there is exactly one defined parameter
    set - the testnet set, v4 active from genesis - and one normative
    sparse accumulator shape, so both networks resolve to the same
    construction today; that match is the single place to extend when
    mainnet parameters land). The effective consensus parameters are
    logged at startup and opacusd gained a --network flag wired into
    DaemonConfig. Regression tests cover the strict validation, the
    normalization and the testnet selection.
  • Security (Net-1): post-auth control-plane frames (Disco, Notes,
    Upgrade) crossed the wire as cleartext JSON - a passive observer saw
    the full peer graph and note metadata, and any in-path attacker could
    read or tamper with every frame after the (authenticated) handshake.
    The handshake now derives transport keys from a static-static ECDH
    over the DLEq-bound identity keys (sk_local * pr_peer - a shared
    secret only the two proven key holders can compute), bound to the
    verified transcript, with separate initiator->responder and
    responder->initiator directions. Every post-auth frame is sealed as
    mac(32) || ciphertext under the per-direction keys (keyed blake3 MAC
    verified BEFORE any decryption, blake3-keystream encryption - the
    same construction family as the note ECIES, no new dependencies),
    and the per-direction frame counters are strictly sequential, so
    replay, reordering and drops all close the connection. The Upgrade
    handover stays the boundary: the net plane's last frame (Upgrade) is
    sealed, the adopted raw socket then speaks the swap protocol as
    before (swap-plane transport is a separate tracked item). The
    handshake version bumps to 2, so a v1 peer is rejected at Hello with
    a clean BadVersion instead of failing on the first post-auth frame.
    Regression tests cover the cross-side key agreement, the
    seq/content binding of the seal/open construction and the cleartext
    rejection at the node level; the existing node-to-node tests now run
    entirely over the encrypted path.
    new vk (v0.8).
    change; proofs/keysets from earlier builds do not verify against the
    now enforced, not just honestly assigned. BREAKING: circuit layout
    spend-poseidon-init gate: the zero start of every spend-hash chain is
    cold and the steady-state numbers. Also enables the previously-dead
    inside the 10 s budget [S4 8] end to end. The bench now gates BOTH the
    in 4,81 s with steady-state prove at 2,26 s and verify 0,03 s -
    circuit layout changed. The whole cold pipeline (keygen included) runs
    ROUNDS, MDS, round constants, domain tags) are unchanged; only the
    5103 -> 1551 rows (k = 13 -> 11). Protocol Poseidon constants (T,
    PERM_ROWS = 17 rows instead of 65 and the mainnet MAX topology drops
    every gate row of the v4 spend circuit - one permutation costs
  • opacus-zk (PROVER-10S): PER_BLOCK = 4 Poseidon rounds are fused into

Changed