Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion crates/evm/src/fuzz/invariant/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use ethers::{
abi::{Abi, Address, Detokenize, FixedBytes, Tokenizable, TokenizableItem},
prelude::U256,
};
use eyre::{ContextCompat, Result};
use eyre::{eyre, ContextCompat, Result};
use foundry_common::contracts::{ContractsByAddress, ContractsByArtifact};
use foundry_config::{FuzzDictionaryConfig, InvariantConfig};
use parking_lot::{Mutex, RwLock};
Expand Down Expand Up @@ -99,6 +99,11 @@ impl<'a> InvariantExecutor<'a> {
&mut self,
invariant_contract: InvariantContract,
) -> Result<InvariantFuzzTestResult> {
// Throw an error to abort test run if the invariant function accepts input params
if !invariant_contract.invariant_function.inputs.is_empty() {
return Err(eyre!("Invariant test function should have no inputs"))
}

let (fuzz_state, targeted_contracts, strat) = self.prepare_fuzzing(&invariant_contract)?;

// Stores the consumed gas and calldata of every successful fuzz call.
Expand Down