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

chore(cherry-pick): fix erc20 token balances showing 0 #29365

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

bergeron
Copy link
Contributor

cherry picks #29361 to v12.9.3

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](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29361?quickstart=1)

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.

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

<!-- [screenshots/recordings] -->

<!-- [screenshots/recordings] -->

- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] 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](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

- [ ] 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 bergeron requested a review from a team as a code owner December 19, 2024 20:51
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 bergeron changed the title fix: erc20 token balances showing 0 (#29361) chore(chery-pick: fix erc20 token balances showing 0 Dec 19, 2024
@bergeron bergeron changed the title chore(chery-pick: fix erc20 token balances showing 0 chore(chery-pick: fix) erc20 token balances showing 0 Dec 19, 2024
@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Dec 19, 2024
@bergeron bergeron changed the title chore(chery-pick: fix) erc20 token balances showing 0 chore(chery-pick): fix erc20 token balances showing 0 Dec 19, 2024
@bergeron bergeron changed the title chore(chery-pick): fix erc20 token balances showing 0 chore(cherry-pick): fix erc20 token balances showing 0 Dec 19, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [653b95d]
Page Load Metrics (2033 ± 119 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint30224251914414199
domContentLoaded163126661994245118
load168127592033249119
domInteractive268244157
backgroundConnect9193404320
firstReactRender1983432412
getState66020189
initialActions01000
loadScripts113720331478210101
setupStore66120199
uiStartup186631042305283136

@danjm danjm merged commit 46562e0 into Version-v12.9.3 Dec 19, 2024
81 of 83 checks passed
@danjm danjm deleted the brian/cherry-pick-0-balance branch December 19, 2024 22:34
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
INVALID-PR-TEMPLATE PR's body doesn't match template team-assets
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants