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

Deprecate changePrank #866

Closed
Tracked by #865
smol-ninja opened this issue Mar 24, 2024 · 5 comments
Closed
Tracked by #865

Deprecate changePrank #866

smol-ninja opened this issue Mar 24, 2024 · 5 comments
Assignees
Labels
effort: medium Default level of effort. priority: 2 We will do our best to deal with this. type: test Adding, updating, or removing tests. work: complex Probe-sense-respond. The relationship between cause and effect can only be perceived in retrospect.

Comments

@smol-ninja
Copy link
Member

smol-ninja commented Mar 24, 2024

The foundry cheatcode changePrank has been deprecated and will likely be removed in the future release.

Replacing it with vm.startPrank seems like a straightforward solution but it has introduced a new requirement that the prank must have been applied atleast once before overriding. This has also been raised by @PaulRBerg in foundry-rs/foundry#4942 but a shame that they decided to close it in favour of the suggestion to handle it using readCallers.

Since we decided to update forge-std, the tests now throw a deprecation warning. There are two solutions I can think of:

  1. Carefully replace it with vm.startPrank.
  2. Implement a changePrank function ourselves which calls vm.stopPrank followed by vm.startPrank.

Wdyt @PaulRBerg @andreivladbrg.

Related

@smol-ninja smol-ninja added priority: 2 We will do our best to deal with this. type: test Adding, updating, or removing tests. effort: medium Default level of effort. work: complex Probe-sense-respond. The relationship between cause and effect can only be perceived in retrospect. labels Mar 24, 2024
@andreivladbrg
Copy link
Member

IMO it would be better if we implement a function ourselves that replicates the changePrank (i would name it differently)

@smol-ninja
Copy link
Member Author

I agree with you Andrei. On the name how about resetPrank?

@smol-ninja smol-ninja self-assigned this Mar 26, 2024
@smol-ninja
Copy link
Member Author

Addressed in 169947e.

@smol-ninja
Copy link
Member Author

Do you like the name @andreivladbrg or want to suggest something else?

@PaulRBerg
Copy link
Member

I agree with @andreivladbrg, let's go with the path of least resistance and re-implement changePrank ourselves.

resetPrank works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: medium Default level of effort. priority: 2 We will do our best to deal with this. type: test Adding, updating, or removing tests. work: complex Probe-sense-respond. The relationship between cause and effect can only be perceived in retrospect.
Projects
None yet
Development

No branches or pull requests

3 participants