Skip to content

Sync FFI to valargroup/librustzcash:shielded-vote-for-zodl-3.4.0#24

Merged
p0mvn merged 1 commit into
shielded-vote-2.4.10from
roman/sync-librustzcash-fork-api
Apr 25, 2026
Merged

Sync FFI to valargroup/librustzcash:shielded-vote-for-zodl-3.4.0#24
p0mvn merged 1 commit into
shielded-vote-2.4.10from
roman/sync-librustzcash-fork-api

Conversation

@p0mvn

@p0mvn p0mvn commented Apr 25, 2026

Copy link
Copy Markdown

Summary

Adapts the SDK to compile against the valargroup/librustzcash:shielded-vote-for-zodl-3.4.0 branch we actually consume in the zashi/zodl-ios builds. Without this PR the SDK fails to build with 6 compile errors against the current librustzcash, blocking every iOS build that needs libzcashlc.framework.

What this changes

rust/src — adapt to current librustzcash API

  • get_spendable_transparent_outputs gained a 4th parameter TransparentOutputFilter → pass ::All at all 3 call sites.
  • propose_shielding gained the same parameter → pass ::All.
  • ReceiverFlags::to_address_request now returns ReceiverRequirementError instead of () → propagate via {e} so the upstream cause is preserved in the error.
  • ConfirmationsPolicy::try_from error type widened from () to a Display type → format via {e}.

Cargo.toml — coordinated repinning so the dep graph is self-consistent

  • [patch.crates-io] librustzcash entries: zcash/librustzcash@438657c52cvalargroup/librustzcash@6534482c1c (the rev where the new APIs above live).
  • sapling-crypto git pin: 4f95c228b8a81c22 (the rev required by the librustzcash fork, which transitively depends on sapling-crypto 0.6.2).
  • SDK orchard dep: "0.12"{ version = "0.12.0", package = "valar-orchard" }, and the [patch.crates-io] orchard = ... entry is dropped. The librustzcash fork already uses valar-orchard via the same package = alias and explicitly comments "No orchard patch"; mirroring that here prevents two incompatible orchard implementations from ending up in the graph.
  • sapling dep version: "0.6""0.6.2" (matches the bumped pin).
  • Added voting-circuits = "0.2.0" (transitively required by the FFI through valar-orchard).
  • zcash_voting branch: greg/orchard-0.12main (the rev that lines up with the valar-orchard 0.12.0 / librustzcash combination above).

Verification

cargo build --target aarch64-apple-ios-sim --release
   Finished `release` profile [optimized] target(s) in 2m 56s

Exit code 0. No warnings about multiple versions of orchard / sapling / zcash_* in the graph.

Notes for the reviewer

  • All 4 files are changed for a single coordinated reason: the Cargo.toml repins are not optional polish — without them the rust changes don't build because the upstream librustzcash@438657c52c doesn't have TransparentOutputFilter / ReceiverRequirementError yet.
  • This deliberately points at the valargroup/librustzcash fork rather than upstream zcash/librustzcash. Once those fork patches land in zcash/librustzcash:main and a release rev is available, this [patch.crates-io] block can be repointed back to upstream.

Test plan

  • CI builds cargo build --target aarch64-apple-ios-sim --release
  • CI builds cargo build --target aarch64-apple-ios --release
  • Downstream build of zashi-mainnet continues to succeed against the resulting libzcashlc.xcframework

Made with Cursor

Adapts the Rust FFI to the librustzcash-fork API drift that's required
to build the SDK against the wallet stack we actually consume in the
zashi/zodl-ios builds.

rust/src changes (API drift in current librustzcash):

* `get_spendable_transparent_outputs` gained a 4th parameter
  `TransparentOutputFilter`; pass `::All` at all 3 call sites
  (`zcashlc_get_verified_transparent_balance`,
  `zcashlc_get_verified_transparent_balance_for_account`,
  `zcashlc_get_total_transparent_balance`).
* `propose_shielding` gained the same parameter; pass `::All`.
* `ReceiverFlags::to_address_request` now returns
  `ReceiverRequirementError` instead of `()`; propagate it through
  the `anyhow!` formatter so the upstream cause is preserved.
* `ConfirmationsPolicy` `try_from` error type widened from `()` to a
  `Display` type; format via `{e}`.

Cargo.toml changes (coordinated dependency repinning so the FFI builds
against a self-consistent dependency graph):

* Bump `[patch.crates-io]` librustzcash entries from
  `zcash/librustzcash@438657c52c` to
  `valargroup/librustzcash@6534482c1c`
  (`shielded-vote-for-zodl-3.4.0` HEAD), where the new APIs above live.
* Bump `sapling-crypto` git pin from `4f95c228` to `b8a81c22`, the
  rev required by the librustzcash fork (which transitively depends
  on `sapling-crypto 0.6.2`).
* Switch the SDK's `orchard` dep to `package = "valar-orchard"` and
  drop the `[patch.crates-io] orchard = ...` entry. The librustzcash
  fork already uses `valar-orchard` via the same `package =` alias and
  explicitly says "No orchard patch"; mirroring that prevents two
  incompatible orchard implementations from ending up in the graph.
* Move the SDK's `sapling` dep version from `"0.6"` to `"0.6.2"` to
  match the bumped pin.
* Add `voting-circuits = "0.2.0"` (transitively required by the FFI
  through `valar-orchard`).
* Repoint `zcash_voting` from `branch = "greg/orchard-0.12"` to
  `branch = "main"` so it lines up with the `valar-orchard 0.12.0` /
  librustzcash combination above.

Verified by `cargo build --target aarch64-apple-ios-sim --release`
(2m 56s, exit 0).

Made-with: Cursor
@p0mvn p0mvn merged commit fa5ea28 into shielded-vote-2.4.10 Apr 25, 2026
2 of 3 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.

1 participant