-
Notifications
You must be signed in to change notification settings - Fork 438
✨ Add new calldata optimal execution mode for ERC7821 #1485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Add new calldata optimal execution mode for ERC7821 #1485
Conversation
|
@legion2002 bounds checks for |
|
i’ll work on this after i wake up. brb sleep now. |
|
@howydev @legion2002 @atarpara Upon further thinking, this is actually more non-trivial than expected. First, We expect that users who require checks use The reason why If we want to put this on Maybe can do this just on the Orchestrator, if all the intents will be done via the Orchestrator. I'm currently thinking if this is actually worth the effort. There is some overhead in detecting a compact representation, and re-encoding it. I'm thinking of simply |
|
@Vectorized @atarpara I have now updated the PR to remove the We could also do RLE encoding, but I think it won't have that big of a gas improvement, because 0 bytes are already priced 1/4th the value of non zero bytes. |
|
@legion2002 I think i'll make a vendor subdirectory for ithaca for to unblock, without needing to change ERC7821. Else other vendors will need to update their ERC7821 related stuff. Note: ERC7821 allows I'll go make a writeup on how EIP8022 could be made into a precompile. Ideally, we can braindead RLE everything. |
25af3d1
into
Vectorized:opt-7821-call-mode
* feat: add new commonTo execution mode, for calldata optimization * feat: add address(0) replacement to new execution mode * chore: use memory-safe-assembly tag * chore: natspec * fix: clean to address, before checking if it is 0 * feat: replace commonTo mode with calldata optimal mode * chore: replace datas with dataArr
* ✨ Add new calldata optimal execution mode for ERC7821 (#1485) * feat: add new commonTo execution mode, for calldata optimization * feat: add address(0) replacement to new execution mode * chore: use memory-safe-assembly tag * chore: natspec * fix: clean to address, before checking if it is 0 * feat: replace commonTo mode with calldata optimal mode * chore: replace datas with dataArr * Refactor, fix ci * Fix ci * Fix _get * Remove debug emits * Update foundry.toml * Add corrupted calldata test --------- Co-authored-by: Tanishk Goyal <[email protected]>
Description
The PR adds a new calldata optimized execution mode to ERC7821 which allows you to batch calls to the same target address, without sending the redundant "to" variable in each call.
It also removes the value field, and assumes it will be 0 for all the calls. This is usually true for most DeFi batches, because everything uses WETH.
Even if the
address(0)optimization is used in calldata, for each call there is still a 4 gas overhead.With this PR, you can compress the calldata down to the theoretical optimal, this is specially useful when you want to do highly optimized self calls.
Note: The
address(0)replacement is still available with the commontofield passed.Checklist
Ensure you completed all of the steps below before submitting your pull request:
forge fmt?forge test?Pull requests with an incomplete checklist will be thrown out.