Skip to content

Conversation

@bergarces
Copy link
Contributor

@bergarces bergarces commented Oct 26, 2025

Description

Update assets-controllers with a set of changes for DeFi position fetching:

  • Introduces timeouts and retries.
  • Only fetches current account.
  • Prevents any calls before onboarding is finished.

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Changed how DeFi positions are fetch in the client to reduce amount of calls

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-1295

Manual testing steps

  1. Open a wallet with DeFi positions
  2. Positions should still load

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Require completed onboarding to enable DeFi positions, migrate controller messenger to account-tree APIs, add raw fiat amount to DeFi list items, and upgrade assets-controllers to v87.

  • Controllers:
    • Enablement: DeFiPositionsControllerInit now requires completedOnboarding along with useExternalServices and the assetsDefiPositionsEnabled flag.
    • Messenger: Switch from accounts-controller to account-tree-controller APIs:
      • Actions: AccountTreeController:getAccountsFromSelectedAccountGroup.
      • Events: add AccountTreeController:selectedAccountGroupChange; remove KeyringController:unlock and accounts events.
    • Exports: Consolidate messenger exports/types via app/scripts/controller-init/messengers/defi-positions/index.ts, including getDeFiPositionsControllerInitMessenger.
  • UI:
    • ui/components/app/assets/defi-list/defi-list.tsx: include raw tokenFiatAmount (unformatted aggregatedMarketValue) in protocol cell data.
  • Dependencies:
    • Bump @metamask/assets-controllers to ^87.0.0 (lockfile updated).

Written by Cursor Bugbot for commit 3c6ffc8. This will update automatically on new commits. Configure here.

@bergarces bergarces marked this pull request as draft October 26, 2025 21:30
@github-actions
Copy link
Contributor

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.

@socket-security
Copy link

socket-security bot commented Oct 26, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​assets-controllers@​86.0.0 ⏵ 87.0.09810091 +198100

View full report

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 6512549 | Date: 10/26/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±69ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 735ms (±67ms) 🟢 | historical mean value: 737ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±10ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 69ms 1.01s 1.31s 1.26s 1.31s
domContentLoaded 735ms 67ms 697ms 993ms 930ms 993ms
firstPaint 77ms 10ms 56ms 156ms 88ms 156ms
firstContentfulPaint 77ms 10ms 56ms 156ms 88ms 156ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [6512549]
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 284 Bytes (0.01%)
  • ui: 14 Bytes (0%)
  • common: 7.39 KiB (0.09%)

@bergarces bergarces changed the title update assets controllers chore: update assets controllers Oct 26, 2025
@bergarces bergarces changed the title chore: update assets controllers chore: update assets-controllers Oct 26, 2025
@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 379f01e | Date: 10/26/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±42ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 726ms (±39ms) 🟢 | historical mean value: 737ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±11ms) 🟢 | historical mean value: 78ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 42ms 1.01s 1.33s 1.07s 1.33s
domContentLoaded 726ms 39ms 704ms 985ms 746ms 985ms
firstPaint 77ms 11ms 60ms 168ms 88ms 168ms
firstContentfulPaint 77ms 11ms 60ms 168ms 88ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [379f01e]
UI Startup Metrics (1199 ± 98 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1199101814349812531376
load102286412239710881198
domContentLoaded101586112159510821187
domInteractive2014107131850
firstPaint69182123141410531197
backgroundConnect1861712077190198
firstReactRender30185273644
getState19775112241
initialActions70689721
loadScripts8366891031959051005
setupStore1062331115
BrowserifyPower User HomeuiStartup22731831412470127784124
load1177945201535916272015
domContentLoaded1166937200335516062003
domInteractive301598235398
firstPaint805189201358110152013
backgroundConnect279221733121292733
firstReactRender25233022630
getState21214432340222323
initialActions52174517
loadScripts921720164931912951649
setupStore1292951429
WebpackStandard HomeuiStartup8717401126678951031
load65159790962656841
domContentLoaded64359089962649821
domInteractive171266101439
firstPaint20359902197200773
backgroundConnect26125483340
firstReactRender28177493336
getState1263441422
initialActions3017348
loadScripts63958888860647808
setupStore1052631216
WebpackPower User HomeuiStartup16951266243833817972438
load73961512421838681242
domContentLoaded71260011441638161144
domInteractive19123992339
firstPaint50310410252866481025
backgroundConnect9219310101137310
firstReactRender24232812528
getState1708819922177199
initialActions10042163042
loadScripts70859811331608041133
setupStore21673203173
FirefoxBrowserifyStandard HomeuiStartup14861297188912415641723
load1262111614688613441396
domContentLoaded1261111514688613431396
domInteractive1213533457132273
firstPaint------
backgroundConnect4023133174762
firstReactRender25215142533
getState83567916
initialActions6118320310
loadScripts1236109514388413151371
setupStore167211241347
BrowserifyPower User HomeuiStartup28412190383055536163830
load14441236180915315371809
domContentLoaded14441235180815315371808
domInteractive1314520751194207
firstPaint------
backgroundConnect2384711092782261109
firstReactRender402961104961
getState1278818525146185
initialActions1811724112172
loadScripts1344120215499314261549
setupStore4361854978185
WebpackStandard HomeuiStartup15991387198412316561858
load13681210172210314261590
domContentLoaded13681210172110314261589
domInteractive1113338863116211
firstPaint------
backgroundConnect4622115195187
firstReactRender28227992836
getState94147151014
initialActions7119821343
loadScripts13381191169310113971537
setupStore14778111334
WebpackPower User HomeuiStartup29382383367743033603677
load16321366210220418332102
domContentLoaded16311366210220418332102
domInteractive1283722257202222
firstPaint------
backgroundConnect22733726214442726
firstReactRender47301081851108
getState1647337270206372
initialActions71215921
loadScripts15561345190516417351905
setupStore24568183368
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 284 Bytes (0.01%)
  • ui: 14 Bytes (0%)
  • common: 7.39 KiB (0.09%)

bergarces added a commit to MetaMask/core that referenced this pull request Nov 3, 2025
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

- Updates DeFiPositionsController to only update the selected EVM
account
- Adds timeout & retry mechanism
- Fixes issue with DeFi polling starting before onboarding due to
subscription to `KeyringController:unlocked` event

Draft PR for extension:
MetaMask/metamask-extension#37215
Draft PR for mobile:
MetaMask/metamask-mobile#21657

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

Related to https://consensyssoftware.atlassian.net/browse/ASSETS-1238

## Checklist

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Updates DeFi positions to only refresh the selected EVM address, gates
updates on relevant events, and adds an 8s timeout with a single retry
to the API fetch.
> 
> - **DeFiPositionsController**
> - Refreshes DeFi positions for only the selected EVM account
(`_executePoll`, `#updateAccountPositions`).
> - Replaces AccountsController dependencies with
`AccountTreeController:getAccountsFromSelectedAccountGroup` to derive
selected EVM address.
>   - Event changes:
>     - Stops polling on `KeyringController:lock` (unchanged).
> - Removes `KeyringController:unlock` and
`AccountsController:accountAdded` listeners.
> - Adds `AccountTreeController:selectedAccountGroupChange` to refresh
selected address.
> - `TransactionController:transactionConfirmed` now updates only if it
matches the selected address.
> - **Fetch behavior**
> - `fetch-positions`: wraps API call with `timeoutWithRetry` (8s
timeout, 1 retry).
>   - Adds `utils/timeout-with-retry` with unit tests.
> - **Tests**
> - Update unit tests to new selected-account-only behavior and new
events.
> - **Changelog**
> - Documents breaking changes to events/behavior and new timeout+retry.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
fe03293. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
juanmigdr pushed a commit to MetaMask/core that referenced this pull request Nov 3, 2025
<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->

- Updates DeFiPositionsController to only update the selected EVM
account
- Adds timeout & retry mechanism
- Fixes issue with DeFi polling starting before onboarding due to
subscription to `KeyringController:unlocked` event

Draft PR for extension:
MetaMask/metamask-extension#37215
Draft PR for mobile:
MetaMask/metamask-mobile#21657

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

Related to https://consensyssoftware.atlassian.net/browse/ASSETS-1238

- [X] I've updated the test suite for new or updated code as appropriate
- [X] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [X] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [X] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Updates DeFi positions to only refresh the selected EVM address, gates
updates on relevant events, and adds an 8s timeout with a single retry
to the API fetch.
>
> - **DeFiPositionsController**
> - Refreshes DeFi positions for only the selected EVM account
(`_executePoll`, `#updateAccountPositions`).
> - Replaces AccountsController dependencies with
`AccountTreeController:getAccountsFromSelectedAccountGroup` to derive
selected EVM address.
>   - Event changes:
>     - Stops polling on `KeyringController:lock` (unchanged).
> - Removes `KeyringController:unlock` and
`AccountsController:accountAdded` listeners.
> - Adds `AccountTreeController:selectedAccountGroupChange` to refresh
selected address.
> - `TransactionController:transactionConfirmed` now updates only if it
matches the selected address.
> - **Fetch behavior**
> - `fetch-positions`: wraps API call with `timeoutWithRetry` (8s
timeout, 1 retry).
>   - Adds `utils/timeout-with-retry` with unit tests.
> - **Tests**
> - Update unit tests to new selected-account-only behavior and new
events.
> - **Changelog**
> - Documents breaking changes to events/behavior and new timeout+retry.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
fe03293. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@bergarces bergarces marked this pull request as ready for review November 4, 2025 09:45
@metamaskbot
Copy link
Collaborator

Builds ready [1d6a0d5]
UI Startup Metrics (1251 ± 88 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1251111015828813021425
load106294113347711121212
domContentLoaded105488813237811071203
domInteractive221479142066
firstPaint63273135643710611219
backgroundConnect23721931215240272
firstReactRender291875103152
getState2275092841
initialActions71488925
loadScripts825667108879880971
setupStore1273661324
numNetworkReqs1367620670
BrowserifyPower User HomeuiStartup20161778257625523302576
load1054920137516512751375
domContentLoaded1046917136616512681366
domInteractive311575204775
firstPaint761163138842710101388
backgroundConnect23922427413251274
firstReactRender28253633036
getState18815922821204228
initialActions53112711
loadScripts815697113615910431136
setupStore1493771337
numNetworkReqs1777228987249289
WebpackStandard HomeuiStartup8086911114808231031
load59054087969586805
domContentLoaded58353286666580795
domInteractive15125681435
firstPaint20355822189196588
backgroundConnect241189152464
firstReactRender28188493335
getState1062631216
initialActions40233410
loadScripts58052985464578784
setupStore1052631216
numNetworkReqs1467620872
WebpackPower User HomeuiStartup13201142170419115321704
load62657279374638793
domContentLoaded61256477172618771
domInteractive32131384022138
firstPaint31584775244590775
backgroundConnect41101433143143
firstReactRender26252812628
getState15311218820162188
initialActions51215721
loadScripts60756176169606761
setupStore1062751127
numNetworkReqs1437021651184216
FirefoxBrowserifyStandard HomeuiStartup15231311206113715721788
load1286113516129213521450
domContentLoaded1285113516119213521450
domInteractive1153625344128225
firstPaint------
backgroundConnect49252183152142
firstReactRender27226062739
getState12418326833
initialActions41274416
loadScripts1257111815798913121413
setupStore157191191334
numNetworkReqs1266716761
BrowserifyPower User HomeuiStartup25962187328433726763284
load14591217191020715201910
domContentLoaded14591217191020715201910
domInteractive22182677187319677
firstPaint------
backgroundConnect1253738390166383
firstReactRender423194154894
getState13210221133153211
initialActions1511243014124
loadScripts14231191186820214711868
setupStore3261173061117
numNetworkReqs1657032877194328
WebpackStandard HomeuiStartup16231428233915716501936
load13821200172610614271580
domContentLoaded13821199172610614271580
domInteractive1073236041126179
firstPaint------
backgroundConnect50241892854117
firstReactRender29227583041
getState9417418730
initialActions7121325415
loadScripts1351118216429913981544
setupStore186227261361
numNetworkReqs1367217766
WebpackPower User HomeuiStartup26222253308527628853085
load15801291190817117711908
domContentLoaded15791291190817217711908
domInteractive19065556149371556
firstPaint------
backgroundConnect983331077176310
firstReactRender443298165098
getState1377424741169247
initialActions1921283417128
loadScripts15381273184615717041846
setupStore28983234883
numNetworkReqs1296226567215265
📊 Page Load Benchmark Results

Current Commit: 1d6a0d5 | Date: 11/4/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±72ms) 🟡 | historical mean value: 1.04s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 743ms (±70ms) 🟢 | historical mean value: 726ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 78ms (±12ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 72ms 1.02s 1.36s 1.27s 1.36s
domContentLoaded 743ms 70ms 707ms 1.04s 942ms 1.04s
firstPaint 78ms 12ms 60ms 180ms 92ms 180ms
firstContentfulPaint 78ms 12ms 60ms 180ms 92ms 180ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 298 Bytes (0.01%)
  • ui: 44 Bytes (0%)
  • common: 1.6 KiB (0.02%)

@metamaskbot
Copy link
Collaborator

Builds ready [3a3149f]
UI Startup Metrics (1205 ± 97 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1205105616079712431385
load103490814058910851190
domContentLoaded102890513948810771181
domInteractive201362111853
firstPaint66182118040110231137
backgroundConnect2282152547231239
firstReactRender27175582946
getState22778122745
initialActions71295817
loadScripts807668116786855954
setupStore1172231219
numNetworkReqs1367620672
BrowserifyPower User HomeuiStartup20421737325140024063251
load1067906168922712711689
domContentLoaded1059896166622312531666
domInteractive301583215683
firstPaint68112117065079951706
backgroundConnect23822728816239288
firstReactRender28244143041
getState18315621418200214
initialActions73153915
loadScripts831678139621310281396
setupStore1393161431
numNetworkReqs1427430289249302
WebpackStandard HomeuiStartup8206961229958241098
load60053899183590877
domContentLoaded59253295680582862
domInteractive161173111448
firstPaint22561875209208681
backgroundConnect241174132554
firstReactRender29176593344
getState1052031214
initialActions31213410
loadScripts58953094578579851
setupStore1052631216
numNetworkReqs1367219870
WebpackPower User HomeuiStartup12821119186421614311864
load639560942118708942
domContentLoaded623550926114674926
domInteractive231275183475
firstPaint344111861234566861
backgroundConnect60172456869245
firstReactRender26242812628
getState15010418822162188
initialActions612881128
loadScripts618547915111663915
setupStore1162671426
numNetworkReqs14965384102207384
FirefoxBrowserifyStandard HomeuiStartup14811271188012015491714
load1256108714848913241424
domContentLoaded1255108614838913241424
domInteractive1223533755128232
firstPaint------
backgroundConnect4425107155272
firstReactRender27226462739
getState74234916
initialActions41274413
loadScripts1229106514648612951368
setupStore15877121451
numNetworkReqs1266515861
BrowserifyPower User HomeuiStartup25132034340538528443405
load13731185165915315151659
domContentLoaded13731184165915315151659
domInteractive20546604164309604
firstPaint------
backgroundConnect1182829579193295
firstReactRender402963104863
getState1323725045153250
initialActions813510635
loadScripts13351159160814914781608
setupStore3791554458155
numNetworkReqs1336930581197305
WebpackStandard HomeuiStartup15761394205513716171927
load1349120616759913931570
domContentLoaded1349120616759913921569
domInteractive1053035551113215
firstPaint------
backgroundConnect4421184244990
firstReactRender29228092943
getState84519722
initialActions41295318
loadScripts1322118616509313701516
setupStore176210251271
numNetworkReqs1367017764
WebpackPower User HomeuiStartup25562132318826627193188
load15381244177116917051771
domContentLoaded15381243177116917051771
domInteractive15043382109263382
firstPaint------
backgroundConnect992624071160240
firstReactRender39315984759
getState1468323446189234
initialActions14298241098
loadScripts14961216171817516631718
setupStore27877233477
numNetworkReqs1406126669220266
📊 Page Load Benchmark Results

Current Commit: 3a3149f | Date: 11/4/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±40ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 726ms (±37ms) 🟢 | historical mean value: 719ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±9ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 40ms 1.01s 1.34s 1.08s 1.34s
domContentLoaded 726ms 37ms 697ms 1.00s 750ms 1.00s
firstPaint 77ms 9ms 60ms 144ms 84ms 144ms
firstContentfulPaint 77ms 9ms 60ms 144ms 84ms 144ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 298 Bytes (0.01%)
  • ui: -141 Bytes (0%)
  • common: 1.6 KiB (0.02%)

@bergarces bergarces force-pushed the defi-better-polling branch from 3a3149f to b06a791 Compare November 4, 2025 11:25
@bergarces bergarces requested a review from a team as a code owner November 4, 2025 11:25
@metamaskbot
Copy link
Collaborator

metamaskbot commented Nov 4, 2025

✨ Files requiring CODEOWNER review ✨

💎 @MetaMask/metamask-assets (1 files, +1 -0)
  • 📁 ui/
    • 📁 components/
      • 📁 app/
        • 📁 assets/
          • 📁 defi-list/
            • 📄 defi-list.tsx +1 -0

cursor[bot]

This comment was marked as outdated.

@metamaskbot
Copy link
Collaborator

Builds ready [e493f21]
UI Startup Metrics (1223 ± 98 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1223107216699812731399
load104791213838410871191
domContentLoaded104190613778310811183
domInteractive211493151864
firstPaint68287129441510501187
backgroundConnect2302172627232244
firstReactRender26184962841
getState2284792937
initialActions816710828
loadScripts817673114482858954
setupStore1061931118
numNetworkReqs1367620674
BrowserifyPower User HomeuiStartup18831609285336419542853
load955813156621111091566
domContentLoaded948805155721011001557
domInteractive291480245580
firstPaint79418715803639431580
backgroundConnect19417323217208232
firstReactRender26233532735
getState17914822027207220
initialActions62113811
loadScripts76562813441999131344
setupStore1282761327
numNetworkReqs1187125173232251
WebpackStandard HomeuiStartup8227011166948271079
load60055889179588847
domContentLoaded59355387275581813
domInteractive15115081337
firstPaint18859874185196743
backgroundConnect241176133055
firstReactRender29176393352
getState1163141218
initialActions40365410
loadScripts58955186173578803
setupStore1154251220
numNetworkReqs1367619871
WebpackPower User HomeuiStartup13501155192026217041920
load65056610971307201097
domContentLoaded628555970102678970
domInteractive231354154654
firstPaint34664973282595973
backgroundConnect571019468121194
firstReactRender26242912729
getState14710118621157186
initialActions110138334138
loadScripts62455395999668959
setupStore16692212492
numNetworkReqs1126923360166233
FirefoxBrowserifyStandard HomeuiStartup15131276199912915821769
load1274110314708513341433
domContentLoaded1273110314708513341433
domInteractive1213342457127236
firstPaint------
backgroundConnect4626215265192
firstReactRender27224652841
getState10421122719
initialActions41263411
loadScripts1247108514398313081396
setupStore197218321350
numNetworkReqs1266215758
BrowserifyPower User HomeuiStartup24562110288822427242888
load14051134196020015991960
domContentLoaded14051133196020015991960
domInteractive21482598166322598
firstPaint------
backgroundConnect823117646127176
firstReactRender39295684756
getState12610414912134149
initialActions15194251694
loadScripts13771113192319915751923
setupStore37699316599
numNetworkReqs1286720759190207
WebpackStandard HomeuiStartup16551433239718116662193
load14041195190411314451611
domContentLoaded14041195190311314451610
domInteractive1023126436116159
firstPaint------
backgroundConnect54262974154116
firstReactRender3022146133041
getState94569839
initialActions7119221426
loadScripts13711176175210114201569
setupStore177223301336
numNetworkReqs1366817765
WebpackPower User HomeuiStartup26522359315927429413159
load16141414191815517881918
domContentLoaded16141414191815517881918
domInteractive17045533142289533
firstPaint------
backgroundConnect1054236880141368
firstReactRender46321142445114
getState1306532456129324
initialActions712471024
loadScripts15721387187615417591876
setupStore23674192474
numNetworkReqs1295927574204275
📊 Page Load Benchmark Results

Current Commit: e493f21 | Date: 11/4/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±38ms) 🟡 | historical mean value: 1.03s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 717ms (±35ms) 🟢 | historical mean value: 719ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±10ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 38ms 1.00s 1.31s 1.05s 1.31s
domContentLoaded 717ms 35ms 697ms 981ms 732ms 981ms
firstPaint 76ms 10ms 60ms 160ms 88ms 160ms
firstContentfulPaint 76ms 10ms 60ms 160ms 88ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 298 Bytes (0.01%)
  • ui: -52 Bytes (0%)
  • common: 1.6 KiB (0.02%)

marketValue: formatCurrencyWithMinThreshold(marketValue, 'USD'),
chainId: chainId as Hex,
iconGroup,
tokenFiatAmount: marketValue,
Copy link
Contributor Author

@bergarces bergarces Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sorting by value wasn't working, since it relied on this field to be present.

);

return useExternalServices && featureFlagForDeFi;
return completedOnboarding && useExternalServices && featureFlagForDeFi;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that it does not start polling on keyring unlock (which occurs before onboarding is finished), this is technically speaking not necessary.

Still, better to have it just in case, since we should never poll defi until onboarding is completed (this state does not exist in mobile though).

@bergarces bergarces changed the title chore: update assets-controllers feat: DeFiPositionsController package changes Nov 4, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [fd46bbe]
UI Startup Metrics (1209 ± 79 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1209107315407912521355
load102991613747410711145
domContentLoaded102491113657310661138
domInteractive2313209231861
firstPaint59967139440510201112
backgroundConnect2282152577232241
firstReactRender27185573143
getState23873112740
initialActions61638719
loadScripts801693112370843920
setupStore1263451423
numNetworkReqs1367619670
BrowserifyPower User HomeuiStartup20231807265629924012656
load1046912143118112401431
domContentLoaded1037904141718112311417
domInteractive281665184965
firstPaint80324414373819661437
backgroundConnect23822526511240265
firstReactRender28253122931
getState18416220414199204
initialActions53112611
loadScripts810675118717910021187
setupStore161053111353
numNetworkReqs1187025873215258
WebpackStandard HomeuiStartup8236961336968281044
load602550108889596831
domContentLoaded595546107084590804
domInteractive161274101541
firstPaint206591074216206760
backgroundConnect251262123149
firstReactRender28186283337
getState1152731216
initialActions3022358
loadScripts591544105982588794
setupStore1143641217
numNetworkReqs1367219870
WebpackPower User HomeuiStartup13191156171419315361714
load653571919104700919
domContentLoaded63856788498687884
domInteractive221352143952
firstPaint29784865252578865
backgroundConnect42102325454232
firstReactRender27243632836
getState14910717418159174
initialActions319359
loadScripts63356587495676874
setupStore1463192531
numNetworkReqs1046720549167205
FirefoxBrowserifyStandard HomeuiStartup14431276189612515041728
load1221108914507712771383
domContentLoaded1221108914507712771382
domInteractive1163433755118243
firstPaint------
backgroundConnect4325133184983
firstReactRender25214342639
getState8417717716
initialActions41394310
loadScripts1196107314067612531361
setupStore166208291239
numNetworkReqs1266614753
BrowserifyPower User HomeuiStartup24842092372438627163724
load14371250183720516551837
domContentLoaded14371250183720516551837
domInteractive234101678189432678
firstPaint------
backgroundConnect993439893175398
firstReactRender40335684856
getState1369021031146210
initialActions2211383818138
loadScripts14041227181120516161811
setupStore3161463643146
numNetworkReqs1256431373204313
WebpackStandard HomeuiStartup15191367211913615351829
load1294115315478713311503
domContentLoaded1294115315478713311503
domInteractive953134044109160
firstPaint------
backgroundConnect44191222249101
firstReactRender282173102861
getState9317618730
initialActions41315316
loadScripts1265113815057813001432
setupStore186262321272
numNetworkReqs1367117764
WebpackPower User HomeuiStartup25702257341630625883416
load15431345187315916981873
domContentLoaded15421344187315916981873
domInteractive15641449124275449
firstPaint------
backgroundConnect862727465123274
firstReactRender43326185061
getState1487727855196278
initialActions17164192564
loadScripts15011224176915616601769
setupStore3761804343180
numNetworkReqs1306226569199265
📊 Page Load Benchmark Results

Current Commit: fd46bbe | Date: 11/4/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±40ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 724ms (±37ms) 🟢 | historical mean value: 718ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±15ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 40ms 1.01s 1.34s 1.08s 1.34s
domContentLoaded 724ms 37ms 698ms 998ms 757ms 998ms
firstPaint 77ms 15ms 56ms 208ms 88ms 208ms
firstContentfulPaint 77ms 15ms 56ms 208ms 88ms 208ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 298 Bytes (0.01%)
  • ui: -123 Bytes (0%)
  • common: 1.6 KiB (0.02%)

@metamaskbot
Copy link
Collaborator

Builds ready [55af115]
UI Startup Metrics (1205 ± 84 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1205107614378412551379
load102892012637810781194
domContentLoaded102191512567710651176
domInteractive211482131851
firstPaint62385123141710261167
backgroundConnect23121829311236250
firstReactRender29174583543
getState2174072636
initialActions61436720
loadScripts797673102176843939
setupStore1162941318
numNetworkReqs1367620674
BrowserifyPower User HomeuiStartup19401751253926720222539
load1015896140617612081406
domContentLoaded1006889140017212011400
domInteractive291576214876
firstPaint72121713653859421365
backgroundConnect23222026912236269
firstReactRender28243632936
getState18015720114193201
initialActions63174817
loadScripts78366911801689691180
setupStore1191521215
numNetworkReqs1187324570231245
WebpackStandard HomeuiStartup8397001191888401068
load61255695080604846
domContentLoaded60455193376598830
domInteractive16125191439
firstPaint21757943212191790
backgroundConnect261281152560
firstReactRender29185983437
getState1152941217
initialActions3023357
loadScripts60154992373595818
setupStore1153741316
numNetworkReqs1367419870
WebpackPower User HomeuiStartup13781191198028617841980
load677595946125801946
domContentLoaded655578893110765893
domInteractive241459174659
firstPaint24376605152304605
backgroundConnect691924480170244
firstReactRender28263322933
getState15211816617163166
initialActions31174317
loadScripts650576882106753882
setupStore106337933
numNetworkReqs1136923465218234
FirefoxBrowserifyStandard HomeuiStartup15781333208914616451882
load13251140162610213921539
domContentLoaded13251139162510213921539
domInteractive1243533358137299
firstPaint------
backgroundConnect55251782759111
firstReactRender28224242938
getState10418218822
initialActions62879616
loadScripts1292112116059913491482
setupStore198212281634
numNetworkReqs1266616759
BrowserifyPower User HomeuiStartup25532236355732527923557
load14421236183218415911832
domContentLoaded14411235183118315911831
domInteractive24052662210451662
firstPaint------
backgroundConnect1204832887142328
firstReactRender41316394963
getState1438727241145272
initialActions12162171162
loadScripts13981186181219415511812
setupStore3981313979131
numNetworkReqs1316930972198309
WebpackStandard HomeuiStartup16441459219113817141940
load13991200172811414891610
domContentLoaded13991200172711414891610
domInteractive1093336754118241
firstPaint------
backgroundConnect5226144236291
firstReactRender3123125133058
getState84697819
initialActions41415413
loadScripts13671183170011014621546
setupStore176211241364
numNetworkReqs1366916761
WebpackPower User HomeuiStartup26062198305427929023054
load15981332195519617801955
domContentLoaded15981332195419617801954
domInteractive18148456140381456
firstPaint------
backgroundConnect792817747125177
firstReactRender38315684756
getState1357629954149299
initialActions1116716967
loadScripts15631304190318917451903
setupStore31799276199
numNetworkReqs1326826675229266
📊 Page Load Benchmark Results

Current Commit: 55af115 | Date: 11/4/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±38ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 723ms (±36ms) 🟢 | historical mean value: 717ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±13ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 38ms 1.01s 1.32s 1.07s 1.32s
domContentLoaded 723ms 36ms 700ms 989ms 747ms 989ms
firstPaint 77ms 13ms 60ms 192ms 84ms 192ms
firstContentfulPaint 77ms 13ms 60ms 192ms 84ms 192ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 298 Bytes (0.01%)
  • ui: -123 Bytes (0%)
  • common: 1.6 KiB (0.02%)

@metamaskbot
Copy link
Collaborator

Builds ready [3c6ffc8]
UI Startup Metrics (1246 ± 90 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1246106615269012961392
load106992013118011231204
domContentLoaded106491712927911141199
domInteractive221472132064
firstPaint60577132643310541181
backgroundConnect2332172548237249
firstReactRender26184562742
getState21669112344
initialActions819412828
loadScripts837698105577891969
setupStore1152441220
numNetworkReqs1367620673
BrowserifyPower User HomeuiStartup20901847297236024892972
load1085943154420213591544
domContentLoaded1076937152719813521527
domInteractive311786215486
firstPaint797166155845510151558
backgroundConnect24222826410248264
firstReactRender30275873058
getState17616120811176208
initialActions437157
loadScripts842708127419211181274
setupStore1393261232
numNetworkReqs1207625173238251
WebpackStandard HomeuiStartup8297061130868341067
load60355889874595846
domContentLoaded59655388670588816
domInteractive16115181435
firstPaint19458856205174791
backgroundConnect241273132456
firstReactRender291786113437
getState1161731215
initialActions40133411
loadScripts59354987568585804
setupStore1162941317
numNetworkReqs1367419770
WebpackPower User HomeuiStartup13121122189527315711895
load653555993147741993
domContentLoaded630543954127698954
domInteractive241369193569
firstPaint32468959240559959
backgroundConnect631023778159237
firstReactRender25242712627
getState14610216118157161
initialActions30154315
loadScripts626541941124687941
setupStore1263491534
numNetworkReqs1127122558166225
FirefoxBrowserifyStandard HomeuiStartup14921261193310715581688
load1269108714628313261392
domContentLoaded1269108614618413261391
domInteractive1153428243128210
firstPaint------
backgroundConnect4426169215189
firstReactRender26225962741
getState74425718
initialActions42132412
loadScripts1241107114398113001360
setupStore157211221333
numNetworkReqs1266415754
BrowserifyPower User HomeuiStartup24632054305233528533052
load14071161190823715791908
domContentLoaded14061161190823715791908
domInteractive17387521128181521
firstPaint------
backgroundConnect13650422110198422
firstReactRender34294753447
getState1208329750113297
initialActions11151151251
loadScripts13651129185323515351853
setupStore27770194270
numNetworkReqs1337031180187311
WebpackStandard HomeuiStartup15991395216814416361904
load1356120215949414121570
domContentLoaded1356120215949414111570
domInteractive973032839107174
firstPaint------
backgroundConnect51221512754120
firstReactRender29227882945
getState849410715
initialActions51347325
loadScripts1323118415138513791491
setupStore166103161452
numNetworkReqs1366917764
WebpackPower User HomeuiStartup25212191333131427673331
load14751260180915515991809
domContentLoaded14751260180815515981808
domInteractive15654398112268398
firstPaint------
backgroundConnect803025555109255
firstReactRender453275125675
getState1308119429141194
initialActions12171161371
loadScripts14441242178415115661784
setupStore4551774987177
numNetworkReqs1265830186231301
📊 Page Load Benchmark Results

Current Commit: 3c6ffc8 | Date: 11/4/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.07s (±73ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 751ms (±70ms) 🟢 | historical mean value: 718ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 80ms (±11ms) 🟢 | historical mean value: 77ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.07s 73ms 1.03s 1.36s 1.30s 1.36s
domContentLoaded 751ms 70ms 713ms 1.04s 970ms 1.04s
firstPaint 80ms 11ms 60ms 176ms 88ms 176ms
firstContentfulPaint 80ms 11ms 60ms 176ms 88ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 298 Bytes (0.01%)
  • ui: 168 Bytes (0%)
  • common: 1.62 KiB (0.02%)

@bergarces bergarces added this pull request to the merge queue Nov 5, 2025
Merged via the queue into main with commit fd089a1 Nov 5, 2025
173 checks passed
@bergarces bergarces deleted the defi-better-polling branch November 5, 2025 09:58
@github-actions github-actions bot locked and limited conversation to collaborators Nov 5, 2025
@metamaskbot metamaskbot added the release-13.9.0 Issue or pull request that will be included in release 13.9.0 label Nov 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.9.0 Issue or pull request that will be included in release 13.9.0 size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants