fix: normalize balances#8982
Merged
Merged
Conversation
35fe30a to
287267d
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d9626a5. Configure here.
Contributor
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
Prithpal-Sooriya
approved these changes
Jun 3, 2026
pull Bot
pushed a commit
to Reality2byte/core
that referenced
this pull request
Jun 3, 2026
## Explanation <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Checklist - [ ] I've updated the test suite for new or updated code as appropriate - [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Version and lockfile-only release with a patch assets-controller fix; no new runtime code in this diff. > > **Overview** > This is the **1017.0.0** monorepo release cut. It bumps the root `@metamask/core-monorepo` version from `1016.0.0` to `1017.0.0` and publishes **`@metamask/assets-controller` `8.3.1`** (from `8.3.0`), with changelog documenting the patch fix for sub-`1e-7` dust balances serializing as scientific notation (e.g. `"1e-18"`) instead of plain decimals, which broke downstream `BigInt()` consumers ([MetaMask#8982](MetaMask#8982)). > > **`@metamask/bridge-controller`** and **`@metamask/transaction-pay-controller`** now depend on `@metamask/assets-controller` `^8.3.1` (was `^8.3.0`), and their unreleased changelog entries are updated accordingly. **`yarn.lock`** is refreshed for the new resolution. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c09b148. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Explanation
References
Checklist
Note
Medium Risk
Changes how all balance amounts are stored and emitted across controller, websocket, and selectors; truncation rules must stay aligned with extension parsing to avoid subtle balance display errors.
Overview
Fixes dust and tiny balances showing up as scientific-notation strings (e.g.
"1e-18") instead of plain decimals, which broke extension code that parses amounts withBigInt().Adds
normalizeAmountStringand runs it whenAssetsControllermerges balance updates: exponent form is always rewritten; whenassetsInfodecimals are known, amounts are truncated (round-down) to that precision, otherwise only the notation is fixed so early balances are not stripped.BackendWebsocketDataSourcenow usestoFixed()instead oftoString()on human-readable amounts, and the aggregated balance selector emitstoFixed()amounts for the same invariant.Reviewed by Cursor Bugbot for commit a387ed8. Bugbot is set up for automated code reviews on this repo. Configure here.