Skip to content

Resolve orchard via valar-orchard on crates.io#39

Closed
p0mvn wants to merge 3 commits into
shielded-vote-for-zodl-3.4.0from
roman/orchard-use-valar-orchard
Closed

Resolve orchard via valar-orchard on crates.io#39
p0mvn wants to merge 3 commits into
shielded-vote-for-zodl-3.4.0from
roman/orchard-use-valar-orchard

Conversation

@p0mvn
Copy link
Copy Markdown

@p0mvn p0mvn commented Apr 24, 2026

Summary

Change the workspace-level orchard dep from crates.io orchard (patched to zcash/orchard git rev 6b12c77) to the valar-orchard package on crates.io, aliased locally to orchard via cargo's package = rename trick. Every member keeps orchard.workspace = true and every .rs file keeps use orchard::… — no source changes.

Why

valar-orchard 0.12.0 is upstream 0.12.0 + the same post-release fixes (up to zcash/orchard 6b12c77) that the existing [patch.crates-io] orchard entry points at, plus the pub visibility additions that valargroup/voting-circuits needs for its shielded-voting Halo 2 circuits (constants, spec, shared_primitives gadget).

Before this PR, any workspace that depends on both this fork and voting-circuits 0.2.0 (most importantly valargroup/zcash_voting) ends up with two Orchard crates in the dep-graph:

  • orchard (this fork, via [patch.crates-io] orchard)
  • valar-orchard (pulled by voting-circuits from crates.io)

Cargo treats them as different crates regardless of byte-equivalence, so consumer workspaces need a byte-round-trip orchard_compat bridge at the zcash_keys / pczt boundary. Routing this fork through valar-orchard too collapses the graph to a single node and lets the consumer delete the bridge.

Changes

# Cargo.toml (workspace root)
[workspace.dependencies]
-orchard = { version = "0.12", default-features = false }
+orchard = { version = "0.12.0", package = "valar-orchard", default-features = false }

 [patch.crates-io]
 sapling = { package = "sapling-crypto", git = "https://github.com/zcash/sapling-crypto.git", rev = "4f95c2286dbe90f05e6f44d634bc2924b992fab4" }
-orchard = { package = "orchard", git = "https://github.com/zcash/orchard.git", rev = "6b12c77260aa7fac0d804983fc31b71b584d48e0" }
+# No orchard patch: the workspace resolves `orchard` via its `package = "valar-orchard"` alias on crates.io, ...

No changes to any member's Cargo.tomlorchard.workspace = true already does the right thing.
No changes to any .rs file — use orchard::… still compiles thanks to the package = alias.

Reverting later

Once the governance-visibility changes land in upstream zcash/orchard, flip the workspace dep back to orchard = { version = "0.12", default-features = false } (or the new semver) and this fork no longer needs valar-orchard at all.

Test plan

  • cargo check --workspace — clean. Build log shows Checking valar-orchard v0.12.0; no orchard v0.12.x nor any zcash/orchard.git entry.
  • Consumer side (zcash_voting) update that drops [patch.crates-io] orchard and the orchard_upstream + orchard_compat plumbing — follow-up PR once this merges.
  • Validate cargo test --workspace on this fork (CI).

Related

Made with Cursor

greg0x and others added 3 commits April 16, 2026 21:08
Co-Authored-By: roman <roman@osmosis.team>
Co-Authored-By: Claude Code <noreply@anthropic.com>

Remove duplicate shielded_sighash getter in pczt signer

Bad merge left two identical methods. Keep the one with the fuller
doc comment, fix stray braces in doc comments on nearby methods.
… generation

WalletDb gains two new methods (not on traits — governance-specific):

- get_unspent_orchard_notes_at_historical_height(account, height): returns
  all Orchard notes received at or before the given height and unspent as of
  that height. Backward-looking query for voting snapshots, unlike
  select_unspent_notes which is forward-looking.

- generate_orchard_witnesses_at_historical_height(positions, frontier, height):
  copies wallet shard data to ephemeral in-memory DB, inserts the frontier as
  a checkpoint, and generates Merkle witnesses. Wallet DB is strictly read-only.

Co-Authored-By: roman <roman@osmosis.team>
Co-Authored-By: Claude Code <noreply@anthropic.com>
Changes the workspace-level `orchard` dep from the crates.io `orchard`
package (patched to zcash/orchard git rev 6b12c77) to the
`valar-orchard` package on crates.io, aliased locally to `orchard` via
cargo's `package =` rename trick. Every member keeps its existing
`orchard.workspace = true` line and its source-level `use orchard::…`
imports — no other changes needed.

Why
---
`valar-orchard` is upstream 0.12.0 + the same post-release fixes up to
zcash/orchard 6b12c77 that the previous `[patch.crates-io] orchard`
entry pointed at, plus the `pub` visibility additions that
valargroup/voting-circuits needs for the shielded-voting Halo 2
circuits (constants, spec, shared_primitives gadget).

Before this change, consumers that also depend on `voting-circuits`
(e.g. `zcash_voting`) ended up with two distinct Orchard crates in
their dep-graph: `orchard` (from this fork, via our patch) and
`valar-orchard` (pulled by `voting-circuits` from crates.io). Cargo
treats them as different crates regardless of content, which forced a
byte-round-trip `orchard_compat` bridge at the zcash_keys / pczt
boundary. Routing our fork through `valar-orchard` too collapses that
back to a single node and deletes the bridge.

The `[patch.crates-io] orchard = { git = "zcash/orchard", rev = "6b12c77…" }`
entry is obsolete after this change (no dep resolves crates.io
`orchard` anymore) and is removed.

Verified: `cargo check --workspace` clean. `valar-orchard v0.12.0`
appears in the build graph; no `orchard v0.12.x` or git `orchard`
entry.

Made-with: Cursor
@p0mvn p0mvn changed the base branch from shielded-vote-main to shielded-vote-for-zodl-3.4.0 April 24, 2026 16:45
@p0mvn p0mvn force-pushed the shielded-vote-for-zodl-3.4.0 branch from 1bc3a27 to 6534482 Compare April 24, 2026 20:18
@p0mvn p0mvn closed this Apr 24, 2026
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.

2 participants