orchard 0.13: stack upstream zcash/orchard#489 + #495#19
Merged
Conversation
Adds `OrchardBaseFieldBases` and `OrchardShortScalarBases` enums in `orchard::constants::fixed_bases`, both including a `SpendAuthG` variant alongside the existing `NullifierK` / `ValueCommitV`, and both marked `#[non_exhaustive]` to allow future base additions without a semver break. Precomputed Z/U tables for the short-scalar variant are generated via `find_zs_and_us` and exercised by a shared MockProver harness for both base-field and short-scalar routes. `OrchardFixedBases` is reshaped to a Full/Base/Short dispatch. The reshape is behavior-preserving (pinned VK unchanged) and `From<NullifierK>` / `From<ValueCommitV>` keep routing to the correct variant. The outer enum is not `#[non_exhaustive]` because its three variants correspond to halo2's `FixedScalarKind` partition. These items are reachable externally only under the `unstable-voting-circuits` feature.
Introduces a public `const NoteValue` zero value in `orchard::value`, replacing the crate-private `NoteValue::zero()` associated function. All internal call sites in the builder, bundle testing helpers, and note dummy construction are rewired to use the new constant. The new constant is usable in `const` contexts and gives downstream consumers a direct name for the zero value without going through `NoteValue::from_raw(0)`. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Sean Bowe <ewillbefull@gmail.com>
Review on the note-value PR asked for an associated constant on the public type (consistent with patterns like pallas::Base::ZERO) rather than a module-level name, while keeping a single const zero usable in const contexts. Made-with: Cursor
This was referenced Apr 25, 2026
greg0x
approved these changes
Apr 25, 2026
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacks two open upstream PRs against
zcash/orchard:mainfor thevoting-circuits/ vote-sdk migration POC to orchard 0.13. Opened againstvalargroup/orchard:main(kept in sync withzcash/main) so the entire workspace can pin a single git rev while we wait for the upstream PRs to land.Upstream PRs stacked
27d719a,0cbaa0d)NoteValue::zero()withNoteValue::ZEROconst (commits3b21ae3,b20e941,7fa213a)Why
Both pieces are required together for the integration branch:
OrchardBaseFieldBases::SpendAuthGBaseandOrchardShortScalarBases::SpendAuthGShortunderunstable-voting-circuits. Without this, the delegation circuit must fall back to variable-base multiplication, which is significantly more expensive in constraint rows.NoteValue::zero()withNOTE_VALUE_ZEROconst zcash/orchard#495 (NoteValue::ZERO): replaces the crate-privatepub(crate) fn NoteValue::zero()with apub const ZERO: Self = NoteValue(0)associated constant. Gives the voting circuits a stable, public,const-context-friendly zero value and removes our priorvisibility::make(pub)workaround.Combining them in one fork branch lets us pin downstream
[patch.crates-io]consumers (voting-circuits,zcash_voting,vote-sdk,zcash-swift-wallet-sdk) to a single git rev.Contents (5 commits on top of
zcash/main@d05a1f6)From #489:
27d719afeat: add SpendAuthG fixed-base multiplication support0cbaa0dFix inlining ValueCommitVFrom #495:
3.
3b21ae3value: ReplaceNoteValue::zero()withNOTE_VALUE_ZEROconst (cherry-pick ofa331094)4.
b20e941Update CHANGELOG.md (review wording: droppubqualifier in changelog) (cherry-pick of98b21de)5.
7fa213aUse NoteValue::ZERO instead of NOTE_VALUE_ZERO (use associated constant per maintainer review) (cherry-pick of0062868)CHANGELOG.md### Addedcarries both new entries (SpendAuthG enums +NoteValue::ZERO).Verification
cargo build --no-default-features --features circuit,unstable-voting-circuits— cleancargo test --no-default-features --features circuit,unstable-voting-circuits --lib— 71 passed, 0 failedNoteValue::zero()call sites insrc/builder.rs,src/bundle.rs,src/note.rsmigrated toNoteValue::ZERO; no stale references remain.mainsynced withzcash/main(d05a1f6, post feat: add unstable-voting-circuits feature to widen internals zcash/orchard#488 merge) before opening this PR.Notes
[patch.crates-io]pins.zcash/main.