[#2193] Add Android voting JNI round lifecycle#5
Closed
greg0x wants to merge 3 commits into
Closed
Conversation
0c1654c to
7171d4a
Compare
13 tasks
Author
greg0x
added a commit
that referenced
this pull request
May 11, 2026
Addresses PR zcash#1938 review comment #5.
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.
Part of zodl-inc/zodl-android#2193.
Slice of zcash#1924 (umbrella draft PR being split into reviewable pieces).
Depends on zcash#1934 (first slice —
zcash_votingdependency foundation).Why
Second slice of the Android shielded-voting integration. zcash#1934 wires the
zcash_votingcrate into backend-lib; this PR adds the voting DB handle and round lifecycle so the round-keyed surface (init / state / list / get-votes / clear / delete-skipped) compiles end-to-end from Rust through JNI to Kotlin.Foundation for the Coinholder Polling flow tracked in zodl-inc/zodl-android#2193 — no user-visible behavior on its own.
What's in
Rust / JNI (
backend-lib/src/main/rust/voting/):db.rs— open/close native handle,setWalletIdrounds.rs—initRound,getRoundState,listRoundsJson,getVotesJson,clearRound,deleteSkippedBundlesshare_tracking.rs— existingcomputeShareNullifier, lifted out of the monolithic modulehelpers.rs— shared JNI helpers: fixed-width byte validation (PROTOCOL_FIELD_BYTES = 32),jint/jlongwidening,RoundState→FfiRoundStateconstructionjson.rs— round summary / vote record serialization,RoundPhase↔u32mappingvoting.rs— reduced to module roots + shared importsKotlin (
sdk-lib/.../internal/):jni/VotingRustBackend.kt— external declarations for the new surfaceTypesafeVotingBackend.kt+ impl —suspendwrappers, IO dispatcher, error checks, JSON →VoteRecordparsingmodel/voting/FfiVotingModels.kt—FfiRoundState,FfiRoundPhaseNot included
Review focus
Primary review track: core-dev. Please look at:
Box::into_raw/Box::from_rawacrossopenVotingDb/closeVotingDb,Arc<VotingDb>usage)catch_unwind, exception conversion)java_bytes_exacton 32-byte protocol fields)RoundState/RoundSummaryJSON and FFI mappinginternaland minimal — just enough to compile and exercise the JNISwift counterparts:
Validation
cargo check --manifest-path backend-lib/Cargo.toml --lockedcargo fmt --manifest-path backend-lib/Cargo.toml --check./gradlew :backend-lib:compileReleaseKotlin :sdk-lib:compileReleaseKotlin./gradlew ktlint detektAll./gradlew checkPropertiesgit diff --checkAuthor
Reviewer