Skip to content

Commit

Permalink
calculate eventMap in mkWorld rather than giving it as an argument
Browse files Browse the repository at this point in the history
  • Loading branch information
samalws-tob committed Mar 7, 2024
1 parent a3625da commit 57ed1ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions lib/Echidna.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import EVM (cheatCode)
import EVM.ABI (AbiValue(AbiAddress))
import EVM.Dapp (DappInfo(..), dappInfo)
import EVM.Fetch qualified
import EVM.Solidity (SolcContract(..), BuildOutput)
import EVM.Solidity (BuildOutput)
import EVM.Types hiding (Env)

import Echidna.ABI
Expand Down Expand Up @@ -72,8 +72,7 @@ prepareContract env solFiles specifiedContract seed = do
(forceAddr vm.state.contract)
funs

eventMap = Map.unions $ map (.eventMap) contracts
world = mkWorld solConf eventMap signatureMap specifiedContract slitherInfo contracts
world = mkWorld solConf signatureMap specifiedContract slitherInfo contracts

deployedAddresses = Set.fromList $ AbiAddress . forceAddr <$> Map.keys vm.env.contracts
constants = enhanceConstants slitherInfo
Expand Down
6 changes: 3 additions & 3 deletions lib/Echidna/Solidity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Echidna.ABI
, commonTypeSizes, mkValidAbiInt, mkValidAbiUInt )
import Echidna.Deploy (deployContracts, deployBytecodes)
import Echidna.Etheno (loadEthenoBatch)
import Echidna.Events (EventMap, extractEvents)
import Echidna.Events (extractEvents)
import Echidna.Exec (execTx, initialVM)
import Echidna.SourceAnalysis.Slither
import Echidna.Symbolic (forceAddr)
Expand Down Expand Up @@ -291,14 +291,14 @@ loadSpecified env name cs = do
-- for running a 'Campaign' against the tests found.
mkWorld
:: SolConf
-> EventMap
-> SignatureMap
-> Maybe ContractName
-> SlitherInfo
-> [SolcContract]
-> World
mkWorld SolConf{sender, testMode} eventMap sigMap maybeContract slitherInfo contracts =
mkWorld SolConf{sender, testMode} sigMap maybeContract slitherInfo contracts =
let
eventMap = Map.unions $ map (.eventMap) contracts
payableSigs = filterResults maybeContract slitherInfo.payableFunctions
as = if isAssertionMode testMode then filterResults maybeContract slitherInfo.asserts else []
cs = if isDapptestMode testMode then [] else filterResults maybeContract slitherInfo.constantFunctions \\ as
Expand Down

0 comments on commit 57ed1ac

Please sign in to comment.