feat: introduce lightweighted multicall for the same target#79
Open
krboktv wants to merge 9 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces two new lightweight multicall functions optimized for single-target batch calls with packed return values. The changes add gas-efficient alternatives to the existing multicall functions by encoding results into packed 256-bit words containing success status, out-of-range flags, gas usage, and return values.
Changes:
- Adds
multicallOneTargetPacked()for batching multiple calls to the same target with compact result encoding - Adds
multicallOneTargetPackedPatchable()for efficient batching where one base calldata can be reused with different patch values - Includes comprehensive test suite with JavaScript encoding/decoding helpers
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| contracts/MultiCall.sol | Adds two new multicall functions implemented in Yul assembly for gas efficiency |
| contracts/mocks/MultiCallTestTarget.sol | Test target contract providing functions for testing the new multicall implementations |
| test/multicall/utils.js | Utility functions for hex/bytes conversion used by test helpers |
| test/multicall/one-target-multicall.js | JavaScript helper classes for encoding/decoding multicallOneTargetPacked calls |
| test/multicall/patchable-multicall.js | JavaScript helper classes for encoding/decoding multicallOneTargetPackedPatchable calls |
| test/multicall/MultiCall.js | Comprehensive test suite covering both new multicall functions and existing multicallWithGas |
| test/EvmHelpers.js | Removed placeholder test file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@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.
Change Summary
What does this PR change?
Testing & Verification
How was this tested?
Risk Assessment
Risk Level:
Risks & Impact