diff --git a/crates/fuzzing/src/generators/api.rs b/crates/fuzzing/src/generators/api.rs index 9ffe8c5e26..33fb27b0cd 100644 --- a/crates/fuzzing/src/generators/api.rs +++ b/crates/fuzzing/src/generators/api.rs @@ -140,6 +140,25 @@ impl Arbitrary for ApiCalls { Ok(ApiCalls { calls }) } + + fn size_hint(depth: usize) -> (usize, Option) { + arbitrary::size_hint::recursion_guard(depth, |depth| { + arbitrary::size_hint::or( + // This is the stuff we unconditionally need, which affects the + // minimum size. + arbitrary::size_hint::and( + ::size_hint(depth), + // `arbitrary_config` uses two bools when + // `swarm.config_debug_info` is true. + <(bool, bool) as Arbitrary>::size_hint(depth), + ), + // We can generate arbitrary `WasmOptTtf` instances, which have + // no upper bound on the number of bytes they consume. This sets + // the upper bound to `None`. + ::size_hint(depth), + ) + }) + } } fn arbitrary_config(