Skip to content

Wire zcash_voting + tree crates for crates.io publish#19

Merged
czarcas7ic merged 3 commits into
mainfrom
adam/crates-io-hygiene
Apr 19, 2026
Merged

Wire zcash_voting + tree crates for crates.io publish#19
czarcas7ic merged 3 commits into
mainfrom
adam/crates-io-hygiene

Conversation

@czarcas7ic
Copy link
Copy Markdown
Contributor

Summary

Phase 4 prep: make vote-commitment-tree, vote-commitment-tree-client, and zcash_voting publishable on crates.io now that all upstream dependencies (pir-client, voting-circuits, valar-orchard, valar-pczt) have been published.

What changed

Dep rewiring (the headline — required for publish):

  • All git-deps swapped for crates.io releases:
    • pir-client 0.1.0 (was git rev)
    • voting-circuits 0.1.0 (was git HEAD)
    • pcztvalar-pczt 0.5.1 (package rename; was git rev pinned to librustzcash fork)
    • Sibling tree crates: path + version pairs so crates.io resolves the version while dev builds stay local.
  • Deleted the workspace [patch.crates-io] block — the pinned librustzcash rev + voting-circuits git ref are superseded by the published valar-* forks, and crates.io doesn't let published crates carry a patch table anyway.

Metadata for publish:

  • description / license (MIT OR Apache-2.0) / repository / readme keys added to all three crates' Cargo.toml.
  • LICENSE-MIT + LICENSE-APACHE at repo root.
  • Per-crate README.md describing purpose + usage snippet.

Dual orchard in zcash_voting — the subtle bit:

zcash_voting sits at a dep-graph boundary where it consumes upstream orchard types (from zcash_keys, valar-pczt internals, zcash_primitives) and produces valar-orchard types (consumed by voting-circuits, which needs the governance-visibility methods we added). Cargo distinguishes these two crates by package name, so a single use orchard::… line can't satisfy both callsites.

Attempted but ruled out:

  • [patch.crates-io] orchard = { git=…, package = "valar-orchard" } — would need a second patch for valar-orchard too, which cargo rejects as "two patches resolve to the same result".
  • Forcing everything to valar-orchard — UnifiedSpendingKey::orchard() returns upstream SpendingKey; we can't make zcash_keys return valar types without cascade-forking zcash_keys, zcash_primitives, etc.
  • Forcing everything to upstream orchard — voting-circuits's public API uses valar-orchard types that require pub(crate) → pub visibility changes not present upstream.

Implementation:

  • Two Cargo.toml deps with the package = rename trick:
    • orchardvalar-orchard 0.11.0 (for voting-circuits callsites)
    • orchard_upstream → upstream orchard 0.11.0 (for zcash_keys / zcash_primitives / PcztParts)
  • New zcash_voting/src/orchard_compat.rs with two byte-round-trip helpers (fvk_upstream_to_valar, sk_upstream_to_valar). Safe because valar-orchard is a pure superset of upstream with identical wire formats — the helpers go to_bytes()from_bytes().
  • Conversions happen only at the zcash_keys boundary: zkp1.rs::reconstruct_note + zkp2.rs::derive_spending_key.
  • action.rs uses orchard_upstream throughout because it builds a bundle that plugs into PcztParts.orchard (upstream-typed). Uses only standard orchard APIs, no governance-visibility methods needed.

Exit plan: when the valar-orchard visibility changes land in zcash/orchard upstream, drop orchard_upstream + orchard_compat.rs, point orchard at upstream directly. Clean exit.

Test plan

  • cargo check --workspace --all-targets clean (no warnings)
  • cargo test --workspace --lib — 84/84 pass (long-running Halo2 proof test test_real_delegation_proof skipped per normal)
  • Dry-run publish each crate locally (user will run cargo publish --dry-run -p vote-commitment-tree then -p vote-commitment-tree-client then -p zcash_voting)

Prep work so vote-commitment-tree, vote-commitment-tree-client, and
zcash_voting can all be published to crates.io. Key changes:

- Rewire every git-dep to its published crates.io equivalent:
  pir-client 0.1.0, voting-circuits 0.1.0, valar-pczt 0.5.1 (package
  rename of pczt), and the two sibling tree crates via path + version.
- Delete the workspace [patch.crates-io] block — the pinned librustzcash
  rev and voting-circuits git ref are superseded by the published
  valar-* forks. crates.io forbids patch-on-publish anyway.
- Add required publish metadata (description / license / repository /
  readme) and LICENSE-{MIT,APACHE} at repo root. README per crate.

Dual orchard in zcash_voting
----------------------------
zcash_voting sits at a dep-graph boundary: voting-circuits's public API
takes valar-orchard types (governance-visibility methods), while
zcash_keys, valar-pczt internals, and zcash_primitives all expose
upstream orchard types. Cargo sees them as two distinct crates by
package name, so a single `use orchard::…` can't satisfy both callsites.

Fix: declare both as separate Cargo.toml entries —
  orchard          = valar-orchard 0.11.0 (package rename)
  orchard_upstream = orchard 0.11.0       (package rename)
— and add zcash_voting/src/orchard_compat.rs with byte-round-trip
helpers (fvk/sk). Safe because valar-orchard is a pure superset of
upstream orchard with identical wire formats. Conversions happen only
at the zcash_keys boundary (zkp1 reconstruct_note, zkp2
derive_spending_key). action.rs uses orchard_upstream throughout since
it builds a bundle for PcztParts which is upstream-typed.

Drop orchard_upstream + orchard_compat.rs when the valar
governance-visibility changes land in zcash/orchard upstream.

Verified: cargo check --workspace --all-targets clean; 84/84 lib tests
pass.
@czarcas7ic czarcas7ic merged commit f532ded into main Apr 19, 2026
2 checks passed
p0mvn added a commit that referenced this pull request Apr 25, 2026
…voting-circuits PR #20

Companion to the previous "Migrate to orchard 0.13 + librustzcash zcash/main"
commit (which only flipped the Cargo.toml [patch.crates-io] entries).
This commit catches the lockfile and the surrounding documentation up
to where the orchard / voting-circuits stack actually lives now.

* Cargo.lock — regenerated against the git URL pins so a fresh
  `cargo build` reproduces the exact dep graph that the migration was
  tested against:
    orchard          7fa213ae   valargroup/orchard         valar/0.13-spend-auth-g
                                = orchard 0.13.0
                                + cherry-picks of zcash/orchard #489
                                  (SpendAuthG fixed-base multiplication)
                                + zcash/orchard #495
                                  (NoteValue::ZERO public associated constant)
                                (tracked by valargroup/orchard PR #19)
    voting-circuits  ec6d3adb   valargroup/voting-circuits valar/orchard-0.13
                                (= valargroup/voting-circuits PR #20 head)
    pczt / zcash_address / zcash_encoding / zcash_keys
    / zcash_primitives / zcash_protocol / zcash_transparent
                     976efa76ca zcash/librustzcash         main (commit-pinned)

* Cargo.toml + zcash_voting/Cargo.toml — comments now mention both
  zcash/orchard #489 and #495, tracked by valargroup/orchard PR #19,
  instead of just #489. No semantic change.

* zcash_voting/README.md — drop the "depends on valar-orchard +
  valar-pczt" wording (those forks are retired), replace with the
  current pin: orchard 0.13 + valargroup/orchard PR #19 (carrying
  zcash/orchard #489 + #495), plus a librustzcash commit-pin pointing
  at zcash/main now that PRs #2281 / #2283 / #2284 are merged
  upstream. Notes that the pin collapses back to the published
  `orchard 0.14` crate + a librustzcash release once both upstream
  PRs land.

Verification:
* `cargo check --tests --workspace --all-features` clean.
* No drift between Cargo.toml [patch.crates-io] entries and the
  resolved [[package]] sources in Cargo.lock.

Made-with: Cursor
greg0x added a commit that referenced this pull request Apr 25, 2026
Now that valargroup/orchard PR #19 and valargroup/voting-circuits PR #20
are merged, repoint both from migration branches to the respective merge
commits on main:
  - orchard          → c26a6ec6 (PR #19 merge)
  - voting-circuits  → 66777e27 (PR #20 merge)

Retires the valar/0.13-spend-auth-g and valar/orchard-0.13 branch refs as
manifest dependencies in favor of deterministic rev pins.
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.

1 participant