Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid a crash when invalid filtering is used and provide a better error message #1258

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
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
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