-
Notifications
You must be signed in to change notification settings - Fork 5.4k
chore: AccountTrackerController migration #36808
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
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. |
✨ Files requiring CODEOWNER review ✨✅ @MetaMask/confirmations (1 files, +0 -15)
🧩 @MetaMask/extension-devs (5 files, +6 -5)
📜 @MetaMask/policy-reviewers (5 files, +6 -5)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🔗 @MetaMask/supply-chain (5 files, +6 -5)
👨🔧 @MetaMask/wallet-integrations (2 files, +6 -16)
|
| useExternalServices: true, | ||
| // from core PreferencesController | ||
| isMultiAccountBalancesEnabled: true, | ||
| useMultiAccountBalanceChecker: true, |
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.
Putting them together as it'll be easier to remove one when we eventually migrate to the core PreferencesController. For now, and considering this PR is already big enough, we are keeping both.
| */ | ||
| export function getKeyringControllerMessenger( | ||
| messenger: Messenger<AllowedActions, AllowedEvents>, | ||
| messenger: Messenger<never, never>, |
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.
It was using the wrong types from a different controller. KeyringController does not require any AllowedActions or AllowedEvents
| networkClientId, | ||
| ); | ||
| }, | ||
| includeStakedAssets: false, |
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.
Not part of this PR to include staked assets in the assets list. When we want to enable them, we can do so.
| setUseMultiAccountBalanceChecker(val: boolean): void { | ||
| this.update((state) => { | ||
| state.useMultiAccountBalanceChecker = val; | ||
| state.isMultiAccountBalancesEnabled = val; |
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.
Making sure isMultiAccountBalancesEnabled gets updated as well. Before this, it was always kept as true and not being used at all.
|
@MetaMask/policy-reviewers Changes related to the removal of |
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [f87fae0]
UI Startup Metrics (1256 ± 87 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [ba0182f]
UI Startup Metrics (1315 ± 105 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [3cfb04e]
UI Startup Metrics (1258 ± 101 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
ccharly
left a comment
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 for accounts files (assuming this is valid, but I'll let @seaona confirm that 😁)
seaona
left a comment
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.
Overall changes make sense. I added a couple of nits. Given this is a big PR with lots of code owners, it's not 100% blocking, but it would be good to have a follow-up PR addressing the changes, if this makes sense @bergarces
| recipientAddress: DEFAULT_FIXTURE_ACCOUNT, | ||
| amount: '1', | ||
| }); | ||
| await driver.waitForSelector('.transaction-status-label--confirmed'); |
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.
small nit but we shouldn't include selectors in the spec files, rather move them in page objects. This helps maintainability and scalability of our e2e suite
| amount: '1', | ||
| isSyncFlow: false, | ||
| }); | ||
| await driver.waitForSelector('.transaction-status-label--confirmed'); |
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.
same as above: no selectors in spec files
| // Balance is 0 because aggregated balance has changed and doesn't display dev networks | ||
| // The method should be udpdated to use the new selector and we can then remove checkExpectedTokenBalanceIsDisplayed | ||
| await loginWithBalanceValidation(driver, undefined, undefined, '0'); | ||
| await loginWithBalanceValidation(driver); |
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.
thanks for the comment, it makes sense to me
Description
This PR concludes the migration to
AccountsTrackerControllerfrom core. This is necessary in order to benefit from performance changes added and planned to the core controller.Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1368
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Replaces the local AccountTrackerController with the core one, removes legacy tracker/polling and gas-limit state, and updates state shape, selectors, metrics, tests, and dependencies accordingly.
AccountTrackerControllerwith@metamask/assets-controllersversion; update init, messengers, allowed actions/events, and wiring.account-tracker-controller*,batch-utils*,constants/contracts.ts, types) and related listeners/APIs (e.g., balance-update on tx, account syncing).accountsandcurrentBlockGasLimit*from background/UI state; rely onaccountsByChainIdonly; update sentry state and types.@metamask/assets-controllersto^86.0.0; update LavaMoat policies.isMultiAccountBalancesEnabledmirroringuseMultiAccountBalanceChecker.getBalanceand metrics.accountsByChainIdaddress handling (lowercasing in selectors); removegetBlockGasLimitusage; adjust gas estimate logic.token-searchnull guard; update tests/fixtures to checksummed addresses.number_of_accountsfromaccountsByChainId; update masked/removed fields.Written by Cursor Bugbot for commit 3cfb04e. This will update automatically on new commits. Configure here.