foundry_evm/executors/fuzz/
types.rs

1use crate::executors::RawCallResult;
2use alloy_primitives::{map::HashMap, Bytes, Log};
3use foundry_common::evm::Breakpoints;
4use foundry_evm_coverage::HitMaps;
5use foundry_evm_fuzz::FuzzCase;
6use foundry_evm_traces::SparsedTraceArena;
7use revm::interpreter::InstructionResult;
8
9/// Returned by a single fuzz in the case of a successful run
10#[derive(Debug)]
11pub struct CaseOutcome {
12    /// Data of a single fuzz test case.
13    pub case: FuzzCase,
14    /// The traces of the call.
15    pub traces: Option<SparsedTraceArena>,
16    /// The coverage info collected during the call.
17    pub coverage: Option<HitMaps>,
18    /// Breakpoints char pc map.
19    pub breakpoints: Breakpoints,
20    /// logs of a single fuzz test case.
21    pub logs: Vec<Log>,
22    // Deprecated cheatcodes mapped to their replacements.
23    pub deprecated_cheatcodes: HashMap<&'static str, Option<&'static str>>,
24}
25
26/// Returned by a single fuzz when a counterexample has been discovered
27#[derive(Debug)]
28pub struct CounterExampleOutcome {
29    /// Minimal reproduction test case for failing test.
30    pub counterexample: (Bytes, RawCallResult),
31    /// The status of the call.
32    pub exit_reason: InstructionResult,
33    /// Breakpoints char pc map.
34    pub breakpoints: Breakpoints,
35}
36
37/// Outcome of a single fuzz
38#[derive(Debug)]
39#[expect(clippy::large_enum_variant)]
40pub enum FuzzOutcome {
41    Case(CaseOutcome),
42    CounterExample(CounterExampleOutcome),
43}