Skip to content

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

Merged
OttoAllmendinger merged 1 commit into
masterfrom
CSHLD-1573-ironwood-witness-path
Sep 2, 2026
Merged

CSHLD-1573: Build and validate Merkle witness path for Zcash Ironwood shielded notes#374
OttoAllmendinger merged 1 commit into
masterfrom
CSHLD-1573-ironwood-witness-path

Conversation

@abhi-bitgo

Copy link
Copy Markdown
Contributor

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

@linear-code

linear-code Bot commented Aug 31, 2026

Copy link
Copy Markdown

CSHLD-1573

@abhi-bitgo

Copy link
Copy Markdown
Contributor Author

@claude review this pr

@abhi-bitgo
abhi-bitgo marked this pull request as ready for review September 2, 2026 09:35
@abhi-bitgo
abhi-bitgo requested review from a team as code owners September 2, 2026 09:35
Comment thread packages/wasm-utxo/src/wasm/zcash.rs Outdated
/// This crate has no chain state, so the raw sibling-hash path must be supplied by the caller
/// (typically BitGo's backend, querying a Zcash-aware service). The returned witness is not yet
/// installed anywhere — hook it into a spend once real-spend construction exists.
#[wasm_bindgen(js_name = ironwoodBuildWitness)]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@abhi-bitgo
abhi-bitgo force-pushed the CSHLD-1573-ironwood-witness-path branch from 6c66379 to 181bf79 Compare September 2, 2026 10:16
@OttoAllmendinger
OttoAllmendinger merged commit 921b776 into master Sep 2, 2026
13 checks passed
@OttoAllmendinger
OttoAllmendinger deleted the CSHLD-1573-ironwood-witness-path branch September 2, 2026 12:40
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.

3 participants