-
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
Limit fuzz runs to possible inputs #1901
Comments
you're of course right it should be possible to implement full coverage for arguments that allow it |
This is true in the case of Ideas for approaches that might scale better:
// This is the actual test foundry executes.
function test_ACV1_2_05_remove_liquidity_works_as_expected() public {
_test_ACV1_2_05_remove_liquidity_works_as_expected(true);
_test_ACV1_2_05_remove_liquidity_works_as_expected(false);
}
// Actual test logic and assertions here.
function _test_ACV1_2_05_remove_liquidity_works_as_expected(bool) internal {
// --- snip ---
} |
Would it not be possible to check the number of possible combinations basis the byte-size of the function arguments? E.g. if you have a signature of: func(bool,bool) you have 2 bits of possible inputs, ergo 4 cases. Similarly, if you have: func(uint8,uint8) you have 16 bits = 65536 possible combinations. So in this case, 256 fuzz runs can only cover 8 bits of input information. Assuming most people won't fuzz more than |
We just don't have a way currently to limit the fuzz runs based on input size. As to feasibility with our current setup I couldn't tell, we'd need to check the proptest docs :) But yes, the general idea you outlined applies |
I've investigated more and it is not possible to do with proptest. We would essentially need to manually calculate the input space and forego using proptest all together if the number of possible inputs is less than the number of fuzz runs and just do a loop instead. |
Going to close this since it would be difficult to implement with the current fuzz architecture, afaik it's not a feature of most other fuzzers, and there are workarounds described above to get similar behavior |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (6130af7 2022-04-07T00:08:44.543037+00:00)
What command(s) is the bug in?
forge test
Operating System
macOS (Apple Silicon)
Describe the bug
The problem is connected with fuzzing testing.
We use
bool
parameter to cover possible test. So, some of our tests looks so:So, as you can see there are only 2 options to check: true or false, btw, it passes through 256 test or the quantity is set in env var.
Please, check the max possible options to limit fuzzing.
The text was updated successfully, but these errors were encountered: