feat: share-status polling — DB layer, nullifier derivation, and receipt lifecycle#8
Closed
p0mvn wants to merge 1 commit into
Closed
feat: share-status polling — DB layer, nullifier derivation, and receipt lifecycle#8p0mvn wants to merge 1 commit into
p0mvn wants to merge 1 commit into
Conversation
…ipt lifecycle Add the Rust-side infrastructure for the fire-persist-poll share reveal confirmation system. After CastVote TX confirms, the wallet delegates encrypted shares to helpers and polls for on-chain reveal confirmation using deterministic share nullifiers. Schema (migration v6): - votes: add `van_authority_spent` column, separate from `submitted` — tracks CastVote TX confirmation for proposal_authority bitmask while `submitted` tracks share-reveal completion. - share_delegations: PK now includes `helper_url` (one receipt per helper per share); renamed nullifier→share_nullifier, confirmed→reveal_confirmed; added `seq`, `submit_at` columns. Storage operations: - ShareDelegationReceipt and PendingShareRevealGroup types with serde. - CRUD: store/list/clear receipts, mark_share_revealed_for_helper, list_pending_share_reveal_groups (joins votes.submitted=0). - mark_van_authority_spent with rows-affected guard. - store_vote uses ON CONFLICT to preserve submitted/van_authority_spent on crash-retry re-insert. - Release DB mutex during long-running ZKP #1 proof generation so share-polling callers aren't blocked. Nullifier derivation: - compute_share_nullifier() chains vote_commitment_hash → share_nullifier_hash (Poseidon, same domain tags as ZKP #3 circuit). - build_share_payloads includes share_nullifier in each SharePayload. - round_id_bytes_from_hex rejects inputs >32 bytes. Also fixes pre-existing build error in zkp2.rs (upstream voting-circuits removed single_share parameter from build_vote_proof_from_delegation). Made-with: Cursor
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
CastVoteTX confirms, the wallet delegates encrypted shares to helpers and polls for on-chain confirmation using deterministic share nullifiers.votesgainsvan_authority_spent(separate fromsubmitted— tracks CastVote TX for proposal_authority bitmask vs share-reveal completion);share_delegationsrebuilt with per-helper PK,share_nullifier,seq,submit_at,reveal_confirmedcolumns.ShareDelegationReceipt/PendingShareRevealGrouptypes with serde; full receipt CRUD;mark_van_authority_spentwith rows-affected guard;store_voteON CONFLICT preserves flags on crash-retry; DB mutex released during ZKP Use Creator::build_from_parts for governance PCZT construction #1 proof generation.compute_share_nullifier()chainsvote_commitment_hash→share_nullifier_hash(Poseidon, same domain tags as ZKP Migrate voting recovery state to SQLite DB #3 circuit); included in eachSharePayload.zkp2.rs(upstreamvoting-circuitsremovedsingle_shareparam).Test plan
test_migrate_fresh_database— fresh DB reaches v6test_migrate_v5_to_v6— v5 DB upgrades: votes survive withvan_authority_spent=0, newshare_delegationsschema workstest_share_delegation_receipt_roundtrip— store, list, clear receipt CRUDtest_pending_share_reveal_groups_lifecycle— end-to-end polling loop: insert receipts → list pending → mark revealed → mark submitted → group vanishestest_multi_bundle_delegation_and_voting—van_authority_spentvssubmittedseparation, proposal_authority bitmasktest_build_share_payloads— share_nullifier is 32 bytes, distinct per share indexMade with Cursor