Skip to content

feat: share-status polling — DB layer, nullifier derivation, and receipt lifecycle#8

Closed
p0mvn wants to merge 1 commit into
mainfrom
adam/share-status-polling
Closed

feat: share-status polling — DB layer, nullifier derivation, and receipt lifecycle#8
p0mvn wants to merge 1 commit into
mainfrom
adam/share-status-polling

Conversation

@p0mvn
Copy link
Copy Markdown
Contributor

@p0mvn p0mvn commented Mar 21, 2026

Summary

  • Add 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 confirmation using deterministic share nullifiers.
  • Schema migration v6: votes gains van_authority_spent (separate from submitted — tracks CastVote TX for proposal_authority bitmask vs share-reveal completion); share_delegations rebuilt with per-helper PK, share_nullifier, seq, submit_at, reveal_confirmed columns.
  • Storage operations: ShareDelegationReceipt / PendingShareRevealGroup types with serde; full receipt CRUD; mark_van_authority_spent with rows-affected guard; store_vote ON CONFLICT preserves flags on crash-retry; DB mutex released during ZKP Use Creator::build_from_parts for governance PCZT construction #1 proof generation.
  • Nullifier derivation: compute_share_nullifier() chains vote_commitment_hashshare_nullifier_hash (Poseidon, same domain tags as ZKP Migrate voting recovery state to SQLite DB #3 circuit); included in each SharePayload.
  • Fixes pre-existing build error in zkp2.rs (upstream voting-circuits removed single_share param).

Test plan

  • test_migrate_fresh_database — fresh DB reaches v6
  • test_migrate_v5_to_v6 — v5 DB upgrades: votes survive with van_authority_spent=0, new share_delegations schema works
  • test_share_delegation_receipt_roundtrip — store, list, clear receipt CRUD
  • test_pending_share_reveal_groups_lifecycle — end-to-end polling loop: insert receipts → list pending → mark revealed → mark submitted → group vanishes
  • test_multi_bundle_delegation_and_votingvan_authority_spent vs submitted separation, proposal_authority bitmask
  • test_build_share_payloads — share_nullifier is 32 bytes, distinct per share index

Made with Cursor

…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
@p0mvn p0mvn closed this Mar 21, 2026
@p0mvn p0mvn deleted the adam/share-status-polling branch March 21, 2026 04:17
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