Skip to content

pczt: Preserve absent shielded anchors across roles#2546

Merged
nullcopy merged 3 commits into
zcash:mainfrom
gustavovalverde:zally/pczt-optional-anchors
Jul 12, 2026
Merged

pczt: Preserve absent shielded anchors across roles#2546
nullcopy merged 3 commits into
zcash:mainfrom
gustavovalverde:zally/pczt-optional-anchors

Conversation

@gustavovalverde

@gustavovalverde gustavovalverde commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

V6 PCZTs can omit shielded anchors during pre-authorization; Sapling bundles without spends do not consume an anchor at any stage.

This keeps placeholder anchors internal to roles that do not read the anchor. IO finalization, signing, updating, and verification can parse such PCZTs without serializing a placeholder back out. V5 signing paths and operations that consume anchors still require them for Sapling spends and Orchard-protocol actions.

Proving now rejects non-zero-valued spends whose witnesses do not root to the bundle anchor before creating Sapling, Orchard, or Ironwood proofs. The changelog records the role behavior and public parse/consistency error names.

@gustavovalverde gustavovalverde force-pushed the zally/pczt-optional-anchors branch 3 times, most recently from ce055d8 to a83c8c2 Compare July 7, 2026 21:02
@czarcas7ic

Copy link
Copy Markdown
Collaborator

Hey @gustavovalverde, just flagging that we are also working on some form of anchor optionality here:

#2548
#2552

@dannywillems dannywillems self-requested a review July 8, 2026 09:55

@dannywillems dannywillems left a comment

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.

Blocking until #2539 is merged

@gustavovalverde gustavovalverde force-pushed the zally/pczt-optional-anchors branch from a83c8c2 to 86f7f11 Compare July 8, 2026 16:11
@gustavovalverde

Copy link
Copy Markdown
Contributor Author

@dannywillems this is now rebased and conflicts fixed

@gustavovalverde gustavovalverde changed the title pczt: Make shielded bundle anchors optional per ZIP 374 v2 pczt: Model shielded bundle anchors as optional Jul 8, 2026
@dannywillems dannywillems self-requested a review July 8, 2026 16:19
@ValarDragon

Copy link
Copy Markdown
Collaborator

We should have relevant changes all merged in, going to ask AI to replicate these tests

@gustavovalverde

Copy link
Copy Markdown
Contributor Author

@ValarDragon if you're able, you can intervene the PR

@gustavovalverde gustavovalverde force-pushed the zally/pczt-optional-anchors branch from 86f7f11 to 305b3aa Compare July 9, 2026 16:50
@gustavovalverde gustavovalverde changed the title pczt: Model shielded bundle anchors as optional pczt: Preserve absent shielded anchors across roles Jul 9, 2026
@gustavovalverde

Copy link
Copy Markdown
Contributor Author

This has been updated (with a reduced scope, as other changes already landed on main)

@gustavovalverde gustavovalverde force-pushed the zally/pczt-optional-anchors branch 2 times, most recently from 84bb9f2 to 121d4d4 Compare July 10, 2026 07:04
@gustavovalverde

gustavovalverde commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@czarcas7ic can you have a look at the changes here, considering one of your PRs already got merged and I updated the code, title and PR body here to reflect the additive changes?

Comment thread pczt/src/common.rs Outdated
Comment thread pczt/src/sapling.rs
gustavovalverde and others added 3 commits July 10, 2026 17:16
Keep placeholder anchors internal to role parsing so v6 PCZTs whose Sapling, Orchard, or Ironwood anchors are absent can still be IO-finalized, signed, updated, and verified without writing that placeholder back out.

Derive the parse requirement from the transaction version so v5 pre-authorization paths still require anchors for Sapling spends and Orchard-protocol actions. Proving and transaction extraction require real anchors only when bundle items consume them, and proving now rejects non-zero-valued spends whose witnesses do not root to the selected anchor.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Co-Authored-By: OpenAI Codex <noreply@openai.com>
Treat output-only Sapling bundles as non-empty when a role requires a concrete anchor, while preserving absent anchors for empty and pre-authorization paths.

Mark the new parse and anchor-consistency error enums non-exhaustive so the public API can add variants compatibly.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@gustavovalverde gustavovalverde force-pushed the zally/pczt-optional-anchors branch from 6c63f0c to 5e90820 Compare July 10, 2026 15:20

@nuttycom nuttycom 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.

utACK 5e90820

@nullcopy nullcopy merged commit 0d4e3df into zcash:main Jul 12, 2026
45 checks passed
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.

6 participants