Skip to content

feat: Integrate enabled network map (functionality) #33478

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

gambinish
Copy link
Contributor

@gambinish gambinish commented Jun 4, 2025

Description

This PR integrates the enabledNetworks state from the NetworkOrderController throughout the application, effectively replacing the legacy tokenNetworkFilter. This transition impacts:

  • Asset polling logic. We should poll on chains enabled with enabledNetworkMap rather than tokenNetworkFilter

  • dApp network switching. It should enable networks just as it previously updated tokenNetworkFilter.

  • Network addition flows. When networks are added, they should be enabled, both manually through existing network picker and via dApp.

The goal is to centralize network enablement state in one place enabledNetworkMap and streamline how the app filters tokens and interacts with enabled networks. This change is foundational to supporting the new global network selector.

Next step will be to replace the NetworkFilter entirely with a new component to handle network enablement in a multi-select way.

Designs for reference

Note that this PR affected a ton of e2e tests, since many tests are reliant on aggregated balance being loaded, along with certain networks to be enabled to match the currently selected global network for certain assets to show up/filter as expected. I've added this tests separately here: #33407

☝️ I'm open to breaking this up further to differentiate between unit test and e2e test updates. I'm also happy to discuss ways to make this follow up PR more minimal.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Please test with REMOVE_GNS='true' as well as without the feature flag for regressions
  2. While REMOVE_GNS='true'
  • NetworkFilter will update enabledNetworks to only poll on networks that have been designated from NetworkFilter. This will eventually become the new network picker/enabler
  • dApps can switch networks on behalf of MetaMask. This will enable the network that was switched to in dApp
    3 While REMOVE_GNS=''
  • All existing behavior of NetworkFilter should remain (meaning that it relies on tokenNetworkFilter), however, enabledNetworkMap will also be updated
  • enabledNetworkMap should match tokenNetworkFilter and should follow same logic paths:
  1. via manual token filtering on NetworkFilter
  2. via manual network switching

Screenshots/Recordings

With REMOVE_GNS='true feature flag on:

Network Filter on MM:
https://github.com/user-attachments/assets/ce331108-c588-44bc-9677-8c50128513f1

dApp network switch:
https://github.com/user-attachments/assets/b617b527-029a-4b2f-992f-611ebe11429f

With REMOVE_GNS=''

Screen.Recording.2025-06-04.at.12.05.42.PM.mov

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.

@gambinish gambinish requested review from a team as code owners June 4, 2025 18:26
Copy link
Contributor

github-actions bot commented Jun 4, 2025

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.

@metamaskbot
Copy link
Collaborator

metamaskbot commented Jun 4, 2025

✨ Files requiring CODEOWNER review ✨

💎 @MetaMask/metamask-assets (4 files, +45 -22)
  • 📁 ui/
    • 📁 components/
      • 📁 app/
        • 📁 assets/
          • 📁 asset-list/
            • 📁 asset-list-control-bar/
              • 📄 asset-list-control-bar.tsx +10 -15
            • 📁 network-filter/
              • 📄 network-filter.tsx +18 -3
          • 📁 defi-list/
            • 📄 defi-list.tsx +8 -2
          • 📁 token-list/
            • 📄 token-list.tsx +9 -2

🖥️ @MetaMask/wallet-ux (2 files, +15 -1)
  • 📁 ui/
    • 📁 components/
      • 📁 multichain/
        • 📁 import-tokens-modal/
          • 📄 import-tokens-modal.js +6 -1
        • 📁 network-list-menu/
          • 📄 network-list-menu.tsx +9 -0

