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):

  • orchard 0.11 → 0.14, sapling-crypto 0.5 → 0.7
  • pulls halo2_gadgets 0.5.0 and zcash_primitives 0.28.0 (patched circuit)
  • added the zip32 crate (AccountId / TryFromIntError were relocated out of zcash_primitives by the crate split)
  • enabled the orchard feature on zcash_client_backend to fix feature unification

NU6.2 awareness

  • added NU6_2 to the BranchId enum (keys.rs + From → ZcashBranchId::Nu6_2) and interface.udl; regenerated the Go binding constant (BranchIdNu62 = 9)
  • added the nu6_2 activation height to the Regtest LocalNetwork (height 5)

Crate-split (zcash_primitives 0.28) API migration

  • consensus / memo modules moved to zcash_protocol
  • orchard add_orchard_output value argument is now Zatoshis (ZERO)
  • transparent SignableInput::from_parts now takes the bundle and returns Result; TransparentBuilder::add_input → add_p2pkh_input
  • fixed a tx test 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/zebra 4.3.1 → 5.0.0 and added "NU6.2" = 5 to the regtest activation heights so zebra and mayanode agree

Verification

  • cargo check passes for default, uniffi (prod), uniffi shielded (sim) and e2e feature sets
  • cargo test → 15 / 15 pass

Remaining before merge

  • 🔴 Rebuild the prebuilt static libraries in CI/Linux: cd chain/zec && ./build.sh prod && ./build.sh sim (or make static-lib). ci/Dockerfile.regtest and ci/Dockerfile.simtest statically link lib/libzec.a / lib/sim/libzec.a; their .source-hash is 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 fixtures test/fixtures/zcash/decrypt_orchard.json and decrypt_sapling.json via make test-go against 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 to librustzcash main and 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)

Merge request reports

Loading
Loading