Loading
Upgrade ZEC client to the NU6.2 library stack (Orchard circuit soundness fix)
Summary
Zcash activated the emergency NU6.2 hard fork at mainnet block 3,364,600
on 2026-06-03, fixing a soundness bug in the Orchard halo2 proof circuit
(halo2_gadgets < 0.5.0) that could enable double-spending. mayanode's ZEC
client (chain/zec) carried the vulnerable circuit (orchard 0.11,
zcash_primitives 0.25) and had no knowledge of the NU6.2 consensus branch id,
so after the fork it would build transactions the network rejects and could not
follow the chain.
This change upgrades the ZEC client to the NU6.2 library stack, teaches it the
NU6.2 branch id, and migrates the source to the new librustzcash 0.28 crate
layout.
Changes
Dependency stack → NU6.2 release
Pinned to librustzcash release/nu6.2-library-stack (rev 2438cf2, PR #2402 —
not yet merged to main):
orchard0.11 → 0.14,sapling-crypto0.5 → 0.7- pulls
halo2_gadgets 0.5.0andzcash_primitives 0.28.0(patched circuit) - added the
zip32crate (AccountId/TryFromIntErrorwere relocated out ofzcash_primitivesby the crate split) - enabled the
orchardfeature onzcash_client_backendto fix feature unification
NU6.2 awareness
- added
NU6_2to theBranchIdenum (keys.rs+From→ZcashBranchId::Nu6_2) andinterface.udl; regenerated the Go binding constant (BranchIdNu62 = 9) - added the
nu6_2activation height to the RegtestLocalNetwork(height 5)
Crate-split (zcash_primitives 0.28) API migration
consensus/memomodules moved tozcash_protocol- orchard
add_orchard_outputvalue argument is nowZatoshis(ZERO) - transparent
SignableInput::from_partsnow takes the bundle and returnsResult;TransparentBuilder::add_input→add_p2pkh_input - fixed a
txtest whose mock UTXO used an invalid 21-byte-hash P2PKH script (only accepted before because the old builder did not validate input scripts); it now derives the script from the account's own transparent address
mocknet
- bumped
zfnd/zebra4.3.1 → 5.0.0 and added"NU6.2" = 5to the regtest activation heights so zebra and mayanode agree
Verification
cargo checkpasses for default,uniffi(prod),uniffi shielded(sim) ande2efeature setscargo test→ 15 / 15 pass
Remaining before merge
🔴 Rebuild the prebuilt static libraries in CI/Linux:cd chain/zec && ./build.sh prod && ./build.sh sim(ormake static-lib).ci/Dockerfile.regtestandci/Dockerfile.simteststatically linklib/libzec.a/lib/sim/libzec.a; their.source-hashis intentionally stale in this branch. The NU6.2 fix is not active in mayanode until these artifacts are regenerated and committed. No exported FFI symbols changed, so the rebuild is ABI-compatible.🟡 Verify decryption fixturestest/fixtures/zcash/decrypt_orchard.jsonanddecrypt_sapling.jsonviamake test-goagainst the rebuilt sim library. Expected to pass unchanged (NU6.2 is a proof-circuit fix and does not affect note decryption); regenerate only if they fail.🟢 Once PR #2402 merges tolibrustzcashmainand the crates are tagged on crates.io, re-pin the dependencies to the released versions/tag instead of the branch commit.
References
- Reference deployment bump (node-launcher):
zfnd/zebra→ 5.0.0 - Prior analogous change: mayanode MR !643 (merged) — Add Nu6 support (NU6 / NU6.1)