@gambinish gambinish changed the title feat: Integrate enabled network map functionality feat: Integrate enabled network map (functionality) Jun 4, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [06212ea]
UI Startup Metrics (1241 ± 69 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1241112414646912761416
load107897112896311121211
domContentLoaded107195812606311031206
domInteractive17133741628
firstPaint76285125842410941145
backgroundConnect84305824
firstReactRender20172722124
getState14691111932
initialActions001001
loadScripts81971499761854959
setupStore75151811
WebpackHomeuiStartup21561653274425123342589
load16691306206018817931962
domContentLoaded16621302204918617891947
domInteractive161166121351
firstPaint1656464972203266
backgroundConnect251063123057
firstReactRender16144371115305357
getState13498131342
initialActions612992936
loadScripts16591300203718417871944
setupStore297322562255
FirefoxBrowserifyHomeuiStartup13321171177611713831572
load11891048154211012491421
domContentLoaded11891048154211012491421
domInteractive1033733849113231
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect19125772041
firstReactRender22204832327
getState85557813
initialActions001001
loadScripts11711033152110812331405
setupStore64232610
WebpackHomeuiStartup16031376219716116881947
load13951201197715014801702
domContentLoaded13951200197715014801701
domInteractive77381811881114
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect22168682332
firstReactRender41285244448
getState1053361030
initialActions002111
loadScripts13761181195514914631684
setupStore10512615828
Benchmark value 1241 exceeds gate value 1234 for chrome browserify home mean uiStartup
Benchmark value 1078 exceeds gate value 1070 for chrome browserify home mean load
Benchmark value 1071 exceeds gate value 1061 for chrome browserify home mean domContentLoaded
Benchmark value 1417 exceeds gate value 1365 for chrome browserify home p95 uiStartup
Benchmark value 1211 exceeds gate value 1190 for chrome browserify home p95 load
Benchmark value 1206 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded
Benchmark value 24 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 959 exceeds gate value 940 for chrome browserify home p95 loadScripts
Benchmark value 2589 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 231 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 1396 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1396 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 42 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 1376 exceeds gate value 1360 for firefox webpack home mean loadScripts
Benchmark value 1947 exceeds gate value 1935 for firefox webpack home p95 uiStartup
Benchmark value 1702 exceeds gate value 1660 for firefox webpack home p95 load
Benchmark value 1701 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded
Benchmark value 1684 exceeds gate value 1630 for firefox webpack home p95 loadScripts
Sum of mean exceeds: 77ms | Sum of p95 exceeds: 444ms
Sum of all benchmark exceeds: 521ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 164 Bytes (0%)
  • ui: 1.46 KiB (0.02%)
  • common: 517 Bytes (0.01%)

@metamaskbot
Copy link
Collaborator

Builds ready [548bb32]
UI Startup Metrics (1221 ± 91 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1221107818409112641345
load106394616989011081166
domContentLoaded105693516899010971160
domInteractive16134451629
firstPaint71663169843810751154
backgroundConnect84324820
firstReactRender20163842128
getState1353671925
initialActions001001
loadScripts811700143989853921
setupStore85193812
WebpackHomeuiStartup21351655259221622782458
load16571288195817417921905
domContentLoaded16511284195417317821895
domInteractive16116491341
firstPaint1677442560182294
backgroundConnect2294872438
firstReactRender14644364111277354
getState154312311329
initialActions317135
loadScripts16481282195317217751888
setupStore4273188121306
FirefoxBrowserifyHomeuiStartup13781217182810814231622
load1216108314768312651360
domContentLoaded1216108214758312651360
domInteractive993517831110159
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2414185192251
firstReactRender24213022529
getState11418926913
initialActions001001
loadScripts1195107114477912461342
setupStore9417118713
WebpackHomeuiStartup15501358205413716271800
load13431173162411414281595
domContentLoaded13431173162311414271594
domInteractive75311371882113
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect2415263252338
firstReactRender42276454448
getState12423824930
initialActions102112
loadScripts13221158160511114111572
setupStore10513418820
Benchmark value 20 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 42 exceeds gate value 32 for chrome webpack home mean setupStore
Benchmark value 2458 exceeds gate value 2454 for chrome webpack home p95 uiStartup
Benchmark value 306 exceeds gate value 65 for chrome webpack home p95 setupStore
Benchmark value 12 exceeds gate value 11 for firefox browserify home mean getState
Benchmark value 42 exceeds gate value 38 for firefox webpack home mean firstReactRender
Sum of mean exceeds: 15ms | Sum of p95 exceeds: 247ms
Sum of all benchmark exceeds: 262ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 164 Bytes (0%)
  • ui: 1.46 KiB (0.02%)
  • common: 517 Bytes (0.01%)

@gambinish gambinish added the DO-NOT-MERGE Pull requests that should not be merged label Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO-NOT-MERGE Pull requests that should not be merged team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants