Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

evm_revert regression #4093

Closed
brendene opened this issue Dec 28, 2022 · 2 comments · Fixed by #4136
Closed

evm_revert regression #4093

brendene opened this issue Dec 28, 2022 · 2 comments · Fixed by #4136

Comments

@brendene
Copy link

brendene commented Dec 28, 2022

On the latest stable release: ganache v7.7.2 (@ganache/cli: 0.8.1, @ganache/core: 0.8.1)
The last version that doesn't have the issue is 7.6.0. 7.7.0 and 7.7.2 exhibit the issue detailed below.

I am having a hard time creating a self contained repro but the issue is reliably reproduced.

ganache is launched with: ganache-cli --chain.vmErrorsOnRPCResponse true --fork.url <LOCAL INSTANCE> --fork.blockNumber 16257210 --miner.blockTime 3600 --chain.chainId 1 -v --miner.timestampIncrement 12 --wallet.deterministic --logging.debug

The miner.blockTime is set very high so that I can manually mine using evm_mine

The gist of the application flow is:

send transactions
evm_mine
send transactions
evm_mine
evm_snapshot # SNAPSHOT1
send transactions
evm_mine
evm_snapshot # SNAPSHOT2
send transactions
evm_mine
evm_revert back to #SNAPSHOT2 (this succeeds)
send transactions
evm_mine
evm_revert back to #SNAPSHOT1 (this fails)

There are no logs in from ganache, only 'Reverting to snapshot #1'
But the json response from ganache is:

{'id': 101, 'jsonrpc': '2.0', 'error': {'message': '.for is not iterable', 'stack': 'TypeError: .for is not iterable\n at ForkTrie.revertMetaData (/usr/local/lib/node_modules/ganache/dist/node/1.js:2:143320)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Blockchain.<anonymous> (/usr/local/lib/node_modules/ganache/dist/node/1.js:2:63016)\n at async Blockchain.revert (/usr/local/lib/node_modules/ganache/dist/node/1.js:2:70613)', 'code': -32700}}

And after querying for the current block, as expected the evm did not revert.

@brendene
Copy link
Author

It might be this block of code as part of the big release to support the merge:

https://github.com/trufflesuite/ganache/blame/b816de218202e3f10182c61de9bae505b3c42710/src/chains/ethereum/ethereum/src/forking/trie.ts#L99

@davidmurdoch
Copy link
Member

Yikes. The merge was an incredibly tricky and complex update. Sorry we didn't catch this already. Most of the team here is off until the 3rd or so, but we'll try to get a fix out for this as soon as we get back.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants