Skip to content

Migrate voting recovery state from JSON files to SQLite DB#19

Merged
czarcas7ic merged 3 commits into
valargroup/shielded-votingfrom
adam/recovery-state-to-db
Mar 17, 2026
Merged

Migrate voting recovery state from JSON files to SQLite DB#19
czarcas7ic merged 3 commits into
valargroup/shielded-votingfrom
adam/recovery-state-to-db

Conversation

@czarcas7ic
Copy link
Copy Markdown

@czarcas7ic czarcas7ic commented Mar 17, 2026

Summary

Replace the Swift-side RecoveryFileStore (per-round JSON files in Documents directory) with DB-backed recovery state stored in the voting SQLite database via Rust FFI.

  • Delete RoundRecoveryState struct and RecoveryFileStore actor
  • VotingCryptoClient recovery methods now call VotingRustBackend DB operations instead of reading/writing JSON files
  • All VotingStore.swift callers updated: use roundId directly instead of recoveryRoundKey ("{roundId}_{walletId}")
  • Recovery methods are now throws (consistent with DB operations); callers use try? for defensive recovery
  • Update test mocks to use individual DB getters instead of RoundRecoveryState

Net result: -86 lines (more deletions than additions), single source of truth in SQLite.

Replace RecoveryFileStore (per-round JSON files) with DB-backed
recovery state stored in the voting SQLite database via Rust FFI.

- Remove RoundRecoveryState, RecoveryFileStore
- VotingCryptoClient methods now call VotingRustBackend DB operations
- VotingStore callers use roundId directly instead of recoveryRoundKey
- Recovery methods are now throwing (consistent with DB operations)
- Update tests to mock individual DB getters instead of RoundRecoveryState
@czarcas7ic czarcas7ic force-pushed the adam/recovery-state-to-db branch from 7830e65 to ab1996a Compare March 17, 2026 04:11
@czarcas7ic czarcas7ic marked this pull request as ready for review March 17, 2026 04:13
The migration commit (ab1996a) accidentally reverted the
delegationApproved chaining from fa8e768, leaving Keystone users
stuck on a disabled "Preparing Keystone request..." button.
Also fix the partial-restore path which had the same dead end.
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.

This is 👌

@czarcas7ic czarcas7ic merged commit f2db5ed into valargroup/shielded-voting Mar 17, 2026
greg0x pushed a commit that referenced this pull request Mar 20, 2026
Migrate voting recovery state from JSON files to SQLite DB
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