I'm writing a test for a time-dependent solidity function. I'd like to use the increaseTime.js helper from v1.12.0 of OpenZeppelin's library.

When I try to call this helper inside my test, I get an error. For small durations like 1200 (20 minutes), I get a revert error: "Uncaught Error: VM Exception while processing transaction: revert." For larger durations like 86400 (1 day), I get "VM Exception while processing transaction: invalid opcode."

import { increaseTime } from './../contracts/openzeppelin/test/helpers/increaseTime.js';

contract('Kabocha', function(accounts) {
  describe('Pumpkin', async function() {
    it("should do a time-dependent thing", async function() {
      // setup stuff goes here
      await increaseTime(86000);

Any tips for working with this helper library? Perhaps one day is too far in the future for evm_increaseTime.

I'm using Ganache CLI v6.1.6 (ganache-core: 2.1.5) as my test chain.


In my setup, there is a step that sets a timestamp and compares against block.timestamp. When I comment out everything in the setup including this line, I can call increaseTime with no limit. However, uncommenting the timestamp setter means I can only call increaseTime with a max value of 249.

Update #2

Any step involving block.timestamp followed by increaseTime causes my code to revert. Seems like the two don't mix.

  • Comments are not for extended discussion; this conversation has been moved to chat.
    – eth
    Nov 22 '18 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.