Ensure to get the next block timestamp

This commit is contained in:
Arnaud 2025-06-09 09:16:56 +02:00
parent abdbb48a3c
commit 98e73ed0a0
No known key found for this signature in database
GPG Key ID: 20E40A5D3110766F

View File

@ -12,7 +12,11 @@ async function snapshot() {
async function revert() {
const { id, time, automine } = snapshots.pop()
await ethers.provider.send("evm_revert", [id])
await ethers.provider.send("evm_setNextBlockTimestamp", [time])
const current = await currentTime()
const nextTime = Math.max(time + 1, current + 1)
await ethers.provider.send("evm_setNextBlockTimestamp", [nextTime])
await ethers.provider.send("evm_setAutomine", [automine])
}