-
Notifications
You must be signed in to change notification settings - Fork 682
calling evm_mine
with a timestamp
does not persist time offset
#3265
Comments
Hi @msuscens, thanks for opening this issue! I took a look at the ganache-time-traveler library and the Thank you! |
Hello @MicaiahReid , thank you for looking into this issue. I've created a public repository with a cut-down version of my full project. I've also added a README file that shows what I'm experiencing under Ganache 6.12.2 vs Ganache 7.3.1. Simply execute 'truffle test' under each version of Ganache. https://github.com/msuscens/Egg.git Please let me know if you need anything else in order to investigate. |
Hi @msuscens. I've done some digging, and you can use the It looks like the In your case, the following was happening:
From my understanding of Let me know if adding |
I did some digging and I think this may be a regression in ganache v7. Previously,
ganache/lib/subproviders/geth_api_double.js Line 557 in efa9c47
which leads to here: Line 576 in efa9c47
which leads to: ganache/lib/blockchain_double.js Line 733 in efa9c47
and finally to: ganache/lib/blockchain_double.js Line 792 in efa9c47
|
Great find, @davidmurdoch! @msuscens, hopefully using the |
Thank you @MicaiahReid / @davidmurdoch, Yes, I can confirm that using --miner.timestampIncrement 1 flag on my full project resolves the issue! Thank you both very much!! I can now finally use Ganache v7 🚀 I do have another issue with Truffle tests running with Ganache but I'll investigate further first and then post in the Q&A section. Thanks again, |
evm_mine
with a timestamp
does not persistent time offset
evm_mine
with a timestamp
does not persistent time offsetevm_mine
with a timestamp
does not persist time offset
After attempting to resolve some of the short comings of this approach, I have decided to close the PR, and address this with a simpler fix. #3506 Initially I thought it made sense to decouple BlockTime from the Blockchain, as they are separate concerns. I have subsequently learned that with timestampIncrement !== "clock", the interface between Blockchain and BlockTime becomes quite messy. The decisions made - for instance when to increment, when to apply / reset the adjustments should be made by the blockchain, but don't fit on a generalised BlockTime interface. |
@jeffsmale90 this is an issue and not a PR, so I don't think we should close it until the fix is merged 😄 |
I haven't looked into the code to confirm this yet, but it appears that when a timestamp increment is specified, the offset is persisted when I'll pick this up today and try to get a hotfix together to resolve. |
Discussed in #3264
I'm opening as an issue as suggested by @davidmurdoch
Originally posted by msuscens June 21, 2022
Hello,
I have Truffle tests that successfully pass with Ganache v6 but fail with Ganache v7.3.1. The truffle tests in question use the ganache-time-traveler utility to advance time. Specifically, the issue is with functions that need a certain amount of time to pass before they will execute (without reverting). I, therefore, use ganache-time-traveler to advance the time before executing the function. Unfortunately, with ganache 7.3.1 these functions revert even though time has been advanced by the required amount. Here is an example:
etc ...
This test passes with Ganche v6 but
eggToken.hatch
reverts under v7.3.1 with the following message:I'd appreciate any help/advice on how to resolve this issue.
I'm on a 2022 MacBook Pro (M1 Pro processor): MacOS 12.4
Truffle v5.5.3 (core: 5.5.3)
Ganache v7.0.1
Solidity - 0.8.13 (solc-js)
Node v14.15.5
Web3.js v1.5.3
Note: Even though it says "Ganache v7.0.1" above (from 'truffle version'), I've installed v7.3.1 and when I start ganache (via CL) it says "ganache v7.3.1 (@ganache/cli: 0.4.1, @ganache/core: 0.4.1)"
The text was updated successfully, but these errors were encountered: