metamask-extension icon indicating copy to clipboard operation
metamask-extension copied to clipboard

fix: reduce size of token list fetch

Open bergeron opened this issue 10 months ago • 3 comments

Description

When switching to a network for the first time, MM checks whether a token list is available for the network. If not, the 3rd item is shown here:

Screenshot 2024-04-30 at 10 29 29 AM

But we don't need the entire token list, since we're only checking whether a list is available. Adding query parameters to reduce the response size. On mainnet for example, 1.5MB (gzipped) to < 1KB.

Open in GitHub Codespaces

Related issues

Manual testing steps

  1. Open metamask
  2. Visit a chain that has token lists, like linea
  3. The popup should not warn about missing tokens
  4. Visit a chain that does not have token lists, like filecoin
  5. The popup should warn about missing tokens

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • [ ] I’ve followed MetaMask Coding Standards.
  • [ ] I've completed the PR template to the best of my ability
  • [ ] I’ve included tests if applicable
  • [ ] I’ve documented my code using JSDoc format if applicable
  • [ ] I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.

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.

bergeron avatar Apr 30 '24 18:04 bergeron

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.

github-actions[bot] avatar Apr 30 '24 18:04 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.34%. Comparing base (44e29aa) to head (acc46e3).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #24316   +/-   ##
========================================
  Coverage    67.34%   67.34%           
========================================
  Files         1282     1282           
  Lines        50065    50065           
  Branches     12986    12986           
========================================
  Hits         33716    33716           
  Misses       16349    16349           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 06 '24 15:05 codecov[bot]

Hmmm the e2e tests failing in CI are passing locally

bergeron avatar May 06 '24 19:05 bergeron

I'm confused by the e2e test failures. They keep passing locally in both browsers, and should be unrelated to the changes.

  • Success on testcase: 'Wallet Created Events @no-mmi are not sent when onboarding user who chooses to opt out metrics'
  • Success on testcase: 'Connections page should disconnect when click on Disconnect button in connections page'
  • Success on testcase: 'Permissions Page should redirect users to connections page when users click on connected permission'
  • ...etc

But not in CI for some reason?

bergeron avatar May 15 '24 21:05 bergeron

Builds ready [da392d5]
Page Load Metrics (1229 ± 614 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint711771032914
domContentLoaded106021157
load58291012291278614
domInteractive106021157
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 46 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

metamaskbot avatar May 16 '24 15:05 metamaskbot