Open langston-barrett opened 1 month ago
sounds like a good idea to me
if you plan to do this I would suggest to move this InitialStdState to a differnet file. such as state/init.rs
or state/loader.rs
I guess a state without corpus id would be the same state we can use for generation base fuzzing, right?
More lightweight, we could just set CorpusId(0) in the beginning, it's a sane default..
Currently,
current_corpus_idx
returns anOption
. However, most places wherecurrent_(testcase|corpus_idx)
are called don't meaningfully handle it returningNone
, instead just propagating the error. In most fuzzers, we'd actually expect theNone
-handling branch to be dead code. I wonder if there's a way to actually make this method infallible. Hopefully this could even result in some performance gains by eliminating these branches? The revised trait would look like this:The difficulty is that the
State
would have to choose an initial index at the time it is constructed (probably using aScheduler
). Right now, we generally constructState
s before loading/generating the initial corpus. Perhaps there's some kind of type-state pattern, like there could be anInitialStdState
that doesn't implementHasCurrentCorpusIdx
, but has methods to load/generate the initial corpus and pick an initial index, and they all returnStdState
(which would implement the infallible version ofHasCurrentCorpusIdx
).Just an idea :shrug: Feel free to close if not helpful!