fix: handle emptyMainAccount for revoked key during multi-restore#2427
Conversation
When a user's on-chain key is revoked, keyIndexer returns no account for the public key. This causes validateKeyProvider to classify it as "provider without account" instead of detecting the revoked state. restoreLogin then throws WalletError.emptyMainAccount, which was not caught by RestoreMultiAccountViewModel, falling into the generic error handler. Add a catch for WalletError.emptyMainAccount that follows the same recovery path as noActiveKeys: cleanup the revoked account and add a new key. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
PR SummaryAdded error handling for Changes
autogenerated by presubmit.ai |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
✅ LGTM!
Review Summary
Commits Considered (1)
- 6402384: fix: handle emptyMainAccount error for revoked key during multi-restore
When a user's on-chain key is revoked, keyIndexer returns no account for
the public key. This causes validateKeyProvider to classify it as
"provider without account" instead of detecting the revoked state.
restoreLogin then throws WalletError.emptyMainAccount, which was not
caught by RestoreMultiAccountViewModel, falling into the generic error
handler.
Add a catch for WalletError.emptyMainAccount that follows the same
recovery path as noActiveKeys: cleanup the revoked account and add a
new key.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Files Processed (1)
- FRW/Modules/MultiRestore/ViewModel/RestoreMultiAccountViewModel.swift (1 hunk)
Actionable Comments (0)
Skipped Comments (2)
-
FRW/Modules/MultiRestore/ViewModel/RestoreMultiAccountViewModel.swift [69-75]
maintainability: "Duplicated error handling logic could be consolidated."
-
FRW/Modules/MultiRestore/ViewModel/RestoreMultiAccountViewModel.swift [71-71]
possible bug: "Inconsistent HUD dismissal between similar error handlers."
|
Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id> |
There was a problem hiding this comment.
✅ LGTM!
Review Summary
Commits Considered (1)
- fe86c1f: Merge branch 'dev' into fix-revoked-key-empty-account
Summary
WalletError.emptyMainAccountto be thrownRestoreMultiAccountViewModeldid not catch this error, so it fell into the generic error handler and showed a confusing error messageemptyMainAccountthat follows the same recovery path asnoActiveKeys: cleanup revoked account data and add a new keyRoot Cause
The validation flow in
WalletManager+KeyValidation:validateKeyProviderfetches account using the revoked key's public keyproviderWithoutAccount(instead of detecting revoked state)buildFinalResultPriority 1 returns.providerWithoutAccountrestoreLoginthrowsWalletError.emptyMainAccountTest plan
🤖 Generated with Claude Code