Skip to content

Commit 53a0a91

Browse files
avoid a crash when invalid filtering is used and provide a better error message (#1258)
1 parent acaaaed commit 53a0a91

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/Echidna/Solidity.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ loadSpecified env name cs = do
206206
Just ne -> Map.singleton mainContract.runtimeCodehash ne
207207
Nothing -> mempty
208208

209+
when (Map.null abiMapping) $
210+
throwM $ InvalidMethodFilters solConf.methodFilter
211+
209212
-- Set up initial VM, either with chosen contract or Etheno initialization file
210213
-- need to use snd to add to ABI dict
211214
initVM <- stToIO $ initialVM solConf.allowFFI

lib/Echidna/Types/Solidity.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ instance Show SolException where
4949
OnlyTests -> "Only tests and no public functions found in ABI"
5050
ConstructorArgs s -> "Constructor arguments are required: " ++ s
5151
NoCryticCompile -> "crytic-compile not installed or not found in PATH. To install it, run:\n pip install crytic-compile"
52-
InvalidMethodFilters f -> "Applying " ++ show f ++ " to the methods produces an empty list. Are you filtering the correct functions or fuzzing the correct contract?"
52+
InvalidMethodFilters f -> "Applying the filter " ++ show f ++ " to the methods produces an empty list. Are you filtering the correct functions using `filterFunctions` or fuzzing the correct contract?"
5353
SetUpCallFailed -> "Calling the setUp() function failed (revert, out-of-gas, sending ether to an non-payable constructor, etc.)"
5454
DeploymentFailed a t -> "Deploying the contract " ++ show a ++ " failed (revert, out-of-gas, sending ether to an non-payable constructor, etc.):\n" ++ unpack t
5555
OutdatedSolcVersion v -> "Solc version " ++ toString v ++ " detected. Echidna doesn't support versions of solc before " ++ toString minSupportedSolcVersion ++ ". Please use a newer version."

0 commit comments

Comments
 (0)