-
Notifications
You must be signed in to change notification settings - Fork 695
evm_revert does not reset time adjustment #390
Comments
I am having same problem , How do i resolve it . |
You may wish to take a look at the pull request I created here. The fix is quite simple but I'm not sure it's the best way to do it. You can try that out in the meantime though. |
@scnale How does one go about building testrpc using your fix, exactly? Thanks! |
I haven't been using it in the last few weeks so the setup may need a few tweaks but here's what I did to test it:
(*) I think there is a cleaner way to do this with Creating a symbolic link or alias in your terminal to launch the custom testrpc may be a good idea if you're planning on using it frequently. Edit: Satisfying the other dependencies in both packages is necessary for this to work and prone to errors in my limited experience using npm. Use whatever means you deem adequate to satisfy them. |
Thanks, @scnale - got it 'working'. some dependencies failed to install, but it still works and all test cases work now. Cheers! |
Increased time cannot be reseted according to trufflesuite/ganache-cli-archive#390
Increased time cannot be reseted according to trufflesuite/ganache-cli-archive#390
Increased time cannot be reseted according to trufflesuite/ganache-cli-archive#390
patch file patch node_modules/ethereumjs-testrpc/build/cli.node.js testrpc-time.patch 83416c83416,83417
< blockNumber: blockNumber
---
> blockNumber: blockNumber,
> timeAdjustment: self.blockchain.timeAdjustment
83438a83440
> var timeAdjustment = this.snapshots[snapshot_id].timeAdjustment;
83465a83468,83469
> // The time adjustment is restored to its prior state
> self.blockchain.timeAdjustment = timeAdjustment;
|
Increased time cannot be reseted according to trufflesuite/ganache-cli-archive#390
Increased time cannot be reseted according to trufflesuite/ganache-cli-archive#390
Increased time cannot be reseted according to trufflesuite/ganache-cli-archive#390
status? will it be in soon? |
There's an open PR on this trufflesuite/ganache#2. Last I knew the changes @scnale submitted there had problems that needed fixing (see this comment). I'll double check, but I don't think that's been done yet. If someone wants to submit another PR that finishes the work, I'd be all for it. |
@scnale seems to have ghosted, and the changes he submitted were incomplete. If anyone else wants to take this on, I'd be much obliged. |
Funny, just looking for a solution to this issue as well :) |
Just made a very simple PR that helped me solve the problem for certains tests ; trufflesuite/ganache#95 |
In addition, the PR mentioned above works as expected (see comment #377928638). |
Fixed in current |
I'm also running into this issue. Which version of ganach-cli has the fix? |
Expected Behavior
(Deploy contracts)
evm_snapshot
(Pass first half of test A)
evm_increaseTime
(Pass second half of test A)
evm_revert
(Pass test B)
Current Behavior
(Deploy contracts)
evm_snapshot
(Pass first half of test A)
evm_increaseTime
(Pass second half of test A)
evm_revert
(Fail test B)
Cause:
evm_revert
did not reset the time adjustment. Test B is now run in a different time than when the snapshot was taken, and fails.Possible Solutions
increateTime
.Context
I'm trying to make my unit tests run faster by re-using setup transactions using snapshots.
Your Environment
Linux 4.10.0-33-generic #37-Ubuntu SMP x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: