-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: token detection and import #23798
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. |
@bergeron can you check why your e2e tests are failing ? |
Probably unrelated to the bugs, but I noticed another error related to the preferences-controller that was introduced in #22928. diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index 89905caaef..ddecaf42f5 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -500,8 +500,8 @@ export default class MetamaskController extends EventEmitter {
const preferencesMessenger = this.controllerMessenger.getRestricted({
name: 'PreferencesController',
- allowedActions: ['PreferencesController:getState'],
- allowedEvents: ['PreferencesController:stateChange'],
+ allowedActions: [],
+ allowedEvents: [],
});
this.preferencesController = new PreferencesController({ |
Test failing because we're sending RPC requests before onboarding finishes. Test was recently added while detection was broken. Will see if I can delay the controller's start. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #23798 +/- ##
===========================================
+ Coverage 68.99% 69.03% +0.04%
===========================================
Files 1164 1164
Lines 44515 44491 -24
Branches 11890 11888 -2
===========================================
Hits 30711 30711
+ Misses 13804 13780 -24 ☔ View full report in Codecov by Sentry. |
Builds ready [f402e0f]
Page Load Metrics (1192 ± 583 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
Builds ready [6ffbb8c]
Page Load Metrics (355 ± 304 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/@types/[email protected] |
Builds ready [2f5c68b]
Page Load Metrics (631 ± 449 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
## Explanation During account change, the token detection trigger was guarded by the `useTokenDetection` setting. But on mainnet, detection should run against the static token list even if the setting is disabled. So remove the guard. ## References MetaMask/metamask-extension#23798 ## Changelog ### `@metamask/assets-controllers` - **FIXED**: Token detection during account change ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for making these fixes.
Description
Fixes issues with detecting and manually importing tokens, caused by recent controller changes.
Hotfix for 11.14.0
This state publish had an undefined variable, and had the wrong function signature:
Which prevented the controllers from processing account switches.
A test was failing because RPC requests were sent before onboarding. Delayed the enabling of token detection controller to
triggerNetworkrequests
.Also patching this fix for detection during account switch on mainnet when autodetection=off:
MetaMask/core#4133
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist