refactor: drop the external self-call in verifyBatchInclusion - #2300
Open
0xrlawrence wants to merge 1 commit into
Open
refactor: drop the external self-call in verifyBatchInclusion#23000xrlawrence wants to merge 1 commit into
0xrlawrence wants to merge 1 commit into
Conversation
The seven-argument overload delegated to the eight-argument one through this.verifyBatchInclusion(...), which leaves the contract and comes back in via a STATICCALL just to pass address(0). Move the body into an internal _verifyBatchInclusion and have both overloads call it directly. The external ABI is unchanged: both overloads are still present and still view, and onlyWhenNotPaused(2) still guards each entry point. Co-Authored-By: Claude Opus 5 <noreply@anthropic.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.
Description
The seven-argument
verifyBatchInclusionoverload delegated to the eight-argument one throughthis.verifyBatchInclusion(...). That leaves the contract and re-enters viaSTATICCALLpurely to supplyaddress(0), paying full external call overhead plus a secondonlyWhenNotPaused(2)evaluation on aviewfunction that consumers call frequently.The shared body moves into an internal
_verifyBatchInclusionand both overloads call it directly.The external ABI is unchanged — confirmed against the built artifact:
onlyWhenNotPaused(2)still guards each external entry point, so pause behaviour is identical.Type of change
Checklist
testnet, everything else tostagingNo gas benchmark included — the saving is simply one avoided external call, and
foundry-gas-diffin CI should show it directly. Happy to add one if you'd like it recorded.Verified with
forge buildonstaging.