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(forge): cheat that starts or changes the prank #4779

Closed
PaulRBerg opened this issue Apr 19, 2023 · 0 comments · Fixed by #4826
Closed

feat(forge): cheat that starts or changes the prank #4779

PaulRBerg opened this issue Apr 19, 2023 · 0 comments · Fixed by #4826
Labels
A-cheatcodes Area: cheatcodes C-forge Command: forge T-feature Type: feature

Comments

@PaulRBerg
Copy link
Contributor

PaulRBerg commented Apr 19, 2023

Component

Forge

Describe the feature you would like

I use the changePrank added in foundry-rs/forge-std#319 a lot, and one of the issues I have with it is that I always need to ensure that it's called after a vm.startPrank. Otherwise, Foundry throws this error:

You have an active prank already.

Users would never see this error if there was a cheat that combined startPrank and changePrank like this:

  • Is prank started?
    • If not, run vm.startPrank
    • If yes, replicate the logic in changePrank (i.e. vm.stopPrank and vm.startPrank again)

Possible names for this new cheat include startChangePrank or startAndChangePrank. Alternatively, the startPrank cheat could itself be modified to work like this, which would make changePrank redundant.

Side note: I opened this issue here rather than forge-std due to the ongoing plan to implement all cheats natively in Foundry (#3782).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cheatcodes Area: cheatcodes C-forge Command: forge T-feature Type: feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants