Skip to content

Commit fe93a5b

Browse files
rappiegustavo-grieco
authored andcommitted
Proper fix by Emilio
1 parent ee8825b commit fe93a5b

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

lib/Echidna/Exec.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import Echidna.Types (ExecException(..), fromEVM, emptyAccount)
4040
import Echidna.Types.Config (Env(..), EConfig(..), UIConf(..), OperationMode(..), OutputFormat(Text))
4141
import Echidna.Types.Coverage (CoverageInfo)
4242
import Echidna.Types.Solidity (SolConf(..))
43-
import Echidna.Types.Tx (TxCall(..), Tx(call, dst), TxResult(..), initialTimestamp, initialBlockNumber, getResult)
43+
import Echidna.Types.Tx (TxCall(..), Tx(call, dst, delay), TxResult(..), initialTimestamp, initialBlockNumber, getResult)
4444
import Echidna.Utility (getTimestamp, timePrefix)
4545

4646
-- | Broad categories of execution failures: reversions, illegal operations, and ???.
@@ -184,6 +184,10 @@ execTxWith executeTx tx = do
184184
burnedGas <- gets (.burned)
185185
-- If a transaction reverts reset VM to state before the transaction.
186186
put vmBeforeTx
187+
-- Re-apply the time/block advancement from the transaction's delay.
188+
-- Time doesn't go backwards on revert, only EVM state does.
189+
let txDelay = tx.delay
190+
#block %= \b -> advanceBlock b txDelay
187191
-- Undo reset of some of the VM state.
188192
-- Otherwise we'd lose all information about the reverted transaction like
189193
-- contract address, calldata, result and traces.

lib/Echidna/Shrink.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ shrinkTest vm test = do
5959
_ -> pure Nothing
6060

6161
replaceByNoCall :: Tx -> Tx
62-
replaceByNoCall tx = tx { call = NoCall, delay = (0, 0) }
62+
replaceByNoCall tx = tx { call = NoCall }
6363

6464
-- | Given a sequence of transactions, remove useless NoCalls. These are NoCalls
6565
-- that have both zero increment in timestamp and block number.

0 commit comments

Comments
 (0)