-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
feat(cheatcodes
): add delegatecall
to prank
ing
#8863
Conversation
crates/cheatcodes/src/inspector.rs
Outdated
@@ -833,6 +833,19 @@ impl Cheatcodes { | |||
|
|||
// Apply our prank | |||
if let Some(prank) = &self.prank { | |||
// Apply delegate call. call.caller will not equal prank.prank_caller |
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.
Hey @zerosnacks, my understanding is a little fuzzy here. It seems in the case of a delegate call that call.caller == prank.prank_caller
will not be true. Is it suitable to have this here? Ty.
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.
cc @DaniPopes would you have more context on this?
a7e8123
to
325c218
Compare
8a65994
to
d964aad
Compare
cheatcodes
): add delegatecall
to prank
ingcheatcodes
): add delegatecall
to prank
ing
Hi @EdwardJES thanks for your PR - my apologies that it has taken a while to respond |
cheatcodes
): add delegatecall
to prank
ingcheatcodes
): add delegatecall
to prank
ing
gentle bump on this @zerosnacks, @DaniPopes . Thank you 🙏 |
@EdwardJES is there anything waiting from us to unblock the PR or can we start the review? thank you! |
@grandizzy all good to go, thanks! |
bac569b
to
3632509
Compare
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.
looks good, thank you! I rebased and added a negative test (EOA prank), have one comment re handling ExtDelegateCall
as well
@grandizzy, thank you for the review and help in rebasing. Added your suggestion 🙏. |
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.
lgtm, thank you! pending other reviews before merging
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.
lgtm
I tried to use this new feature but it doesn't work since I guess it requires an update of forge-std? Error (9582): Member "startPrank" not found or not visible after argument-dependent lookup in contract Vm.
--> test/EthernautCTF/DelegationExploit.t.sol:26:5:
|
26 | vm.startPrank(exploiter, true);
| ^^^^^^^^^^^^^
Error: Compilation failed |
indeed, will update and release a version with, thanks for flagging |
- add `delegatecall` flag to `prank` cheatcodes (foundry-rs/foundry#8863) - support EIP-7702 Delegations (`create/sign/attachDelegation`) (foundry-rs/foundry#9236) - add `contains` to check if a string contains another string (foundry-rs/foundry#9085)
* begin api and rough comments * impl cheatcode * add check for eoa * fix eoa check on each prank call * add to assets * prank compiling * delegate call working, storage not upating * delegate call working, some tidy up * add prank2 calls * impl remaining tests * formatting * forge fmt * add pranks to cheatcodes.json * run cargo cheats * If verbosity level is 1 or higher, it shows dirty files. * Fix, add EOA prank test * Revert "If verbosity level is 1 or higher, it shows dirty files." This reverts commit d03ac1d. * Fix test * apply on extdelegatecall --------- Co-authored-by: mgiagante <[email protected]> Co-authored-by: grandizzy <[email protected]>
Hi |
@varun-doshi yes it is, book is not updated yet |
Motivation
Closes #824. Currently there is no easy way to test delegate calls using foundry tests.
Solution
delegate_call
flag to the prank.