Skip to content

Assets 3365 perf optimise multicall client to calculate address specific data once - #9425

Merged
salimtb merged 6 commits into
mainfrom
ASSETS-3365-perf-optimise-multicall-client-to-calculate-address-specific-data-once
Jul 8, 2026
Merged

salimtb merged 6 commits into
mainfrom
ASSETS-3365-perf-optimise-multicall-client-to-calculate-address-specific-data-once

Conversation

@salimtb

@salimtb salimtb commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Explanation

References

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Pure encoding memoization with unchanged multicall targets and calldata semantics; covered by existing and new unit tests.

Overview
MulticallClient now caches ABI-encoded balanceOf and getEthBalance calldata per account address (case-normalized), because that payload only depends on the account, not the token contract target.

Batch aggregate3 construction moves into buildAggregate3BalanceCalls, 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 encodeFunctionData runs 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.

salimtb added 3 commits July 8, 2026 10:39
…allClient

Cache encodeBalanceOf and encodeGetEthBalance per account address to
avoid redundant ABI encoding when batching many tokens for the same
wallet.
@salimtb
salimtb marked this pull request as ready for review July 8, 2026 12:25
@salimtb
salimtb requested review from a team as code owners July 8, 2026 12:25
@salimtb
salimtb temporarily deployed to default-branch July 8, 2026 12:25 — with GitHub Actions Inactive
@salimtb
salimtb added this pull request to the merge queue Jul 8, 2026
Merged via the queue into main with commit d2a2f75 Jul 8, 2026
417 checks passed
@salimtb
salimtb deleted the ASSETS-3365-perf-optimise-multicall-client-to-calculate-address-specific-data-once branch July 8, 2026 13:59
@maxime-oe maxime-oe mentioned this pull request Jul 9, 2026
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants