feat: non-user-facing getUnlockPromise optional skipCount param#4006
feat: non-user-facing getUnlockPromise optional skipCount param#4006maxime-oe wants to merge 1 commit into
Conversation
|
@metamaskbot publish-preview |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4006 +/- ##
=======================================
Coverage 98.58% 98.58%
=======================================
Files 425 425
Lines 12370 12370
Branches 1949 1949
=======================================
Hits 12195 12195
Misses 175 175 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3dd5163 to
290f5ad
Compare
fcc5f4c to
8f02e0b
Compare
8f02e0b to
07d4fb9
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 07d4fb9. Configure here.
| * | ||
| * @returns A promise that resolves once the extension is unlocked. | ||
| */ | ||
| getUnlockPromise: (shouldShowUnlockRequest: boolean) => Promise<void>; |
There was a problem hiding this comment.
Inconsistent skipCount argument across getUnlockPromise call sites
Medium Severity
This PR updates five call sites to pass getUnlockPromise(true, true) with the new skipCount argument, but four other call sites — in getBip32Entropy.ts, getBip32PublicKey.ts, getBip44Entropy.ts, and manageState.ts — still call getUnlockPromise(true) without it. The types for all these files were updated to GetUnlockPromise in this same PR, suggesting the call sites were intended to be updated as well. This inconsistency means these four methods won't skip the count while all others will.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 07d4fb9. Configure here.
There was a problem hiding this comment.
With this PR as experiment, I apply the new skipCount only when I see the counter being incremented for operations that are getting "spammed" and make the counter increment for no user-facing reason. Doing it this way to minimize the changes.


Draft for attempting to create a preview build
Note
Medium Risk
Touches multiple Snap RPC methods and hook type definitions around unlock-gating, so incorrect hook implementations could break encrypted state/entropy access flows. The change is mostly signature plumbing, but it affects security-adjacent paths that run before keyring/seed access.
Overview
Introduces a shared
GetUnlockPromisetype (with new optionalskipCountparameter) and updates Snap RPC method hook definitions to use it.Updates several permitted/restricted RPC methods (e.g.,
snap_getState,snap_setState,snap_listEntropySources,snap_getEntropy,snap_manageAccounts) to callgetUnlockPromise(true, true)and adjusts the related unit test accordingly, plus aligns the snaps simulation hook signature to accept the new optional parameter.Reviewed by Cursor Bugbot for commit 07d4fb9. Bugbot is set up for automated code reviews on this repo. Configure here.