Skip to content

fix(wasm-utxo): keep v6 consensus branch id in the BITGO/ZEC/V6 namespace only - #348

Open
OttoAllmendinger wants to merge 1 commit into
masterfrom
claude/bitgowasm-pr-338-review-q9bd79
Open

fix(wasm-utxo): keep v6 consensus branch id in the BITGO/ZEC/V6 namespace only#348
OttoAllmendinger wants to merge 1 commit into
masterfrom
claude/bitgowasm-pr-338-review-q9bd79

Conversation

@OttoAllmendinger

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #342 (merged). A v6 (Ironwood) PSBT was carrying its consensus branch id twice:

  • under the namespaced BITGO/ZEC/V6 / ConsensusBranchId key written by new_v6, and
  • under the legacy BITGO / ZecConsensusBranchId key that the shared ZcashBitGoPsbt::new constructor writes for every Zcash PSBT.

The legacy copy was redundant pollution of the hard-limited single-byte BITGO subtype space — the exact thing the #342 namespacing work set out to avoid.

I originally called this "cosmetic" in the #342 re-review, then corrected that on the PR: the legacy key is actually load-bearing. The wasm consensus_branch_id() getter reads the legacy key (get_zec_consensus_branch_id matches the BITGO prefix only), and #343's TS consensusBranchId accessor depends on it for v6 PSBTs — so the write can't simply be dropped without first making the getter v6-aware.

Changes

  • new_v6 drops the legacy BITGO/ZecConsensusBranchId key after the shared new constructor writes it, so a v6 PSBT keeps its branch id under BITGO/ZEC/V6 only.
  • wasm consensus_branch_id() is now v6-aware: it reads the BITGO/ZEC/V6 key for v6 (Ironwood) PSBTs and the legacy BITGO key for v4/Sapling PSBTs. This keeps feat(wasm-utxo): expose v6 (Ironwood) PSBT flow via wasm + TS #343's consensusBranchId accessor working for v6 without the redundant legacy write.
  • remove_zec_consensus_branch_id helper added in propkv.rs; the stale "redundant but harmless" doc comment on ZecV6KeySubtype is updated to describe the new behavior.

Notes

  • The v6 code paths already read the namespaced key (to_v6_transactionget_zec_v6_consensus_branch_id); the only reader of the legacy key on a v6 PSBT was the wasm getter, now fixed. All other legacy-key readers are behind the is_ironwood_v6() guards added in feat(wasm-utxo): wire v6 (Ironwood) build/sign/combine into ZcashBitG… #342.
  • New test v6_carries_branch_id_only_under_the_v6_namespace asserts a v6 PSBT exposes its branch id only under BITGO/ZEC/V6 — both freshly built and across a v6 serialize/deserialize round-trip.
  • Full native lib suite green (527 passed), clippy clean.

Interaction with #343

#343 (still open) makes serialize/deserialize v6-aware but does not touch the consensus_branch_id() getter, so there's no functional overlap. Whichever merges second rebases cleanly.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N2VPgKxYpn6Au6YYHFBcwA


Generated by Claude Code

@OttoAllmendinger
OttoAllmendinger requested review from a team as code owners July 31, 2026 10:38
@OttoAllmendinger
OttoAllmendinger force-pushed the claude/bitgowasm-pr-338-review-q9bd79 branch from 6b80224 to eb41aff Compare July 31, 2026 12:55
…pace only

A v6 (Ironwood) PSBT previously carried its consensus branch id twice:
once under the namespaced BITGO/ZEC/V6 key written by new_v6, and once
under the legacy BITGO/ZecConsensusBranchId key that the shared
ZcashBitGoPsbt::new constructor wrote for every Zcash PSBT. The legacy
copy was redundant namespace pollution in the hard-limited single-byte
BITGO subtype space.

ZcashBitGoPsbt::new no longer takes or stamps consensus_branch_id —
callers write it into the correct proprietary namespace directly: v4/
Sapling callers use set_zec_consensus_branch_id (legacy BITGO key),
new_v6 uses set_zec_v6_consensus_branch_id (BITGO/ZEC/V6 namespace).
The branch id now lands under exactly one key on first write, so v6
never pollutes the shared single-byte BITGO subtype space.

The wasm consensus_branch_id() getter is made v6-aware: it reads the
BITGO/ZEC/V6 key for v6 (Ironwood) PSBTs and the legacy BITGO key for
v4/Sapling PSBTs. A test asserts a v6 PSBT exposes its branch id only
under BITGO/ZEC/V6, both freshly built and across a v6 serialize/
deserialize round-trip.

527 tests pass, clippy clean.
@OttoAllmendinger
OttoAllmendinger force-pushed the claude/bitgowasm-pr-338-review-q9bd79 branch from eb41aff to 1711054 Compare July 31, 2026 12:57
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