Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
elopez committed Oct 31, 2023
2 parents b734792 + f52b35a commit 93f82d9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/Echidna/Campaign.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ instance MonadThrow m => MonadThrow (RandT g m) where
-- | Given a 'Campaign', check if the test results should be reported as a
-- success or a failure.
isSuccessful :: [EchidnaTest] -> Bool
isSuccessful tests =
all (\case { Passed -> True; Open -> True; _ -> False; }) ((.state) <$> tests)
isSuccessful =
all (\case { Passed -> True; Open -> True; _ -> False; } . (.state))

-- | Run all the transaction sequences from the corpus and accumulate campaign
-- state. Can be used to minimize corpus as the final campaign state will
Expand Down
2 changes: 1 addition & 1 deletion lib/Echidna/Events.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extractEvents :: Bool -> DappInfo -> VM -> Events
extractEvents decodeErrors dappInfo vm =
let forest = traceForest vm
in maybeToList (decodeRevert decodeErrors vm)
++ catMaybes (concatMap flatten (fmap (fmap showTrace) forest))
++ concatMap ((catMaybes . flatten) . fmap showTrace) forest
where
showTrace trace =
let ?context = DappContext { info = dappInfo, env = vm.env.contracts } in
Expand Down
13 changes: 7 additions & 6 deletions lib/Echidna/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Data.List.NonEmpty (NonEmpty((:|)))
import Data.List.NonEmpty qualified as NE
import Data.List.NonEmpty.Extra qualified as NEE
import Data.Map qualified as Map
import Data.Maybe (isJust, isNothing, catMaybes, listToMaybe)
import Data.Maybe (isJust, isNothing, catMaybes, listToMaybe, mapMaybe)
import Data.Set (Set)
import Data.Set qualified as Set
import Data.Text (Text, isPrefixOf, isSuffixOf, append)
Expand Down Expand Up @@ -211,11 +211,12 @@ loadSpecified env name cs = do
-- Construct ABI mapping for World
abiMapping =
if solConf.allContracts then
Map.fromList $ catMaybes $ cs <&> \contract ->
let filtered = filterMethods contract.contractName
solConf.methodFilter
(abiOf solConf.prefix contract)
in (getBytecodeMetadata contract.runtimeCode,) <$> NE.nonEmpty filtered
Map.fromList $ mapMaybe (\contract ->
let filtered = filterMethods contract.contractName
solConf.methodFilter
(abiOf solConf.prefix contract)
in (getBytecodeMetadata contract.runtimeCode,) <$> NE.nonEmpty filtered)
cs
else
case NE.nonEmpty fabiOfc of
Just ne -> Map.singleton (getBytecodeMetadata mainContract.runtimeCode) ne
Expand Down

0 comments on commit 93f82d9

Please sign in to comment.