account/paymaster gas optimization#250
Closed
gonzaotc wants to merge 1 commit into
Closed
Conversation
…encodePacked (-230/op, -12,343 deploy) Co-Authored-By: Claude Opus 4.8 (1M context) <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.
Note
AI-generated with the Solidity Gas Optimizer skill. Findings were measured as positive gains and all tests still pass, but it's encouraged to review before merging to confirm behavior is unaffected.
Run
handleOpsgasUsed probe over an identical userOp.Results
One gas optimization candidate was found and applied, in a single commit keyed by the ID below. It's recommended to review it via the commits view.
abi.encodePackedPaymasterERC20._validatePaymasterUserOpGAS-M-01 · Build validation context in one
abi.encodePacked(PaymasterERC20._validatePaymasterUserOp)context = abi.encodePacked(userOpHash, token, tokenPrice)and builds the returned blob in a singleabi.encodePacked(userOpHash, token, tokenPrice, prefundAmount, prefunder, prefundContext)on the success path.abi.encodePackedis plain concatenation, so the old two-step form staged 84 bytes in memory then copied them again into the final blob. Encoding all six pieces once writes those bytes a single time, removing the intermediate allocation and copy on every ERC-20 sponsored operation and shrinking deploy code. The returned bytes are byte-for-byte identical and_postOp's decode offsets (0x00 hash, 0x20 token, 0x34 price, 0x54 prefundAmount, 0x74 prefunder, 0x88 prefundContext) are unchanged.bytes(""). Cherry-picks independently as its own commit.This optimization was found and measured by the Solidity Gas Optimizer skill; the commit message carries the measured deltas.