runtimeverification / runtimeverification/komet
Add `assume` cheatcode to restrict fuzzing inputs
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 35
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Description:
Currently, when writing fuzz tests in Komet, we manually enforce input assumptions using early returns in the test code:
if !assumption(input) {
return true;
}
This approach is:
- Error-prone, as it relies on developers to remember to negate the assumption and write early returns manually.
- Not elegant, reducing the readability and expressiveness of tests.
- Incorrect for statistics, because inputs that violate the assumption are still counted toward the total number of examples. For instance, if the fuzzer is configured to run 100 tests but 30 inputs are discarded due to assumptions, only 70 effective tests are run.
Proposal
Introduce a new assume cheatcode that allows developers to express input assumptions declaratively. During fuzzing:
- When an input violates the assumption, execution should immediately terminate, and the input should be discarded.
- The discarded input should not count toward the configured number of fuzzing iterations.
- The fuzzer should continue generating inputs until it runs the desired number of test cases that satisfy the assumptions.
Example usage (conceptual):
assume(x > 0 && x < 100);
This would ensure the test only runs when x is in the specified range, and otherwise the input is skipped without counting toward the total.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by tracing the fuzzing loop and how early-returned inputs are currently handled, then define the discard and iteration-count behavior; done means assumptions can stop an input without counting it and the fuzzer reaches the requested number of satisfying cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100