Sync FFI to valargroup/librustzcash:shielded-vote-for-zodl-3.4.0#24
Merged
Merged
Conversation
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
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.
Summary
Adapts the SDK to compile against the
valargroup/librustzcash:shielded-vote-for-zodl-3.4.0branch 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 needslibzcashlc.framework.What this changes
rust/src— adapt to current librustzcash APIget_spendable_transparent_outputsgained a 4th parameterTransparentOutputFilter→ pass::Allat all 3 call sites.propose_shieldinggained the same parameter → pass::All.ReceiverFlags::to_address_requestnow returnsReceiverRequirementErrorinstead of()→ propagate via{e}so the upstream cause is preserved in the error.ConfirmationsPolicy::try_fromerror type widened from()to aDisplaytype → format via{e}.Cargo.toml— coordinated repinning so the dep graph is self-consistent[patch.crates-io]librustzcash entries:zcash/librustzcash@438657c52c→valargroup/librustzcash@6534482c1c(the rev where the new APIs above live).sapling-cryptogit pin:4f95c228→b8a81c22(the rev required by the librustzcash fork, which transitively depends onsapling-crypto 0.6.2).orcharddep:"0.12"→{ version = "0.12.0", package = "valar-orchard" }, and the[patch.crates-io] orchard = ...entry is dropped. The librustzcash fork already usesvalar-orchardvia the samepackage =alias and explicitly comments "No orchard patch"; mirroring that here prevents two incompatible orchard implementations from ending up in the graph.saplingdep version:"0.6"→"0.6.2"(matches the bumped pin).voting-circuits = "0.2.0"(transitively required by the FFI throughvalar-orchard).zcash_votingbranch:greg/orchard-0.12→main(the rev that lines up with thevalar-orchard 0.12.0/ librustzcash combination above).Verification
Exit code
0. No warnings about multiple versions of orchard / sapling / zcash_* in the graph.Notes for the reviewer
Cargo.tomlrepins are not optional polish — without them the rust changes don't build because the upstreamlibrustzcash@438657c52cdoesn't haveTransparentOutputFilter/ReceiverRequirementErroryet.valargroup/librustzcashfork rather than upstreamzcash/librustzcash. Once those fork patches land inzcash/librustzcash:mainand a release rev is available, this[patch.crates-io]block can be repointed back to upstream.Test plan
cargo build --target aarch64-apple-ios-sim --releasecargo build --target aarch64-apple-ios --releasezashi-mainnetcontinues to succeed against the resultinglibzcashlc.xcframeworkMade with Cursor