Skip to content

Commit d09340b

Browse files
committed
Cleanup
1 parent adb2060 commit d09340b

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

lib/Echidna/Exec.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ execTxWithCov tx = do
248248
Just (vec, pc) -> do
249249
let txResultBit = fromEnum $ getResult $ fst r
250250
VMut.read vec pc >>= \case
251-
(opIx, depths, txResults, execQty) | not (txResults `testBit` txResultBit) -> do
252-
VMut.write vec pc (opIx, depths, txResults `setBit` txResultBit, execQty)
251+
(opIx, depths, txResults) | not (txResults `testBit` txResultBit) -> do
252+
VMut.write vec pc (opIx, depths, txResults `setBit` txResultBit)
253253
pure True -- we count this as new coverage
254254
_ -> pure False
255255
_ -> pure False
@@ -287,7 +287,7 @@ execTxWithCov tx = do
287287
-- IO for making a new vec
288288
vec <- VMut.new size
289289
-- We use -1 for opIx to indicate that the location was not covered
290-
forM_ [0..size-1] $ \i -> VMut.write vec i (-1, 0, 0, 0)
290+
forM_ [0..size-1] $ \i -> VMut.write vec i (-1, 0, 0)
291291
pure $ Just vec
292292

293293
statsRef <- getTLS env.statsRef
@@ -310,12 +310,12 @@ execTxWithCov tx = do
310310
-- of `contract` for everything; it may be safe to remove this check.
311311
when (pc < VMut.length vec) $
312312
VMut.read vec pc >>= \case
313-
(_, depths, results, execQty) | depth < 64 && not (depths `testBit` depth) -> do
314-
VMut.write vec pc (opIx, depths `setBit` depth, results `setBit` fromEnum Stop, execQty + 1)
315-
VMut.modify (fromJust maybeStatsVec) (\(execQty, revertQty) -> (execQty + 1, revertQty)) pc
313+
(_, depths, results) | depth < 64 && not (depths `testBit` depth) -> do
314+
VMut.write vec pc (opIx, depths `setBit` depth, results `setBit` fromEnum Stop)
315+
VMut.modify (fromJust maybeStatsVec) (\(execQty, revertQty) -> (execQty + 1, revertQty)) opIx
316316
writeIORef covContextRef (True, Just (vec, pc))
317-
(opIx', depths, results, execQty) -> do
318-
VMut.write vec pc (opIx', depths, results, execQty + 1)
317+
(opIx', depths, results) -> do
318+
VMut.modify (fromJust maybeStatsVec) (\(execQty, revertQty) -> (execQty + 1, revertQty)) opIx'
319319
modifyIORef' covContextRef $ \(new, _) -> (new, Just (vec, pc))
320320

321321
-- | Get the VM's current execution location

lib/Echidna/Output/Source.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ srcMapCov sc covMap statMap contracts = do
181181
linesCovered c =
182182
case Map.lookup c.runtimeCodehash covMap of
183183
Just vec -> VU.foldl' (\acc covInfo -> case covInfo of
184-
(-1, _, _, _) -> acc -- not covered
185-
(opIx, _stackDepths, txResults, _) ->
184+
(-1, _, _) -> acc -- not covered
185+
(opIx, _stackDepths, txResults) ->
186186
case srcMapForOpLocation c opIx of
187187
Just srcMap ->
188188
case srcMapCodePos sc srcMap of

lib/Echidna/Types/Coverage.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type StatsMap = Map W256 (IOVector StatsInfo)
2727
type StatsMapV = Map W256 (Vector StatsInfo)
2828

2929
-- | Basic coverage information
30-
type CoverageInfo = (OpIx, StackDepths, TxResults, ExecQty)
30+
type CoverageInfo = (OpIx, StackDepths, TxResults)
3131

3232
-- | Basic stats information
3333
type StatsInfo = (ExecQty, RevertQty)
@@ -55,7 +55,7 @@ scoveragePoints cm = do
5555
sum <$> mapM (V.foldl' countCovered 0) (Map.elems cm)
5656

5757
countCovered :: Int -> CoverageInfo -> Int
58-
countCovered acc (opIx,_,_,_) = if opIx == -1 then acc else acc + 1
58+
countCovered acc (opIx,_,_) = if opIx == -1 then acc else acc + 1
5959

6060
unpackTxResults :: TxResults -> [TxResult]
6161
unpackTxResults txResults =

0 commit comments

Comments
 (0)