Skip to main content
Reverting state can be helpful when testing contracts and protocols and you want to discard all state changes up to the snapshot position.
Instead of reverting state, consider forking an existing Virtual Environment instead, and do your testing on a disposable working copy.

Reverting to a snapshot

Revert distance limit

A single evm_revert can roll back at most 2000 blocks. If the snapshot is more than 2000 blocks behind the current block, the call fails with:
This affects Virtual Environments that produce blocks continuously (for example, a scheduled job minting blocks), where the target snapshot can quickly fall outside the 2000-block window. To return to a point further back, clone the Virtual Environment at the target historical block instead of reverting.

Clone at a historical block

To get a Virtual Environment whose state matches a specific past block, clone it at that block. The clone is a new, independent Virtual Environment forked at the chosen point, while the source is left untouched. There is no distance limit, so this is the way to reach a block more than 2000 blocks in the past. In the dashboard, open the Activity tab and use the clone action on the transaction at the block you want to return to. The new Virtual Environment is created with state as of that transaction’s block.
Screenshot placeholder: per-transaction clone action on the Activity tab.
Cloning at a historical block is also the right approach when you want to “fork at a specific block number.” A fork always starts from the latest block, whereas a clone can target any historical block.