Skip to content
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

fix: erc20 token balances showing 0 #29361

Merged
merged 7 commits into from
Dec 19, 2024
Merged

fix: erc20 token balances showing 0 #29361

merged 7 commits into from
Dec 19, 2024

Conversation

bergeron
Copy link
Contributor

@bergeron bergeron commented Dec 19, 2024

Description

Fixes an issue where erc20 token balances were incorrectly showing 0. On the repro we have, we noticed a token in state with address 0x0000000000000000000000000000000000000000 on mainnet, which is not a valid erc20 token. This caused the multicall to revert, preventing other balances from updating.

There's a fix in the controller here: MetaMask/core#5083 which will fall back to parallel balanceOf calls if the multicall reverts.

And we're also doing a migration here to remove zero address tokens on mainnet.

Open in GitHub Codespaces

Related issues

Manual testing steps

The current version of the wallet should not allow importing an invalid erc20 address through any mechanism, so not easy to reproduce naturally.

The migration can be tested by checking out an older version like git checkout v12.9.0 , upgrading to this branch, verifying the migration ran in background logs, and that your tokens remain.

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.

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.

@bergeron
Copy link
Contributor Author

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

No policy changes

@metamaskbot
Copy link
Collaborator

Builds ready [5f01845]
Page Load Metrics (1806 ± 57 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint30021221731351168
domContentLoaded15822101177512761
load16302123180611857
domInteractive269141189
backgroundConnect988342110
firstReactRender1877392210
getState55312105
initialActions01000
loadScripts11291589131711455
setupStore66217189
uiStartup18262423205614168

@bergeron bergeron added this pull request to the merge queue Dec 19, 2024
Merged via the queue into main with commit 021a265 Dec 19, 2024
77 checks passed
@bergeron bergeron deleted the brian/empty-token-balances branch December 19, 2024 20:43
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2024
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants