-
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(forge): do not revert if prank has not been used #4942
Comments
I just tried replacing |
Hmm interesting. The use case does make sense, but I think we should try to avoid a config flag if possible for simplicity. I see two competing interests:
Does |
It does -
This means not deprecating |
Cool, that seems like a good solution to me then since we can then support both of the interests in #4942 (comment) |
I have the same issue, perhaps it would be solved if we consider a contract deployment as applied state to |
Can this issue be closed now that we have the |
Yep, I believe this can be closed. |
Component
Forge
Describe the feature you would like
Problem
#4826 made it possible to override the current prank with
startPrank
, but it also introduced a new requirement, i.e. the previous prank must have been used at least once for the secondstartPrank
to be valid:15ac502
This new requirement is quite problematic and self-defeating with respect to the original goal of this override feature because, in complex code bases with many test files, it is difficult to know if the previous prank was used.
Take, for instance, the
Base_Test
in my PRBProxy code base:https://github.com/PaulRBerg/prb-proxy/blob/0b33e550bfd3c9264ccac22289745012a1b1b92d/test/Base.t.sol#L131
I need this prank as a default prank mode for all tests (so that I do not have to put it in every contract's
setUp
), but some tests need to override this behavior and start a new prank. See these fuzz tests:https://github.com/PaulRBerg/prb-proxy/blob/0b33e550bfd3c9264ccac22289745012a1b1b92d/test/registry/deploy/deploy.t.sol#L26-L31
This is where I tried to replace my
changePrank
calls withvm.startPrank
, and ended up getting the following error:Solutions
Possible ways to address this issue:
override_unused_prank
(orallow_unused_prank
) config option infoundry.toml
, which allows the user to override the latest prank even if it has not been usedchangePrank
inforge-std
WDYT, @4meta5?
Additional context
This restrictive behavior has apparently been implemented as a result of this suggestion left by @mds1:
The text was updated successfully, but these errors were encountered: