Split vote proving from persistence - #203
Merged
Merged
Conversation
Prepare ZKP2 commitments outside SQLite and atomically reject stale bundle state before persisting concurrent vote work.
Document the split proving API and finalize the primary crate prerelease on top of the supporting dependency releases. rc.6 was published from #202 with the crypto and PIR dependency update, so the split-proving API lands in rc.7 instead.
Group round, drafts, witness, and stage reporter into one input so the prepare path stays (db, signer, batch).
Keep the dependency label intact after the VoteCommitBatch note edit.
Reject prepared and recovered vote handoffs when their wallet or proof inputs become stale before persistence.
Opening a voting database left SQLite's busy timeout at its default of zero, so any write that raced another connection's transaction failed immediately with SQLITE_BUSY rather than waiting for it to finish. A wallet that keeps a second connection open -- or runs vote proving alongside persistence -- could see a write fail on a lock that would have cleared in milliseconds. Set a 5 second busy timeout when the connection is opened, and cover it with a test that holds BEGIN IMMEDIATE on a second connection and asserts the write waits for the rollback instead of returning an error. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UULDTCWGE87MXSECGPyT61
Capturing the full preparation state first meant a mismatched signer network surfaced as "failed to load ZKP2 inputs ... Query returned no rows" from the state lookup, because the ZKP2 query runs before anything compares networks. A caller passing Mainnet against a Testnet round got a missing-row error naming the round and bundle instead of the mismatch that actually caused it. Load the round network and validate it before capturing state, which is the order the pre-refactor path used and the order test_prepare_vote_commitment_rejects_network_mismatch_before_zkp2_inputs expects. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UULDTCWGE87MXSECGPyT61
p0mvn
force-pushed
the
feat/split-vote-proving
branch
from
August 22, 2026 04:31
014786f to
57205b6
Compare
p0mvn
changed the base branch from
chore/update-crypto-pir-dependencies
to
main
August 22, 2026 04:31
p0mvn
marked this pull request as ready for review
August 22, 2026 04:41
p0mvn
commented
Aug 22, 2026
Comment on lines
+90
to
+93
| conn.busy_timeout(SQLITE_BUSY_TIMEOUT) | ||
| .map_err(|e| VotingError::Internal { | ||
| message: format!("failed to configure database busy timeout: {}", e), | ||
| })?; |
Contributor
Author
There was a problem hiding this comment.
Note: this is a drive-by from code reviews, stems from adding concurrency
Contributor
Author
There was a problem hiding this comment.
I was a bit worried about this change because it applies globally. But in manual tests, did not observe any issues.
Mentioning for reviewer visibility
Contributor
Author
|
@cursor review |
A deferred read-validate-write can pass the optimistic check on a stale snapshot and then fail with SQLITE_BUSY instead of rejecting stale state.
Contributor
Author
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b30b821. Configure here.
czarcas7ic
approved these changes
Aug 22, 2026
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
zcash_voting 3.1.0-rc.7SQLITE_BUSYMotivation / Why
Holding SQLite while generating vote proofs blocks concurrent wallet work. Separating preparation from persistence keeps proving outside the transaction while optimistic state validation prevents stale results from being committed.
Notes
mainafter Update crypto and PIR dependencies #202 merged; base retargeted fromchore/update-crypto-pir-dependenciestomain.mainis the crate version bump. The Zakura wallet pins are inherited from the published rc.6 release.Tests
cargo test --workspace --lockedcargo test -p zcash_voting --features test-fixtures --lockedcargo test -p zcash_voting -p zcash-voting-wallet-example --all-targets --no-default-features --features zakura --lockedgit diff --check