Skip to content

fix: always use remote token list for default petnames#23919

Merged
matthewwalsh0 merged 16 commits intodevelopfrom
fix/petnames-force-remote-token-list
Apr 11, 2024
Merged

fix: always use remote token list for default petnames#23919
matthewwalsh0 merged 16 commits intodevelopfrom
fix/petnames-force-remote-token-list

Conversation

@matthewwalsh0
Copy link
Copy Markdown
Member

@matthewwalsh0 matthewwalsh0 commented Apr 9, 2024

Description

Petnames (and by extension transaction simulations) rely on the token list to display default token names and symbols.

With the Autodetect tokens preference disabled, static data for ~600 tokens is available on mainnet and no token data is available on other chains. When enabled, data for ~4000 tokens is available on mainnet.

In order to provide the most default token names possible, this PR forces the use of the remote token list for petnames, and therefore enables token list polling if any of the following preferences are enabled:

  • Autodetect tokens (Token Detection)
  • Allow nicknames (Petnames)
  • Estimate balance changes (Transaction Simulations)

To ensure the necessary privacy control, the Allow nicknames toggle has also been added to the onboarding settings.

At the technical level, this includes:

  • Removing all TokenListController logic from the PreferencesController to keep it decoupled from individual domain.
  • Adding an equivalent listener in the MetamaskController.
  • Adding an optional forceRemote argument to the getTokenList selector.
  • Using the above argument in the useDisplayName hook.
  • Updating impacted unit and E2E tests.

Open in GitHub Codespaces

Related issues

Fixes: #2339

Manual testing steps

Remote Token List

  1. Disable Autodetect tokens.
  2. Disable Estimate balance changes.
  3. Enable Allow nicknames.
  4. Add Optimism network.
  5. Switch to Optimism network.
  6. Go to test dApp.
  7. Use send form to create transaction targeting Tether USD (0x94b008aa00579c1307b0ef2c499ad98a8ce58e58).
  8. Verify the default token name is displayed in the petnames component.
  9. Repeat with permutations of the three preferences and network.

Onboarding Setting

  1. Install fresh extension.
  2. Go to onboarding settings.
  3. Disable Allow nicknames.
  4. Verify nicknames are disabled in experimental settings.

Screenshots/Recordings

Before

Screenshot 2024-04-09 at 22 15 53

After

Screenshot 2024-04-09 at 22 12 41 Screenshot 2024-04-10 at 20 50 49

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.

@matthewwalsh0 matthewwalsh0 added the team-confirmations-system-deprecated DEPRECATED: please use "team-confirmations" instead label Apr 9, 2024
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [cf3fce5]
Page Load Metrics (1045 ± 514 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint703361176129
domContentLoaded109629199
load58237010451071514
domInteractive109629199
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 709 Bytes (0.02%)
  • ui: 28 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@matthewwalsh0 matthewwalsh0 marked this pull request as ready for review April 9, 2024 21:20
@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner April 9, 2024 21:20
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2024

Codecov Report

Attention: Patch coverage is 76.36364% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 67.52%. Comparing base (6bd3de7) to head (f9da548).

Files Patch % Lines
ui/selectors/selectors.js 35.71% 9 Missing ⚠️
app/scripts/metamask-controller.js 89.19% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #23919      +/-   ##
===========================================
+ Coverage    67.47%   67.52%   +0.05%     
===========================================
  Files         1244     1244              
  Lines        48777    48830      +53     
  Branches     12724    12741      +17     
===========================================
+ Hits         32910    32972      +62     
+ Misses       15867    15858       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [58e1387]
Page Load Metrics (766 ± 451 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint662101043416
domContentLoaded95523115
load532165766940451
domInteractive95523115
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 709 Bytes (0.02%)
  • ui: 3 Bytes (0.00%)
  • common: 25 Bytes (0.00%)

cryptotavares
cryptotavares previously approved these changes Apr 10, 2024
vinistevam
vinistevam previously approved these changes Apr 10, 2024
@sleepytanya
Copy link
Copy Markdown
Contributor

sleepytanya commented Apr 10, 2024

Token names are displayed when any of the following toggles enabled and not visible when all three toggles are off:

  • Autodetect tokens (Security and Privacy)
  • Allow nicknames (Experimental)
  • Estimate balance changes (Security and Privacy)
tokenNames.mov

@matthewwalsh0 matthewwalsh0 dismissed stale reviews from vinistevam and cryptotavares via 374da8f April 10, 2024 19:48
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [94bab65]
Page Load Metrics (886 ± 469 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint561981253617
domContentLoaded86927147
load452328886976469
domInteractive86927147
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 709 Bytes (0.02%)
  • ui: 239 Bytes (0.00%)
  • common: 25 Bytes (0.00%)

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [f9da548]
Page Load Metrics (893 ± 527 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint711541052311
domContentLoaded106224126
load5925318931098527
domInteractive106224126
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 709 Bytes (0.02%)
  • ui: 239 Bytes (0.00%)
  • common: 25 Bytes (0.00%)

@sleepytanya
Copy link
Copy Markdown
Contributor

New toggle in the onboarding settings:

Chrome

onboardingToggle.mov

Firefox

onboardingFF.mov

@matthewwalsh0 matthewwalsh0 merged commit 324b55b into develop Apr 11, 2024
@matthewwalsh0 matthewwalsh0 deleted the fix/petnames-force-remote-token-list branch April 11, 2024 15:46
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2024
@metamaskbot metamaskbot added the release-11.15.0 Issue or pull request that will be included in release 11.15.0 label Apr 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed release-11.15.0 Issue or pull request that will be included in release 11.15.0 team-confirmations-system-deprecated DEPRECATED: please use "team-confirmations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants