WIP: Incoporate learnings into a new iteration of AllowanceHolder#246
Draft
WIP: Incoporate learnings into a new iteration of AllowanceHolder#246
Conversation
…ons prettier in block explorers
…Cancun and non-Cancun versions)
Closed
4c54af8 to
1444d8c
Compare
…is omitted if there is no selector
e1Ru1o
reviewed
Aug 5, 2025
| assembly ("memory-safe") { | ||
| testData := mload(0x40) | ||
| mstore(add(0x24, testData), target) | ||
| mstore(add(0x10, testData), 0x70a08231000000000000000000000000) |
Contributor
There was a problem hiding this comment.
maybe add the comment we always have mentioning the padding
e1Ru1o
reviewed
Aug 5, 2025
| mstore(add(0x24, testData), target) | ||
| mstore(add(0x10, testData), 0x70a08231000000000000000000000000) | ||
| mstore(testData, 0x24) | ||
| mstore(0x40, add(0x60, testData)) |
Contributor
There was a problem hiding this comment.
Are you doing 0x60 to keep the memory alignment?
e1Ru1o
reviewed
Aug 5, 2025
Comment on lines
+210
to
+216
| // Pad `returndata` to a multiple of 32 bytes. | ||
| let len := mload(result) | ||
| let m := and(0x1f, len) | ||
| if m { | ||
| mstore(add(add(0x20, result), len), 0x00) | ||
| len := add(sub(0x20, m), len) | ||
| } |
Contributor
There was a problem hiding this comment.
what made you add this padding here?
e1Ru1o
reviewed
Aug 5, 2025
| target := calldataload(add(0x04, data.offset)) | ||
| // `shl(0x08, data.length)` can't overflow because we're going to | ||
| // `calldatacopy(..., data.length)` later. It would OOG. | ||
| let mask := shr(shl(0x08, sub(data.length, 0x04)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) |
Contributor
There was a problem hiding this comment.
Shouldn't this be mul? or shr(0x03, ...)
Suggested change
| let mask := shr(shl(0x08, sub(data.length, 0x04)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) | |
| let mask := shr(mul(0x08, sub(data.length, 0x04)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) |
Collaborator
Author
There was a problem hiding this comment.
Yeah it should be shl(0x03, ...)
e1Ru1o
reviewed
Aug 5, 2025
Comment on lines
+51
to
+56
| // We apply the "all but one 64th" rule three times because `target` could | ||
| // plausibly be a proxy. We apply it only three times because we assume only | ||
| // two levels of indirection. | ||
| let remainingGas := shr(0x06, beforeGas) | ||
| remainingGas := add(remainingGas, shr(0x06, sub(beforeGas, remainingGas))) | ||
| remainingGas := add(remainingGas, shr(0x06, sub(beforeGas, remainingGas))) |
Contributor
There was a problem hiding this comment.
The two levels of indirection will be what? a beacon proxy? So there are 3 calls, this => proxy, proxy => beacon, proxy => implementation? Anything else?
b8e3001 to
af9b948
Compare
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.
No description provided.