trufflesuite/ganache

There is no way to undo evm_increaseTime

hodlbank opened this issue · 3 comments

Expected Behavior

There is no way to undo evm_increaseTime. See "Current Behavior".

Current Behavior

  • evm_increaseTime does not accept negative values, treats them as 0.
  • evm_snapshot does not capture current BlockchainDouble.timeAdjustment , so...
  • ... evm_revert does not undo effects of evm_increaseTime

Possible Solution

Either:

  • add evm_setTime geth API.
  • make evm_increaseTime to accept negative values.
  • make evm_snapshot capture current BlockchainDouble.timeAdjustment and evm_revert to restore snapshot including time.

Steps to Reproduce (for bugs)

  1. Start testrpc
  2. Note current time
  3. issue evm_snapshot
  4. issue evm_increaseTime(365 * 86400)
  5. issue evm_revert
  6. observe current testrpc time, which is still 365 days from now in future.

Context

We make snapshots and do some test pieces inside these snapshots.
Calls to evm_increaseTime alters times outside of snapshots, affecting other tests.

Your Environment

  • Version used: EthereumJS TestRPC v4.0.1 (ganache-core: 1.0.1)
  • Environment name and version: NodeJS v6.11.0
  • Server type and version: Truffle v3.4.3 (core: 3.4.1)
  • Operating System and version: Linux 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

This is addressed in PR #2. trufflesuite/ganache-cli-archive#390 is the testrpc related issue. This is a fairly debilitating bug.

#81

here's the fix <3 w tests!!

Closed by #2