I see that is it is possible to define the timestamp of the next block (see here) in this way:

await network.provider.send("evm_setNextBlockTimestamp", [1625097600]);
await network.provider.send("evm_mine");

but what about setting the block number?

My contracts use block.number to perform operations and I need to verify that they act correctly by mining a block with a greater height.

  • 2
    You can use the evm_mine method, but if you want to mine multiple blocks you'll need to call it as many times as you need. But this is not practical if you want to advance thousands of blocks. We are going to add a new method that adds support for this. May 31 at 11:48
  • @FrancoVictorio is there an update on this?
    – TommyF
    Jun 23 at 5:40
  • You can subscribe to this issue to get notified when this is implemented: github.com/nomiclabs/hardhat/issues/1112 Jul 2 at 18:14

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.