remotes/origin/dev-gas-wcet
agroce 5 years ago
parent f0cb1aa825
commit 8ec77eeaa5
  1. 4
      lib/Echidna/Campaign.hs
  2. 2
      lib/Echidna/UI/Report.hs

@ -174,7 +174,7 @@ evalSeq v e = go [] where
-- | Given current `gasInfo` and a sequence of executed transactions, updates information on highest
-- gas usage for each call
updateGasInfo :: [(Tx, (VMResult, Int))] -> [Tx] -> (Map Text (Int, [Tx])) -> (Map Text (Int, [Tx]))
updateGasInfo [] _ gi = gi
updateGasInfo [] _ gi = (insert "*" (1, []) gi)
updateGasInfo ((t@(Tx (SolCall((f, _))) _ _ _ _ _ _), (_, used')):ts) tseq gi =
let mused = Data.Map.lookup f gi
in case mused of Nothing -> updateGasInfo ts (t:tseq) (insert f (used', t:tseq) gi)
@ -250,7 +250,7 @@ campaign u v w ts d = do
c <- fromMaybe mempty <$> view (hasLens . to knownCoverage)
g <- view (hasLens . to seed)
let g' = mkStdGen $ fromMaybe (d' ^. defSeed) g
execStateT (evalRandT runCampaign g') (Campaign ((,Open (-1)) <$> ts) c mempty d') where
execStateT (evalRandT runCampaign g') (Campaign ((,Open (-1)) <$> ts) c (insert "?" (0, []) mempty) d') where
step = runUpdate (updateTest v Nothing) >> lift u >> runCampaign
runCampaign = use (hasLens . tests . to (fmap snd)) >>= update
update c = view hasLens >>= \(CampaignConf tl sof _ q sl _ _ _) ->

@ -51,7 +51,7 @@ ppCoverage s | s == mempty = Nothing
-- | Pretty-print the gas usage information a 'Campaign' has obtained.
ppGasInfo :: Map Text (Int, [Tx]) -> Maybe String
ppGasInfo s | s == mempty = Nothing
| otherwise = Just $ intercalate "" $ map show $ toList s
| otherwise = Just $ "Maximum gas usage:\n" ++ (intercalate "\n" $ map show $ toList s) ++ "\n"
-- | Pretty-print the status of a solved test.
ppFail :: (MonadReader x m, Has Names x, Has TxConf x) => Maybe (Int, Int) -> [Tx] -> m String

Loading…
Cancel
Save