Skip to content

CSHLD-1573: Build and validate Merkle witness path for Zcash Ironwood shielded notes - #374

Draft
abhi-bitgo wants to merge 1 commit into
masterfrom
CSHLD-1573-ironwood-witness-path
Draft

CSHLD-1573: Build and validate Merkle witness path for Zcash Ironwood shielded notes#374
abhi-bitgo wants to merge 1 commit into
masterfrom
CSHLD-1573-ironwood-witness-path

Conversation

@abhi-bitgo

Copy link
Copy Markdown

Summary

Adds a standalone build_ironwood_witness (Rust) and ironwoodBuildWitness (WASM) function that
validates a caller-supplied Merkle witness — cmx, position, 32 sibling hashes, and expected anchor —
against orchard's own MerklePath::root. wasm-utxo has no chain state, so the raw sibling-hash
path must always be supplied by the caller; this catches a bad path immediately rather than failing
later at the external prover. Installing the witness into a real spend is explicitly out of scope
and deferred to a follow-up ticket.

Linear: CSHLD-1573

Changes

  • New IronwoodBuildError variants: BadWitnessPath, WitnessAnchorMismatch
  • build_ironwood_witness in ironwood_build.rs, using orchard::tree::MerklePath::from_parts + .root()
  • ironwoodBuildWitness wasm-bindgen export and IronwoodWitness struct in wasm/zcash.rs
  • Unit tests covering: valid witness, anchor mismatch, corrupted auth path entry, non-canonical cmx/auth-path/anchor
  • Integration test (test/fixedScript/zcashIronwoodWitness.ts) exercising the compiled WASM export
  • pasta_curves dev-dependency, pinned to the version orchard already pulls in, used only to synthesize test fixtures

Test Plan

  • cargo test --workspace in packages/wasm-utxo
  • cargo clippy --all-targets --all-features -- -D warnings in packages/wasm-utxo
  • npm run build:wasm && npx mocha test/fixedScript/zcashIronwoodWitness.ts — confirms the new export compiles through wasm-pack and is reachable from JS

Adds a standalone `build_ironwood_witness` (Rust) and `ironwoodBuildWitness`
(WASM) that validate a caller-supplied Merkle witness — cmx, position, 32
sibling hashes, and expected anchor — against orchard's own MerklePath::root.
wasm-utxo has no chain state, so the raw path must come from the caller; this
catches a bad path immediately instead of failing later at the external
prover. Installing the witness into a real spend is deferred to a follow-up
ticket.

Ticket: CSHLD-1573
@linear-code

linear-code Bot commented Aug 31, 2026

Copy link
Copy Markdown

CSHLD-1573

@abhi-bitgo

Copy link
Copy Markdown
Author

@claude review this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant