Skip to main content

foundry_evm_symbolic/
lib.rs

1//! Foundry's symbolic EVM executor.
2
3#![warn(unused_crate_dependencies)]
4
5use alloy_dyn_abi::{DynSolType, DynSolValue, JsonAbiExt};
6use alloy_json_abi::{Function, JsonAbi, StateMutability};
7use alloy_network::TransactionBuilder;
8use alloy_primitives::{
9    Address, B256, Bytes, I256, Keccak256, U256, U512, hex, keccak256,
10    map::{HashMap, HashSet, IndexSet},
11};
12use alloy_signer::SignerSync;
13use alloy_signer_local::{
14    PrivateKeySigner,
15    coins_bip39::{English, Wordlist},
16};
17use alloy_sol_types::{SolCall, SolInterface};
18use base64::prelude::*;
19use evm2::{
20    EvmFeatures, SpecId,
21    bytecode::{Bytecode, JumpTable},
22    constants::{CALL_DEPTH_LIMIT, EIP7702_BYTECODE_LEN},
23    interpreter::{GasTracker, op as opcode},
24    precompiles::{
25        Precompiles, blake2, bls12_381, bn254, hash, identity, kzg_point_evaluation, modexp,
26        secp256k1, secp256r1,
27    },
28};
29use foundry_cheatcodes_spec::{SymbolicVm, Vm};
30use foundry_common::FoundryTransactionBuilder;
31use foundry_config::{SymbolicConfig, SymbolicExplorationOrder, SymbolicStorageLayout};
32use foundry_evm::{
33    constants::{CALLER, CHEATCODE_ADDRESS, DEFAULT_CREATE2_DEPLOYER, HARDHAT_CONSOLE_ADDRESS},
34    core::{abi::console, evm::FoundryEvmNetwork},
35    executors::Executor,
36    inspectors::cheatcodes::{decode_cheatcode_call, parse_value},
37};
38use serde::{Deserialize, Serialize};
39use std::{
40    collections::VecDeque,
41    fmt::{self, Write as _},
42    io::Write,
43    ops::{ControlFlow, Deref, DerefMut},
44    path::{Path, PathBuf},
45    process::{Command, Stdio},
46    sync::{
47        Arc,
48        atomic::{AtomicBool, Ordering},
49        mpsc,
50    },
51    thread,
52    time::{Duration, Instant, SystemTime, UNIX_EPOCH},
53};
54use thiserror::Error;
55use tracing::{debug, trace, trace_span, warn};
56
57mod abi;
58mod consts;
59mod executor;
60mod runtime;
61
62pub use consts::SYMBOLIC_VM_COMPAT_ADDRESS;
63pub(crate) use consts::*;
64pub use runtime::{ExecutorView, SymbolicBranchTarget, SymbolicError, SymbolicRunInput};
65
66#[derive(Clone, Copy, Debug, PartialEq, Eq)]
67enum SymbolicVmCheatcode {
68    CreateAddress,
69    CreateBool,
70    CreateBytes,
71    CreateBytesSized,
72    CreateBytesFixed(usize),
73    /// `createCalldata` for a contract named by `target`, with a trailing view and pure function
74    /// flag when `view_flag` is set.
75    CreateCalldata {
76        target: CreateCalldataTarget,
77        view_flag: bool,
78    },
79    CreateInt,
80    CreateIntBits(usize),
81    CreateString,
82    CreateStringSized,
83    CreateUint,
84    CreateUintBits(usize),
85    EnableSymbolicStorage,
86    SnapshotStorage,
87    SnapshotState,
88}
89
90impl SymbolicVmCheatcode {
91    fn from_selector(selector: [u8; 4]) -> Option<Self> {
92        match selector {
93            SymbolicVm::createAddressCall::SELECTOR => Some(Self::CreateAddress),
94            SymbolicVm::createBoolCall::SELECTOR => Some(Self::CreateBool),
95            SymbolicVm::createBytes_0Call::SELECTOR => Some(Self::CreateBytes),
96            SymbolicVm::createBytes_1Call::SELECTOR => Some(Self::CreateBytesSized),
97            SymbolicVm::createCalldata_0Call::SELECTOR => {
98                Some(Self::CreateCalldata { target: CreateCalldataTarget::Name, view_flag: false })
99            }
100            SymbolicVm::createCalldata_1Call::SELECTOR => {
101                Some(Self::CreateCalldata { target: CreateCalldataTarget::Name, view_flag: true })
102            }
103            SymbolicVm::createCalldata_2Call::SELECTOR => Some(Self::CreateCalldata {
104                target: CreateCalldataTarget::FileAndName,
105                view_flag: false,
106            }),
107            SymbolicVm::createCalldata_3Call::SELECTOR => Some(Self::CreateCalldata {
108                target: CreateCalldataTarget::FileAndName,
109                view_flag: true,
110            }),
111            SymbolicVm::createCalldata_4Call::SELECTOR => Some(Self::CreateCalldata {
112                target: CreateCalldataTarget::Address,
113                view_flag: false,
114            }),
115            SymbolicVm::createCalldata_5Call::SELECTOR => Some(Self::CreateCalldata {
116                target: CreateCalldataTarget::Address,
117                view_flag: true,
118            }),
119            SymbolicVm::createIntCall::SELECTOR => Some(Self::CreateInt),
120            SymbolicVm::createString_0Call::SELECTOR => Some(Self::CreateString),
121            SymbolicVm::createString_1Call::SELECTOR => Some(Self::CreateStringSized),
122            SymbolicVm::createUintCall::SELECTOR => Some(Self::CreateUint),
123            SymbolicVm::enableSymbolicStorageCall::SELECTOR
124            | Vm::setArbitraryStorage_0Call::SELECTOR => Some(Self::EnableSymbolicStorage),
125            SymbolicVm::snapshotStorageCall::SELECTOR => Some(Self::SnapshotStorage),
126            Vm::snapshotStateCall::SELECTOR => Some(Self::SnapshotState),
127            _ => {
128                let name = SymbolicVm::SymbolicVmCalls::name_by_selector(selector)?;
129                if let Some(bits) = name.strip_prefix("createUint") {
130                    bits.parse().ok().map(Self::CreateUintBits)
131                } else if let Some(bits) = name.strip_prefix("createInt") {
132                    bits.parse().ok().map(Self::CreateIntBits)
133                } else if let Some(bytes) = name.strip_prefix("createBytes") {
134                    bytes.parse().ok().map(Self::CreateBytesFixed)
135                } else {
136                    None
137                }
138            }
139        }
140    }
141
142    const fn min_input_words(self) -> usize {
143        match self {
144            Self::CreateUint
145            | Self::CreateInt
146            | Self::CreateBytesSized
147            | Self::CreateStringSized
148            | Self::EnableSymbolicStorage
149            | Self::SnapshotStorage => 1,
150            Self::CreateCalldata { target, view_flag } => target.words() + view_flag as usize,
151            Self::CreateAddress
152            | Self::CreateBool
153            | Self::CreateBytes
154            | Self::CreateBytesFixed(_)
155            | Self::CreateIntBits(_)
156            | Self::CreateString
157            | Self::CreateUintBits(_)
158            | Self::SnapshotState => 0,
159        }
160    }
161}
162
163/// Returns the selectors that the symbolic engine answers as `svm.*` helpers at
164/// [`SYMBOLIC_VM_COMPAT_ADDRESS`].
165pub fn symbolic_vm_selectors() -> impl Iterator<Item = [u8; 4]> {
166    SymbolicVm::SymbolicVmCalls::SELECTORS
167        .iter()
168        .copied()
169        .chain([Vm::setArbitraryStorage_0Call::SELECTOR, Vm::snapshotStateCall::SELECTOR])
170        .filter(|selector| SymbolicVmCheatcode::from_selector(*selector).is_some())
171}
172
173/// How a `createCalldata` call names its contract.
174#[derive(Clone, Copy, Debug, PartialEq, Eq)]
175enum CreateCalldataTarget {
176    /// A deployed contract address.
177    Address,
178    /// A contract or interface name.
179    Name,
180    /// A source file name and a contract or interface name.
181    FileAndName,
182}
183
184impl CreateCalldataTarget {
185    /// Returns the number of ABI head words that name the contract.
186    const fn words(self) -> usize {
187        match self {
188            Self::Address | Self::Name => 1,
189            Self::FileAndName => 2,
190        }
191    }
192}
193
194/// Outcome of a symbolic test execution.
195///
196/// The forge runner treats `Safe` as a passing symbolic test, `Counterexample` as a
197/// candidate failure that must be replayed concretely, and `Incomplete` as a failing
198/// test because the symbolic engine could not prove the property with the supported
199/// semantics and configured resource limits.
200#[derive(Clone, Debug)]
201pub enum SymbolicRunResult {
202    /// All explored paths completed without a feasible failure.
203    Safe {
204        /// Execution counters collected during the run.
205        stats: SymbolicStats,
206        /// One concrete successful input, when requested by the caller.
207        success_input: Option<SymbolicConcreteInput>,
208    },
209    /// A feasible failure was found.
210    Counterexample {
211        /// ABI-typed argument values extracted from the solver model.
212        args: Vec<DynSolValue>,
213        /// ABI-encoded calldata for the failing invocation.
214        calldata: Bytes,
215        /// Return data of each `svm.*` helper call on the failing path, in call order.
216        svm_returns: Vec<Bytes>,
217        /// Pc in the test contract of the memory access beyond `memory_limit` or the host word
218        /// that halted the failing path. Concrete execution may charge gas for that access first
219        /// and run out of gas there.
220        memory_halt_pc: Option<usize>,
221        /// Concrete setup-storage values needed for replay.
222        storage: Vec<SymbolicStorageAssignment>,
223        /// Execution counters collected before the counterexample was returned.
224        stats: SymbolicStats,
225    },
226    /// Execution was intentionally stopped because V1 semantics were insufficient.
227    Incomplete {
228        /// Category describing why symbolic execution stopped before proving the test.
229        kind: SymbolicStopReason,
230        /// Human-readable explanation of the unsupported construct or exhausted limit.
231        reason: String,
232        /// Execution counters collected before execution stopped.
233        stats: SymbolicStats,
234    },
235}
236
237/// One concrete symbolic input materialized from a solver model.
238#[derive(Clone, Debug)]
239pub struct SymbolicConcreteInput {
240    /// ABI-typed argument values extracted from the solver model.
241    pub args: Vec<DynSolValue>,
242    /// ABI-encoded calldata for replay.
243    pub calldata: Bytes,
244}
245
246/// Result of best-effort symbolic exploration toward one branch target.
247#[derive(Debug)]
248pub struct SymbolicBranchTargetSearchResult {
249    /// Concrete inputs whose completed root path reached the requested branch outcome.
250    pub candidates: Vec<SymbolicConcreteInput>,
251    /// Underlying execution result, retained so callers can report incomplete exploration.
252    pub execution: SymbolicRunResult,
253}
254
255/// A concrete invariant target selected from Foundry's invariant discovery.
256#[derive(Clone, Debug)]
257pub struct SymbolicInvariantTarget {
258    /// Address that receives the sequence call.
259    pub address: Address,
260    /// Human-readable contract identifier used in counterexample rendering.
261    pub contract_name: Option<String>,
262    /// ABI function invoked with symbolic arguments.
263    pub function: Function,
264}
265
266/// Input for best-effort invariant candidate search after one symbolic handler call.
267pub struct SymbolicInvariantCandidateInput<'a> {
268    /// Read-only view of the concrete Foundry executor containing the replayed invariant frontier
269    /// prefix.
270    pub executor: ExecutorView<'a>,
271    /// Address of the deployed invariant test contract.
272    pub invariant_address: Address,
273    /// Invariant functions checked independently after the handler call.
274    pub invariants: &'a [&'a Function],
275    /// Optional campaign hook checked from the unchanged post-handler state.
276    pub after_invariant: Option<&'a Function>,
277    /// Concrete handler target selected from the captured frontier.
278    pub target: &'a SymbolicInvariantTarget,
279    /// Sender of the captured handler call.
280    pub handler_sender: Address,
281    /// Whether symbolic `vm.ffi` calls are allowed to execute subprocesses.
282    pub ffi_enabled: bool,
283}
284
285/// One unconfirmed symbolic input produced by invariant candidate search.
286#[derive(Clone, Debug)]
287pub struct SymbolicInvariantCandidate {
288    /// Index within [`SymbolicInvariantCandidateInput::invariants`] predicted to fail.
289    pub invariant_idx: usize,
290    /// Concrete handler call extracted from the solver model.
291    pub step: SymbolicInvariantStep,
292    /// Concrete setup-storage values needed to replay the candidate.
293    pub storage: Vec<SymbolicStorageAssignment>,
294}
295
296/// An execution or solver limitation encountered during best-effort candidate search.
297#[derive(Clone, Debug, PartialEq, Eq)]
298pub struct SymbolicInvariantSearchLimitation {
299    /// Category describing why part of the search could not complete.
300    pub kind: SymbolicStopReason,
301    /// Human-readable description of the limitation.
302    pub reason: String,
303}
304
305impl From<SymbolicError> for SymbolicInvariantSearchLimitation {
306    fn from(error: SymbolicError) -> Self {
307        Self { kind: error.stop_reason(), reason: error.to_string() }
308    }
309}
310
311/// Result of best-effort invariant candidate search after one symbolic handler call.
312#[derive(Clone, Debug)]
313pub struct SymbolicInvariantCandidateSearchResult {
314    /// Unconfirmed candidates that must be replayed concretely by the caller.
315    pub candidates: Vec<SymbolicInvariantCandidate>,
316    /// First encountered search limitation, unless a later error exhausts the search.
317    /// `None` is not a proof of safety.
318    pub limitation: Option<SymbolicInvariantSearchLimitation>,
319}
320
321/// Input for bounded symbolic invariant execution.
322pub struct SymbolicInvariantRunInput<'a> {
323    /// Read-only view of the concrete Foundry executor used as the source of deployed bytecode and
324    /// backend state.
325    pub executor: ExecutorView<'a>,
326    /// Address of the deployed invariant test contract.
327    pub invariant_address: Address,
328    /// Default sender used when invariant targeting does not configure senders.
329    pub sender: Address,
330    /// Invariant function checked after each symbolic sequence step.
331    pub invariant: &'a Function,
332    /// Optional `afterInvariant` hook to execute after a passing invariant check.
333    pub after_invariant: Option<&'a Function>,
334    /// Concrete target/selector set discovered by Foundry invariant targeting.
335    pub targets: Vec<SymbolicInvariantTarget>,
336    /// Concrete sender set discovered by Foundry invariant targeting.
337    pub senders: Vec<Address>,
338    /// Sender addresses excluded by Foundry invariant targeting.
339    pub excluded_senders: Vec<Address>,
340    /// Maximum number of sequence calls to execute.
341    pub depth: usize,
342    /// Concrete invariant check interval. `0` means only check at sequence end.
343    pub check_interval: u32,
344    /// Whether ordinary target-call reverts should be reported as failures.
345    pub fail_on_revert: bool,
346    /// Whether symbolic `vm.ffi` calls are allowed to execute subprocesses.
347    pub ffi_enabled: bool,
348}
349
350/// One concrete storage value required to replay a symbolic invariant candidate.
351#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
352pub struct SymbolicStorageAssignment {
353    /// Account whose storage slot should be initialized.
354    pub address: Address,
355    /// Concrete storage slot.
356    pub slot: U256,
357    /// Concrete value extracted from the solver model.
358    pub value: U256,
359}
360
361/// Outcome of bounded symbolic invariant execution.
362#[derive(Clone, Debug)]
363pub enum SymbolicInvariantRunResult {
364    /// No feasible invariant failure was found within the configured sequence depth.
365    Safe(SymbolicStats),
366    /// A feasible invariant or handler failure was found.
367    Counterexample {
368        /// Which part of the invariant run produced the failure.
369        kind: SymbolicInvariantCounterexampleKind,
370        /// Concrete sequence extracted from the solver model.
371        sequence: Vec<SymbolicInvariantStep>,
372        /// Concrete setup-storage values needed for replay.
373        storage: Vec<SymbolicStorageAssignment>,
374        /// Execution counters collected before the counterexample was returned.
375        stats: SymbolicStats,
376    },
377    /// Execution stopped before proving the invariant.
378    Incomplete {
379        /// Category describing why symbolic execution stopped.
380        kind: SymbolicStopReason,
381        /// Human-readable explanation of the unsupported construct or exhausted limit.
382        reason: String,
383        /// Execution counters collected before execution stopped.
384        stats: SymbolicStats,
385    },
386}
387
388/// Part of a symbolic invariant run that produced a replayable counterexample.
389#[derive(Clone, Copy, Debug, PartialEq, Eq)]
390pub enum SymbolicInvariantCounterexampleKind {
391    /// An `invariant_*` or `afterInvariant` check failed.
392    Predicate,
393    /// A fuzzed target/handler call failed with an assertion.
394    Handler,
395}
396
397/// One concrete step in a symbolic invariant counterexample sequence.
398#[derive(Clone, Debug)]
399pub struct SymbolicInvariantStep {
400    /// Sender used for the call.
401    pub sender: Address,
402    /// Target address called by the sequence step.
403    pub address: Address,
404    /// Human-readable contract identifier, when known.
405    pub contract_name: Option<String>,
406    /// ABI function name.
407    pub function_name: String,
408    /// ABI function signature.
409    pub signature: String,
410    /// ABI-typed arguments extracted from the solver model.
411    pub args: Vec<DynSolValue>,
412    /// ABI-encoded calldata for replay.
413    pub calldata: Bytes,
414}
415
416/// Input for a symbolic equivalence check of two runtime bytecodes.
417pub struct SymbolicEquivalenceInput<'a> {
418    /// Read-only view of the concrete Foundry executor that supplies the environment and the
419    /// pre-state both codes start from.
420    pub executor: ExecutorView<'a>,
421    /// Address both codes run at, so they share one storage pre-state.
422    pub address: Address,
423    /// Runtime bytecode of the first contract.
424    pub code_a: Bytes,
425    /// Runtime bytecode of the second contract.
426    pub code_b: Bytes,
427    /// Account that stands for the sender of the top-level call, whose address is symbolic.
428    pub sender: Address,
429    /// Fixed call value of the top-level call; symbolic when `None`.
430    pub value: Option<U256>,
431    /// When set, calldata is limited to ABI-encoded calls of this function.
432    pub function: Option<&'a Function>,
433    /// Fixed lengths of raw calldata to explore when `function` is `None`. When empty, the
434    /// calldata length is symbolic, up to `max_calldata` bytes.
435    pub calldata_lengths: Vec<usize>,
436    /// Largest symbolic calldata, in bytes.
437    pub max_calldata: usize,
438    /// Largest return data of a call into unknown code, in bytes.
439    pub max_returndata: usize,
440    /// Assume calls into unknown code never re-enter the programs, like hevm's
441    /// `--promise-no-reent`. Without it a state-changing CALL into unknown code is incomplete.
442    pub promise_no_reent: bool,
443    /// Compare the programs modulo gas, like hevm: inputs on which either program runs out of
444    /// memory gas are left out instead of counting as a difference.
445    pub ignore_out_of_gas: bool,
446}
447
448/// Concrete transaction and block environment of an equivalence counterexample.
449#[derive(Clone, Debug, Default, PartialEq, Eq)]
450pub struct SymbolicEquivalenceEnv {
451    /// Address both programs run at.
452    pub address: Address,
453    /// Sender of the call.
454    pub caller: Address,
455    /// Origin of the transaction.
456    pub origin: Address,
457    /// Call value.
458    pub value: U256,
459    /// Block timestamp.
460    pub timestamp: U256,
461    /// Block number.
462    pub number: U256,
463    /// `PREVRANDAO` / `DIFFICULTY`.
464    pub prevrandao: U256,
465    /// Block gas limit.
466    pub gas_limit: U256,
467    /// Base fee.
468    pub basefee: U256,
469    /// Blob base fee.
470    pub blob_basefee: U256,
471    /// Chain ID.
472    pub chain_id: U256,
473    /// Block beneficiary.
474    pub coinbase: Address,
475    /// Gas price.
476    pub gas_price: U256,
477    /// Starting balances of the accounts the counterexample reads, keyed by the account that
478    /// stands for them in the check.
479    pub balances: Vec<(Address, U256)>,
480}
481
482/// Outcome of a symbolic equivalence check.
483#[derive(Clone, Debug)]
484pub enum SymbolicEquivalenceResult {
485    /// Every explored pair of paths agreed on success, output and storage.
486    Equivalent {
487        /// Execution counters collected during the run.
488        stats: SymbolicStats,
489    },
490    /// The solver found an input on which the two codes differ. Callers must replay it
491    /// concretely before reporting it.
492    Counterexample {
493        /// Calldata that distinguishes the two codes.
494        calldata: Bytes,
495        /// ABI-typed arguments, when the check was limited to a function.
496        args: Vec<DynSolValue>,
497        /// Pre-state storage values the counterexample needs.
498        storage: Vec<SymbolicStorageAssignment>,
499        /// Transaction and block environment of the counterexample.
500        env: Box<SymbolicEquivalenceEnv>,
501        /// Calls into unknown code on the two paths, whose answers come from the model.
502        unknown_calls: usize,
503        /// Whether a path read `GAS`, which the model chooses freely.
504        reads_gas: bool,
505        /// Execution counters collected before the counterexample was found.
506        stats: SymbolicStats,
507    },
508    /// The check stopped before it could establish equivalence.
509    Incomplete {
510        /// Category describing why the check stopped.
511        kind: SymbolicStopReason,
512        /// Human-readable explanation.
513        reason: String,
514        /// Execution counters collected before the check stopped.
515        stats: SymbolicStats,
516    },
517}
518
519/// High-level reason a symbolic run stopped without a proof or replayed counterexample.
520#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
521pub enum SymbolicStopReason {
522    /// The executor reached a supported-but-incomplete semantic boundary.
523    Stuck,
524    /// Every explored execution path ended in an ordinary revert.
525    RevertAll,
526    /// The solver timed out or returned `unknown`.
527    Timeout,
528    /// An internal engine, backend, or solver process error occurred.
529    Error,
530}
531
532/// Symbolic execution counters.
533#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
534pub struct SymbolicStats {
535    /// Number of explored symbolic paths.
536    pub paths: usize,
537    /// Number of normalized solver queries issued during the run.
538    pub solver_queries: usize,
539    /// Number of queries sent to the SMT backend after local fast paths.
540    #[serde(default)]
541    pub smt_queries: usize,
542    /// Number of satisfiability checks requested by the executor.
543    #[serde(default)]
544    pub sat_queries: usize,
545    /// Number of concrete model requests requested by the executor.
546    #[serde(default)]
547    pub model_queries: usize,
548    /// Number of satisfiability checks served from the normalized cache.
549    #[serde(default)]
550    pub sat_cache_hits: usize,
551    /// Number of model requests served from the normalized model cache.
552    #[serde(default)]
553    pub model_cache_hits: usize,
554    /// Number of satisfiable witnesses produced by local hard-arithmetic search.
555    #[serde(default)]
556    pub heuristic_witnesses: usize,
557    /// Wall-clock time spent waiting on backend solver subprocesses, in milliseconds.
558    #[serde(default)]
559    pub solver_time_ms: u64,
560    /// Total SMT-LIB input bytes sent to backend solver subprocesses.
561    #[serde(default)]
562    pub smt_input_bytes: u64,
563    /// Largest single SMT-LIB query input sent to a backend solver subprocess, in bytes.
564    #[serde(default)]
565    pub smt_max_query_bytes: u64,
566    /// Wall-clock time spent building SMT-LIB query strings, in milliseconds.
567    #[serde(default)]
568    pub smt_build_time_ms: u64,
569    /// Longest single backend solver subprocess query, in milliseconds.
570    #[serde(default)]
571    pub smt_max_query_time_ms: u64,
572}
573
574/// SMT-LIB-backed symbolic executor.
575///
576/// This executor is intentionally separate from the concrete evm2 executor used by
577/// Foundry. It consumes bytecode and state from an existing [`Executor`], explores
578/// symbolic branches, and returns either a proof result, a counterexample candidate,
579/// or an incomplete result.
580pub struct SymbolicExecutor {
581    config: SymbolicConfig,
582    cx: runtime::SymCx,
583    solver: runtime::SmtLibSubprocessSolver,
584    deferred_incomplete: Option<DeferredIncomplete>,
585    deadline: Option<Instant>,
586    nested_deferred_mode: DeferredPathMode,
587    stateless_retry_safe: bool,
588    folded_slots: runtime::FoldedSlots,
589    /// Set while an equivalence check runs.
590    equivalence: Option<EquivalenceMode>,
591}
592
593/// Settings of a running equivalence check.
594#[derive(Clone, Copy, Debug)]
595struct EquivalenceMode {
596    /// Assume unknown code never calls back into the programs, so CALLs into it are abstracted.
597    promise_no_reent: bool,
598    /// Largest return data of a call into unknown code, in bytes.
599    max_returndata: usize,
600    /// Whether a program read GAS, which counterexamples may then depend on.
601    reads_gas: bool,
602    /// Leave out inputs on which a program runs out of memory gas.
603    ignore_out_of_gas: bool,
604}
605
606#[derive(Clone, Copy, Debug, PartialEq, Eq)]
607enum DeferredPathMode {
608    Skip,
609    Yield,
610    Drain,
611}
612
613#[derive(Clone, Copy, Debug, PartialEq, Eq)]
614enum DeferredIncomplete {
615    Unsupported(&'static str),
616    SolverUnknown,
617    HardArithmetic,
618}