@@ -40,7 +40,6 @@ import Echidna.Symbolic (forceAddr)
4040import Echidna.SymExec (createSymTx )
4141import Echidna.Test
4242import Echidna.Transaction
43- import Echidna.Types (Gas )
4443import Echidna.Types.Campaign
4544import Echidna.Types.Corpus (Corpus , corpusSize )
4645import Echidna.Types.Coverage (coverageStats )
@@ -130,7 +129,6 @@ runSymWorker callback vm dict workerId initialCorpus name = do
130129 effectiveGenDict = dict { defSeed = effectiveSeed }
131130 initialState =
132131 WorkerState { workerId
133- , gasInfo = mempty
134132 , genDict = effectiveGenDict
135133 , newCoverage = False
136134 , ncallseqs = 0
@@ -208,7 +206,6 @@ runFuzzWorker callback vm dict workerId initialCorpus testLimit = do
208206 effectiveGenDict = dict { defSeed = effectiveSeed }
209207 initialState =
210208 WorkerState { workerId
211- , gasInfo = mempty
212209 , genDict = effectiveGenDict
213210 , newCoverage = False
214211 , ncallseqs = 0
@@ -368,7 +365,7 @@ callseq vm txSeq = do
368365 -- and construct a set to union to the constants table
369366 diffs = Map. fromList [(AbiAddressType , Set. fromList $ AbiAddress . forceAddr <$> newAddrs)]
370367 -- Now we try to parse the return values as solidity constants, and add them to 'GenDict'
371- resultMap = returnValues ( map ( \ (t, (vr, _)) -> (t, vr)) results) workerState. genDict. rTypes
368+ resultMap = returnValues results workerState. genDict. rTypes
372369 -- union the return results with the new addresses
373370 additions = Map. unionWith Set. union diffs resultMap
374371 -- append to the constants dictionary
@@ -381,11 +378,6 @@ callseq vm txSeq = do
381378 -- Update the worker state
382379 in workerState
383380 { genDict = updatedDict
384- -- Update the gas estimation
385- , gasInfo =
386- if conf. estimateGas
387- then updateGasInfo results [] workerState. gasInfo
388- else workerState. gasInfo
389381 -- Reset the new coverage flag
390382 , newCoverage = False
391383 -- Keep track of the number of calls to `callseq`
@@ -418,7 +410,7 @@ callseq vm txSeq = do
418410 _ -> Nothing
419411
420412 -- | Add transactions to the corpus, discarding reverted ones
421- addToCorpus :: Int -> [(Tx , ( VMResult Concrete RealWorld , Gas ) )] -> Corpus -> Corpus
413+ addToCorpus :: Int -> [(Tx , VMResult Concrete RealWorld )] -> Corpus -> Corpus
422414 addToCorpus n res corpus =
423415 if null rtxs then corpus else Set. insert (n, rtxs) corpus
424416 where rtxs = fst <$> res
@@ -428,7 +420,7 @@ callseq vm txSeq = do
428420execTxOptC
429421 :: (MonadIO m , MonadReader Env m , MonadState WorkerState m , MonadThrow m )
430422 => VM Concrete RealWorld -> Tx
431- -> m (( VMResult Concrete RealWorld , Gas ) , VM Concrete RealWorld )
423+ -> m (VMResult Concrete RealWorld , VM Concrete RealWorld )
432424execTxOptC vm tx = do
433425 ((res, grew), vm') <- runStateT (execTxWithCov tx) vm
434426 when grew $ do
@@ -440,25 +432,6 @@ execTxOptC vm tx = do
440432 in workerState { newCoverage = True , genDict = dict' }
441433 pure (res, vm')
442434
443- -- | Given current `gasInfo` and a sequence of executed transactions, updates
444- -- information on the highest gas usage for each call
445- updateGasInfo
446- :: [(Tx , (VMResult Concrete RealWorld , Gas ))]
447- -> [Tx ]
448- -> Map Text (Gas , [Tx ])
449- -> Map Text (Gas , [Tx ])
450- updateGasInfo [] _ gi = gi
451- updateGasInfo ((tx@ Tx {call = SolCall (f, _)}, (_, used')): txs) tseq gi =
452- case mused of
453- Nothing -> rec
454- Just (used, _) | used' > used -> rec
455- Just (used, otseq) | (used' == used) && (length otseq > length tseq') -> rec
456- _ -> updateGasInfo txs tseq' gi
457- where mused = Map. lookup f gi
458- tseq' = tx: tseq
459- rec = updateGasInfo txs tseq' (Map. insert f (used', reverse tseq') gi)
460- updateGasInfo ((t, _): ts) tseq gi = updateGasInfo ts (t: tseq) gi
461-
462435-- | Given an initial 'VM' state and a way to run transactions, evaluate a list
463436-- of transactions, constantly checking if we've solved any tests.
464437evalSeq
0 commit comments