-
Notifications
You must be signed in to change notification settings - Fork 37
WIP: Incoporate learnings into a new iteration of AllowanceHolder #246
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
base: master
Are you sure you want to change the base?
Conversation
…ons prettier in block explorers
…Cancun and non-Cancun versions)
4c54af8 to
1444d8c
Compare
…is omitted if there is no selector
| assembly ("memory-safe") { | ||
| testData := mload(0x40) | ||
| mstore(add(0x24, testData), target) | ||
| mstore(add(0x10, testData), 0x70a08231000000000000000000000000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add the comment we always have mentioning the padding
| mstore(add(0x24, testData), target) | ||
| mstore(add(0x10, testData), 0x70a08231000000000000000000000000) | ||
| mstore(testData, 0x24) | ||
| mstore(0x40, add(0x60, testData)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you doing 0x60 to keep the memory alignment?
| // 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) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what made you add this padding here?
| 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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be mul? or shr(0x03, ...)
| let mask := shr(shl(0x08, sub(data.length, 0x04)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) | |
| let mask := shr(mul(0x08, sub(data.length, 0x04)), 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it should be shl(0x03, ...)
| // 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))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The two levels of indirection will be what? a beacon proxy? So there are 3 calls, this => proxy, proxy => beacon, proxy => implementation? Anything else?
No description provided.