Skip to content

Commit

Permalink
avoid a crash when invalid filtering is used and provide a better err…
Browse files Browse the repository at this point in the history
…or message (#1258)
  • Loading branch information
ggrieco-tob committed May 28, 2024
1 parent acaaaed commit 53a0a91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/Echidna/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ loadSpecified env name cs = do
Just ne -> Map.singleton mainContract.runtimeCodehash ne
Nothing -> mempty

when (Map.null abiMapping) $
throwM $ InvalidMethodFilters solConf.methodFilter

-- Set up initial VM, either with chosen contract or Etheno initialization file
-- need to use snd to add to ABI dict
initVM <- stToIO $ initialVM solConf.allowFFI
Expand Down
2 changes: 1 addition & 1 deletion lib/Echidna/Types/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ instance Show SolException where
OnlyTests -> "Only tests and no public functions found in ABI"
ConstructorArgs s -> "Constructor arguments are required: " ++ s
NoCryticCompile -> "crytic-compile not installed or not found in PATH. To install it, run:\n pip install crytic-compile"
InvalidMethodFilters f -> "Applying " ++ show f ++ " to the methods produces an empty list. Are you filtering the correct functions or fuzzing the correct contract?"
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?"
SetUpCallFailed -> "Calling the setUp() function failed (revert, out-of-gas, sending ether to an non-payable constructor, etc.)"
DeploymentFailed a t -> "Deploying the contract " ++ show a ++ " failed (revert, out-of-gas, sending ether to an non-payable constructor, etc.):\n" ++ unpack t
OutdatedSolcVersion v -> "Solc version " ++ toString v ++ " detected. Echidna doesn't support versions of solc before " ++ toString minSupportedSolcVersion ++ ". Please use a newer version."
Expand Down

0 comments on commit 53a0a91

Please sign in to comment.