Skip to content

feat: per-wallet voting state isolation#13

Merged
czarcas7ic merged 2 commits into
valargroup/shielded-votingfrom
adam/per-wallet-voting-isolation
Mar 15, 2026
Merged

feat: per-wallet voting state isolation#13
czarcas7ic merged 2 commits into
valargroup/shielded-votingfrom
adam/per-wallet-voting-isolation

Conversation

@czarcas7ic
Copy link
Copy Markdown

@czarcas7ic czarcas7ic commented Mar 15, 2026

Summary

  • Pass AccountUUID bytes to getWalletNotes for correct wallet note selection.
  • Call setWalletId after opening the voting DB, scoping all round state via the librustvoting schema's wallet_id column.
  • Recovery JSON files use compound roundId_walletId key (Swift-side only).

Depends on:

@czarcas7ic czarcas7ic force-pushed the adam/per-wallet-voting-isolation branch from 2d232da to 28716fb Compare March 15, 2026 18:12
@czarcas7ic czarcas7ic marked this pull request as ready for review March 15, 2026 18:40
@czarcas7ic czarcas7ic force-pushed the adam/per-wallet-voting-isolation branch from 28716fb to 37a9663 Compare March 15, 2026 18:49
When both hotkey and keystone wallets were loaded, two issues caused
cross-wallet contamination in the voting flow:

1. Wrong notes: getWalletNotes passed seedFingerprint + accountIndex
   but the Rust FFI used accountIndex as a positional array index,
   always selecting the first account. Now passes AccountUUID bytes
   directly for unambiguous lookup. (Requires SDK PR valargroup/zcash-swift-wallet-sdk#3)

2. Shared state: voting.sqlite3 and recovery JSON files were keyed
   by roundId alone. Both wallets shared bundles, proofs, VAN
   positions, and crash-recovery state for the same round. Now scopes
   the DB path by walletId and recovery files by a compound
   roundId_walletId key captured at voting flow entry.
@czarcas7ic czarcas7ic force-pushed the adam/per-wallet-voting-isolation branch from 37a9663 to 70d92da Compare March 15, 2026 18:51
@czarcas7ic czarcas7ic changed the title fix: per-wallet voting state isolation feat: per-wallet voting state isolation Mar 15, 2026
When both hotkey and keystone wallets are loaded, voting state is
now isolated per wallet:

1. Note fetching: passes AccountUUID bytes for direct account
   lookup (requires SDK PR valargroup/zcash-swift-wallet-sdk#3).

2. DB scoping: calls setWalletId after opening the voting DB,
   which scopes all round state via the wallet_id column in the
   librustvoting schema (requires librustvoting PR).

3. Recovery files: uses compound roundId_walletId key for crash-
   recovery JSON files (Swift-side only, no Rust changes).
@czarcas7ic czarcas7ic force-pushed the adam/per-wallet-voting-isolation branch from 7c2a29b to c7d4f4d Compare March 15, 2026 20:30
@czarcas7ic czarcas7ic merged commit 5e89c09 into valargroup/shielded-voting Mar 15, 2026
Copy link
Copy Markdown
Collaborator

@greg0x greg0x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

greg0x pushed a commit that referenced this pull request Mar 20, 2026
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.

2 participants