Skip to content

Add in v6 and Ironwood TX-id / Auth-ID code#510

Merged
ebfull merged 6 commits into
feat/ironwoodfrom
dev/tx-id
Jun 25, 2026
Merged

Add in v6 and Ironwood TX-id / Auth-ID code#510
ebfull merged 6 commits into
feat/ironwoodfrom
dev/tx-id

Conversation

@ValarDragon

@ValarDragon ValarDragon commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

This PR brings the v6 transaction hashing (txid / authorizing digest) code for Orchard and Ironwood bundles into the branch. It originated as the V6 tx-hashing work from #505 layered on the QR note-version PR (#509).

Rather than introducing a single combined struct, commitment computation is selected by two parameters threaded through the public commitment API:

  • BundlePoolRestrictions — the (pool, era) selector. It determines the flag-byte encoding (pre-NU6.3 rules where bit 2 is reserved, vs. NU6.3 rules where bit 2 is enableCrossAddress).
  • TxVersion (V5 / V6) — the transaction version the bundle is encoded in. It selects the commitment personalization strings and where the anchor is committed: a v5 transaction includes the anchor in the transaction-ID (effects) digest, while a v6 transaction includes it in the authorizing digest instead.

Both are now arguments to Bundle::commitment, Bundle::<Authorized, V>::authorizing_commitment, and the hash_bundle_txid_empty / hash_bundle_auth_empty helpers. This is required because the sighashing code definitively needs to know both the pool (for the flag byte) and the transaction version (for the personalizations and anchor placement) — neither alone is sufficient.

Internally, (pool_restrictions, tx_version) is resolved by BundlePoolRestrictions::commitment_format(tx_version) into a private BundleCommitmentFormat enum with three variants:

  • OrchardV5 — anchor in the txid digest; legacy personalizations.
  • OrchardV6 — anchor in the authorizing digest; reuses the v5 action-level personalizations and gains _v6 top-level bundle/auth strings.
  • IronwoodV6 — anchor in the authorizing digest; fresh _v6 personalizations throughout (Ironwood bundles exist only in v6 transactions).

Each format carries its set of BLAKE2b personalization strings. Because Bundle::commitment now depends on the pool restrictions, it returns Result<BundleCommitment, CommitmentError> and fails with CommitmentError::UnrepresentableFlags when a bundle's flags cannot be encoded under the given pool (e.g. a cross-address-restricted bundle under a pre-NU6.3 pool).

New personalization strings:

  • Orchard v6: ZTxIdOrchardH_v6, ZTxAuthOrchaH_v6
  • Ironwood v6: ZTxIdIronwd_H_v6, ZTxIdIrnActCH_v6, ZTxIdIrnActMH_v6, ZTxIdIrnActNH_v6, ZTxAuthIrnwdH_v6

All constants should match:

@ebfull ebfull left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's make this API nicer.

Comment thread src/bundle/commitments.rs Outdated
Comment thread src/bundle/commitments.rs Outdated
@ValarDragon

Copy link
Copy Markdown
Collaborator Author

Updated, agreed prior API was not good.

My recollection was some decisions were made in Orchard to not expose it to V5/V6 tx formats (which is not possible for the hashing update)

I think the new bundle pool parameters implementation is far cleaner.

Base automatically changed from dev/qr-note-version to feat/ironwood June 24, 2026 23:32
Comment thread src/bundle.rs
@ValarDragon

Copy link
Copy Markdown
Collaborator Author

Addressed all comments and combined into one commit!

Comment thread CHANGELOG.md Outdated
Comment thread tests/builder.rs Outdated
Comment thread src/bundle.rs
Comment thread src/bundle.rs
Comment thread src/bundle/commitments.rs
Comment thread src/bundle/commitments.rs Outdated
Comment thread src/bundle/commitments.rs Outdated
Comment thread src/bundle.rs Outdated
Co-Authored-By: Dev Ojha <dojha@berkeley.edu>
Comment thread src/bundle/commitments.rs Outdated
Comment thread src/bundle/commitments.rs Outdated
Replace the internal AnchorCommitment enum with two boolean predicates
(includes_anchor_in_txid_digest / includes_anchor_in_authorizing_digest)
and reword the bundle commitment documentation for clarity.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread src/bundle/commitments.rs
Comment on lines +96 to +105
fn includes_anchor_in_txid_digest(self) -> bool {
matches!(self, BundleCommitmentFormat::OrchardV5)
}

fn includes_anchor_in_authorizing_digest(self) -> bool {
matches!(
self,
BundleCommitmentFormat::OrchardV6 | BundleCommitmentFormat::IronwoodV6
)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We could just define these in terms of each other, but I'll let someone else insist on it first.

@ValarDragon

Copy link
Copy Markdown
Collaborator Author

Changes look great to me! Looks way better with tx version being explicit

Comment thread src/builder.rs

@TalDerei TalDerei left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

checked against ZIP 229 and generated some of my own local test vectors for redundancy against zcash/zcash-test-vectors#130.

Comment thread CHANGELOG.md
Comment thread src/bundle/commitments.rs Outdated
czarcas7ic added a commit to valargroup/voting-circuits that referenced this pull request Jun 25, 2026
Move the orchard pin from cab7d78 to the head of zcash/orchard#510
(dev/tx-id: the v6 / Ironwood TX-id + Auth-ID work). That branch was
rebased with public-API renames, so this is a source port, not just a
rev bump:

- Note::new reordered to (.., version, rng); swap the two args at every
  call site.
- RandomSeed::rcm -> rcm_v2 (the V2 derivation; qr_rcm -> rcm_v3).
- NoteVersion::DEFAULT removed (it was = V2); replace with V2, except
  real_proof_roundtrip's real delegated note, which must be V3
  (DELEGATION_NOTE_VERSION) — that test was latently red before this
  bump because it built a V2 note the builder rejects.

The new orchard circuit Config rotates the delegation and vote-proof
verifying keys (share-reveal unchanged); update both VK-fingerprint
tripwires accordingly. Intentional VK rotation.

Verified: cargo check --all-targets --all-features clean; 141/141 unit
tests pass; all ignored delegation proving tests pass (happy_path,
real_proof_roundtrip); all three VK fingerprint tripwires green.
@ebfull ebfull merged commit 965caac into feat/ironwood Jun 25, 2026
16 checks passed
@ebfull ebfull deleted the dev/tx-id branch June 25, 2026 23:31
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.

4 participants