fix: hw account abstraction migration cp-7.77.0#30114
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Automated Review — PR #30114
SummaryThis PR prevents Perps from triggering signing prompts for hardware wallet users while the screen is idle. Previously, only the The PR achieves its stated goal cleanly with minimal code changes and good test coverage. Full review detailsRecipe CoverageRecipe skipped — CDP offline, code review only.
Overall recipe coverage: 0/2 ACs PROVEN
Prior ReviewsNo prior reviews. Acceptance Criteria Validation
Code Quality
Fix Quality
Live Validation
Correctness
Static Analysis
Architecture & Domain
Risk Assessment
Recommended ActionAPPROVE Clean, well-tested fix that achieves its stated goal. No issues found that would block merge. Human reviewer should validate the hardware wallet prompting behavior on a physical device since CDP was offline for this review. Line comments (2 comments: 2 suggestion)
No video evidence recorded. |
abretonc7s
left a comment
There was a problem hiding this comment.
Automated review — see comment above for full details.
| @@ -0,0 +1,26 @@ | |||
| import type { HyperLiquidAbstractionMode } from '../types/hyperliquid-types'; | |||
|
|
|||
| const MIGRATABLE_ABSTRACTION_MODES = new Set<HyperLiquidAbstractionMode>([ | |||
There was a problem hiding this comment.
suggestion — The MIGRATABLE_ABSTRACTION_MODES set here (dexAbstraction, default, disabled) must stay in sync with the explicit guard in HyperLiquidProvider.ts:747-751 that bails on unknown modes. Consider adding a comment cross-referencing each location, or extracting the known-mode list to a shared constant so they can't drift apart.
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag Selection Rationale:
The changes do not affect: browser, accounts, identity, network management, swaps, staking, money/ramps, snaps, or multi-chain API functionality. Performance Test Selection: |
|
Adding |
|



Description
This PR prevents Perps from triggering browsing-time signing flows for hardware wallet users while the screen is idle.
Previously, Unified Account setup only deferred the
dexAbstractionmigration when user signing was not allowed. Other signing-backed HyperLiquid abstraction modes could still attempt setup during passive Perps initialization, which could surface repeated hardware wallet prompts without an explicit user action.The fix adds a shared helper for deciding when Unified Account setup must be deferred, applies it during HyperLiquid provider initialization, and expands hardware wallet detection to cover MetaMask's hardware keyring types: Ledger, Trezor, OneKey, Lattice, and QR hardware wallets. Software wallets can still complete setup during initialization so the first trade sees unified collateral, while hardware wallets defer setup until an explicit trading or withdrawal action.
Changelog
CHANGELOG entry: Fixed a bug that could repeatedly prompt hardware wallet users while Perps was idle.
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
N/A. This is a controller behavior change with no intended UI changes.
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Note
Medium Risk
Changes when unified-account migration and other signing-backed setup runs, which can affect Perps initialization and migration behavior for hardware wallet users. Risk is moderated by added unit tests and a narrow decision helper, but incorrect deferral could delay required setup until action time.
Overview
Prevents browsing-time hardware wallet signing prompts by deferring HyperLiquid unified-account migration during Perps initialization whenever the current abstraction mode would require a signing-backed transition and user signing is not allowed.
Adds
shouldDeferUnifiedAccountSetupto centralize this decision (with new unit tests), updatesHyperLiquidProviderto use it, and expandsHyperLiquidWalletService.isSelectedHardwareWallet()to recognize additional MetaMask hardware keyring types (Ledger, Trezor, OneKey, Lattice, QR). Also updates related tests and log/comment wording from QR popup spam to hardware wallet signing prompt spam.Reviewed by Cursor Bugbot for commit 6f8cfe2. Bugbot is set up for automated code reviews on this repo. Configure here.