You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
forge test does not ensure that the program terminates. There was an infinite loop in one of the smart contract that I'm testing and it gets stuck at Compiler run successful (with warnings) when forge test is ran.
To replicate the issue, create a test or contract under test that doesn't terminate, ie:
...
function testLoop() public {
while (true) {
// Do nothing
}
}
...
Running forge test will have the terminal stuck at Compiler run successful (with warnings) until manually terminated. This may be a problem when testing in CI where the program will consume extra compute hours.
Suggestion is to allow for test to have a gas limit that can be adjusted by the user or a global timeout for the test. This ensure that the program always terminates and also testers can be more aware of the gas consumed.
The text was updated successfully, but these errors were encountered:
@mattsse hmm, i've got a loop seeming to run forever, no gas limit being hit even if i prank some address, and i can't see a way to set a gas limit with a cheatcode
in my case i'm trying to test that i DO hit always gas limit under certain conditions, so having it loop forever is not helpful
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (44f3a4b 2022-07-18T00:09:43.728981Z)
What command(s) is the bug in?
forge test
Operating System
macOS (Apple Silicon)
Describe the bug
forge test
does not ensure that the program terminates. There was an infinite loop in one of the smart contract that I'm testing and it gets stuck atCompiler run successful (with warnings)
whenforge test
is ran.To replicate the issue, create a test or contract under test that doesn't terminate, ie:
Running
forge test
will have the terminal stuck atCompiler run successful (with warnings)
until manually terminated. This may be a problem when testing in CI where the program will consume extra compute hours.Suggestion is to allow for test to have a gas limit that can be adjusted by the user or a global timeout for the test. This ensure that the program always terminates and also testers can be more aware of the gas consumed.
The text was updated successfully, but these errors were encountered: