-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
): enable --isolate
by default for tests when snapshotGas
cheatcodes are used
#9912
Comments
--isolate
by default for tests when snapshotGas
cheatcodes are usedcheatcodes
): enable --isolate
by default for tests when snapshotGas
cheatcodes are used
This comment has been minimized.
This comment has been minimized.
Just want to clarify your comment but is this feasible / in the works? tyia |
Automatic detection of the use of the cheatcode would be ideal but I currently don't see a feasible way of doing that due to the program flow. An alternative would be to make gas snapshot running explict, similar to gas report or coverage. Similar to coverage turning of optimizations by default we enable isolation mode when running gas snapshots. Plan would be to:
Optional:
I want to think a bit more through it / collect feedback before starting considering this would a breaking change. As an intermediary solution I want to document isolation mode in the book and the requirement to enable it when creating gas snapshots. I'll add it to the 1.1 milestone for me so it stays top of mind. |
@zerosnacks @grandizzy should we consider just making |
That's a good option but I think we should first solve these 2 |
I was hesitant to default to isolate due to possible overhead but it is a much more intuitive way for end users to understand how tests are ran. If we feel that the performance degradation is small I would definitely be in favor. |
I did some very quick testing a while back and I believe the performance degradation is particularly bad for fuzzing, so if possible, please review this as part of the decision making process (and if it's significant, consider excluding |
Basic benchmarks against latest
Compared to latest
In both versions without
So on a simple scenario roughly 1.5x overhead currently |
Component
Forge
Describe the feature you would like
Currently,
--gas-report
uses--isolate
by default (as noted in #6578 (comment)) to ensure accurate gas measurements. Additionally, it has been suggested (see #8573 (comment)) that--isolate
should be used for the most precise gas measurements whenvm.lastCallGas()
is utilized.Given this context, I think it would be logical to enable
--isolate
by default for tests that includesnapshotGas
cheatcodes.For example, the current command:
FORGE_SNAPSHOT_CHECK=true forge test --isolate --mt testGas -vvv
could be simplified to:
FORGE_SNAPSHOT_CHECK=true forge test --mt testGas -vvv
Additional context
No response
The text was updated successfully, but these errors were encountered: