Assets 3365 perf optimise multicall client to calculate address specific data once - #9425
Merged
salimtb merged 6 commits intoJul 8, 2026
Conversation
…allClient Cache encodeBalanceOf and encodeGetEthBalance per account address to avoid redundant ABI encoding when batching many tokens for the same wallet.
Prithpal-Sooriya
previously approved these changes
Jul 8, 2026
Prithpal-Sooriya
approved these changes
Jul 8, 2026
salimtb
deleted the
ASSETS-3365-perf-optimise-multicall-client-to-calculate-address-specific-data-once
branch
July 8, 2026 13:59
pull Bot
pushed a commit
to dmrazzy/core
that referenced
this pull request
Jul 9, 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? --> ## [Asset Controller 10.2.0] ### Added - Add Robinhood Chain (`4663`/`0x1237`) in `MulticallClient` ([MetaMask#9443](MetaMask#9443)) ### Changed - `MulticallClient` memoizes `balanceOf` and `getEthBalance` call encodings per account address when building multicall batches, reducing redundant ABI encoding for wallets with many tokens ([MetaMask#9425](MetaMask#9425)) - Bump `@metamask/transaction-controller` from `^68.2.2` to `^68.3.0` ([MetaMask#9421](MetaMask#9421)) - Bump `@metamask/keyring-api` from `^23.3.0` to `^23.5.0` ([MetaMask#9390](MetaMask#9390)) - Bump `@metamask/keyring-snap-client` from `^9.0.2` to `^9.2.0` ([MetaMask#9390](MetaMask#9390)) - Bump `@metamask/account-tree-controller` from `^7.5.3` to `^7.5.4` ([MetaMask#9429](MetaMask#9429)) - Bump `@metamask/assets-controllers` from `^109.3.0` to `^109.3.1` ([MetaMask#9429](MetaMask#9429)) - Bump `@metamask/assets-controllers` from `^109.3.0` to `^109.4.0` ([MetaMask#9429](MetaMask#9429), [MetaMask#9450](MetaMask#9450)) ## [Assets-Controllers 109.4.0] ### Added - Add Robinhood Chain (`4663`/`0x1237`) entries in `multicall.ts` and `codefi-v2.ts` ([MetaMask#9443](MetaMask#9443)) ## 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 changelog/lockfile coordination only; functional changes are additive chain support and multicall encoding optimizations described in prior PRs. > > **Overview** > Cuts **monorepo release `1109.0.0`** by bumping published package versions and aligning dependent packages and `yarn.lock`. > > **`@metamask/assets-controller` `10.2.0`** documents Robinhood Chain (`4663`/`0x1237`) support in `MulticallClient`, memoized `balanceOf` / `getEthBalance` encodings in multicall batches, and several dependency bumps (including `@metamask/assets-controllers` to `^109.4.0`). > > **`@metamask/assets-controllers` `109.4.0`** documents Robinhood Chain entries in `multicall.ts` and `codefi-v2.ts`. > > **`bridge-controller`** and **`transaction-pay-controller`** update their `package.json` dependencies to `@metamask/assets-controller` `^10.2.0` and `@metamask/assets-controllers` `^109.4.0`, with matching changelog notes. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c721375. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
Low Risk
Pure encoding memoization with unchanged multicall targets and calldata semantics; covered by existing and new unit tests.
Overview
MulticallClientnow caches ABI-encodedbalanceOfandgetEthBalancecalldata per account address (case-normalized), because that payload only depends on the account, not the token contract target.Batch
aggregate3construction moves intobuildAggregate3BalanceCalls, which pulls cached encodings instead of re-encoding for every token row. The single-call ERC-20 fallback path uses the same cache.A test asserts
encodeFunctionDataruns once per distinct account for each method type in a batch, and that counts stay flat on a second batch with the same accounts (cache reuse). Changelog updated under Unreleased.Reviewed by Cursor Bugbot for commit fe4349a. Bugbot is set up for automated code reviews on this repo. Configure here.