Ganache-cli: Ganache 6.2.3 -- EVM state changes after snapshot creation survive snapshot reversal

Created on 27 Nov 2018  路  6Comments  路  Source: trufflesuite/ganache-cli

Description

Writing unit tests for the Truffle test platform and running them on Ganache CLI, when

1) an EVM snapshot is created (via evm_snapshot),
2) the EVM state changed,
3) the EVM snapshot reverted back (via evm_revert),
4) a new EVM snapshot created (via evm_snapshot),
5) the EVM state changed again

the EVM ends up in a state which contains information from the first (changed and then reverted) state.

Expected Behavior

After reverting to an snapshot, the EVM should contain no state changes that were made after the snapshot.

Current Behavior

Ganache CLI behaves different from Truffle's builtin test net (an older version of Ganache?)

Steps to Reproduce (for bugs)

  1. Check out my Truffle test project, navigate into the repo, install dependencies

    git clone https://github.com/outofgas/ganache-snapshot-issue
    cd ganache-snapshot-issue
    npm install
    
  2. Run the Truffle test suite on Truffle's internal test net

    node_modules/.bin/truffle test
    

    The tests should be successful.

  3. Open a second terminal and navigate to the repo dir and start a Ganache CLI instance

    node_modules/.bin/ganache-cli
    

    Run the Truffle test suite on Ganache's test net

    node_modules/.bin/truffle test --network ganache
    

    The tests fail. Somehow, the EVM state changes are not completely rolled back when reverting to a snapshot. Interestingly, the spurious state values become visible only after(!) the first transaction carried out after the new snapshot.

My Environment

  • uname -srm

    FreeBSD 11.2-RELEASE amd64
    
  • node --version

    v11.1.0
    
  • npm --version

    6.4.1
    
  • truffle version

    Truffle v4.1.14 (core: 4.1.14)
    Solidity v0.4.24 (solc-js)
    
  • ganache-cli --version

    Ganache CLI v6.2.3 (ganache-core: 2.3.1)
    
  • Test repo: https://github.com/outofgas/ganache-snapshot-issue
bug priority-high

Most helpful comment

Seems to be fixed in 6.2.4. Thanks a lot...

All 6 comments

This issue is caused by the same bug that is causing https://github.com/trufflesuite/ganache-cli/issues/600

@maxsam4 Thanks for linking issue #593.

@outofgas, @maxsam4 Can you try the latest ganache-cli@beta (v6.2.4-beta.1) and let us know if you're still experiencing this issue during your unit tests?

@nicholasjpaterno I just ran our suite of tests on ganache-cli v6.2.4-beta.1 and everything went smoothly. Thanks for the fix!

Fixed in [email protected].

Seems to be fixed in 6.2.4. Thanks a lot...

Was this page helpful?
0 / 5 - 0 ratings