Conversation
…for test addresses (#4466)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 4 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| 'network' in cardanoAction ? cardanoAction.network : undefined | ||
| if (actionNetwork && actionNetwork !== currentNetwork) { | ||
| walletManager.setSelectedNetwork(actionNetwork) | ||
| } |
There was a problem hiding this comment.
Network switch race condition in action executor
High Severity
The network switching logic calls walletManager.setSelectedNetwork(actionNetwork) but doesn't await its completion before processing the action. The setSelectedNetwork method is asynchronous internally (it calls hydrateFn().then(...) and returns void), meaning the switch (cardanoAction.action) block executes immediately while the network switch is still in progress. Actions like send-single-pt, send-only-receiver, and pay-request may be processed against the wrong network, potentially causing transaction preparation issues when scanning a testnet QR code while on mainnet (or vice versa).
| }) | ||
| // App will behave as fresh install anyway since storage is cleared | ||
| } | ||
| } |
There was a problem hiding this comment.
Exported function clearAllStorage is never used
Low Severity
The clearAllStorage function is exported but never imported or called anywhere in the codebase. Only clearRecoverableStorage is actually used (by useMigrations.ts). This is dead code that adds maintenance burden without providing any functionality.
| f.error.message.includes('MMKV') || | ||
| f.error.message.includes('storage') || | ||
| f.error.message.includes('getAllKeys') || | ||
| f.error.message.includes('multiGet'), |
There was a problem hiding this comment.
Duplicated critical error detection pattern
Low Severity
The same critical error detection logic checking for 'corrupt', 'MMKV', 'storage', 'getAllKeys', 'multiGet' patterns appears twice in useMigrations. Once for checking migration result failures (lines 112-118) and again for caught exceptions (lines 149-154). This duplication increases maintenance burden and risk of inconsistent updates.
Additional Locations (1)
| ) | ||
| } | ||
| }, [walletManager]) | ||
| }, [hydrationError]) |
There was a problem hiding this comment.
Redundant logging effect for hydrationError state
Low Severity
The hydrationError state triggers a second useEffect that logs a warning, but this is redundant since errors are already logged at the point they occur (lines 39-43 for timeout, lines 58-60 for failures). The state is never exposed to consumers or used for conditional rendering, making both the state and the logging effect unnecessary complexity.
Note
High Risk
High risk because it changes app startup/wallet loading and migration behavior, including automatic storage clearing/recovery paths that could affect persisted wallet metadata and user settings if triggered incorrectly.
Overview
Hardens startup + migrations against storage corruption/hangs. Adds
validateStorageIntegrity/attemptStorageRecovery, introducesclearRecoverableStorage(preservekeystore/) and uses it fromuseMigrationswith a 60s timeout + retries;runMigrationsnow returns failure results instead of throwing on version mismatch.Improves wallet hydration/recovery behavior.
WalletManagerHydrationWrapperadds a 30s timeout and continues rendering on failure;WalletManager.hydrateadds defensive error handling for storage reads. IntroducesrecoverOrphanedWalletsto rebuild missing wallet metadata fromkeystore/xpubs, with new unit tests.Deep-link fixes for network + decimal amounts. Cardano link actions now optionally include
network, link parsing detects mainnet vs preprod from address prefixes and normalizes numeric/decimal amounts, anduseActionExecutorswitches the selected network before executing link actions (with updated tests and Android link test script).Written by Cursor Bugbot for commit 44c5af5. This will update automatically on new commits. Configure here.