diff --git a/fuzz/fuzz_targets/differential.rs b/fuzz/fuzz_targets/differential.rs index 78605f33e2..62c0ca7996 100644 --- a/fuzz/fuzz_targets/differential.rs +++ b/fuzz/fuzz_targets/differential.rs @@ -38,7 +38,6 @@ fuzz_target!(|seed: &[u8]| { let exports = wasmi_oracle.exports(); let mut params = Vec::new(); // True as long as differential execution is deterministic between both oracles. - let mut deterministic = true; for (name, func_type) in exports.funcs() { params.clear(); params.extend( @@ -52,18 +51,17 @@ fuzz_target!(|seed: &[u8]| { let params = ¶ms[..]; let result_wasmi = wasmi_oracle.call(name, params); let result_oracle = chosen_oracle.call(name, params); - // Note: If either of the oracles returns a non-deterministic error we ignore it - // to avoid having to deal with non-deterministic behavior between oracles. + // Note: If either of the oracles returns a non-deterministic error we skip the + // entire fuzz run since following function executions could be affected by + // this non-determinism due to shared global state, such as global variables. if let Err(wasmi_err) = &result_wasmi { if wasmi_err.is_non_deterministic() { - deterministic = false; - continue; + return; } } if let Err(oracle_err) = &result_oracle { if oracle_err.is_non_deterministic() { - deterministic = false; - continue; + return; } } let wasmi_name = wasmi_oracle.name(); @@ -129,12 +127,6 @@ fuzz_target!(|seed: &[u8]| { } } } - if !deterministic { - // We bail out and do not check global state since potential non-determinism - // has been detected previously which could have led to non-deterministic changes - // to Wasm global state. - return; - } for name in exports.globals() { let wasmi_val = wasmi_oracle.get_global(name); let oracle_val = chosen_oracle.get_global(name);