Skip to content
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 pranking #8863

Merged
merged 20 commits into from
Nov 15, 2024

Conversation

EdwardJES
Copy link
Contributor

@EdwardJES EdwardJES commented Sep 13, 2024

Motivation

Closes #824. Currently there is no easy way to test delegate calls using foundry tests.

Solution

  • Add a delegate_call flag to the prank.
  • ....

@@ -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
Copy link
Contributor Author

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.

Copy link
Member

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?

@EdwardJES EdwardJES changed the title feat(cheatcodes): add delegatecall to pranking [WIP] feat(cheatcodes): add delegatecall to pranking Sep 13, 2024
@zerosnacks
Copy link
Member

Hi @EdwardJES thanks for your PR - my apologies that it has taken a while to respond

@EdwardJES EdwardJES marked this pull request as ready for review September 27, 2024 00:44
@EdwardJES EdwardJES changed the title [WIP] feat(cheatcodes): add delegatecall to pranking feat(cheatcodes): add delegatecall to pranking Sep 30, 2024
@EdwardJES
Copy link
Contributor Author

gentle bump on this @zerosnacks, @DaniPopes . Thank you 🙏

@grandizzy grandizzy self-assigned this Nov 5, 2024
@grandizzy
Copy link
Collaborator

@EdwardJES is there anything waiting from us to unblock the PR or can we start the review? thank you!

@EdwardJES
Copy link
Contributor Author

@grandizzy all good to go, thanks!

Copy link
Collaborator

@grandizzy grandizzy left a 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

crates/cheatcodes/src/inspector.rs Outdated Show resolved Hide resolved
@EdwardJES
Copy link
Contributor Author

@grandizzy, thank you for the review and help in rebasing. Added your suggestion 🙏.

@grandizzy grandizzy self-requested a review November 15, 2024 11:03
Copy link
Collaborator

@grandizzy grandizzy left a 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

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mattsse mattsse merged commit c526cab into foundry-rs:master Nov 15, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

feat(cheatcodes): add vm.delegatePrank to execute a delegatecall in the context of the pranked address
5 participants