Skip to content

fix: rediscover rotated vaults in one pass after mnemonic recovery - #34

Open
kriss39 wants to merge 1 commit into
p-11:mainfrom
kriss39:fix/recovery-vault-rediscovery
Open

kriss39 wants to merge 1 commit into
p-11:mainfrom
kriss39:fix/recovery-vault-rediscovery

Conversation

@kriss39

@kriss39 kriss39 commented Sep 13, 2026

Copy link
Copy Markdown

libqc's importWallet persists an empty address list, so a recovered wallet only gets its index-0 vault back from the missing-default-chain branch. Every later vault (each emptyVault rotation mints the next index) had to be re-derived by the boot safety net, which minted exactly one index per initWallet and only re-checked on the next popup boot. A user who had rotated three times therefore saw an empty wallet right after recovery and needed several open/close cycles before the vault holding their funds showed up.

Chain the safety-net repair: after minting an index, inspect the minted vault's status and keep advancing while it reports vulnerable, so the whole history is rediscovered during the recovery hydration. A fresh, never-used derivation reports safe and terminates the chain, so the non-recovery case is unchanged (one mint). A per-chain cap guards against a status provider that never reports safe.

Why

  • Explain the reason for this pull request.
  • What problem is it solving?
  • Any relevant background or context?

How

  • Describe the changes made.
  • What approach was used?
  • Any key design decisions or implementation details?

Security / Environment Variables (if applicable)

  • Note any changes that affect security (new dependencies, communication with external services, data encryption, authentication).
  • Note any new environment variables that will need to be set.
  • Describe potential impacts or additional setup needed.

Testing

  • Describe how you tested your changes.
  • List any additional testing steps needed for review.

libqc's `importWallet` persists an empty address list, so a recovered
wallet only gets its index-0 vault back from the missing-default-chain
branch. Every later vault (each `emptyVault` rotation mints the next
index) had to be re-derived by the boot safety net, which minted exactly
one index per `initWallet` and only re-checked on the next popup boot.
A user who had rotated three times therefore saw an empty wallet right
after recovery and needed several open/close cycles before the vault
holding their funds showed up.

Chain the safety-net repair: after minting an index, inspect the minted
vault's status and keep advancing while it reports `vulnerable`, so the
whole history is rediscovered during the recovery hydration. A fresh,
never-used derivation reports `safe` and terminates the chain, so the
non-recovery case is unchanged (one mint). A per-chain cap guards
against a status provider that never reports `safe`.

This branch has not been deployed

No deployments
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