-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undo transactions #2041
Comments
Looking for a similar functionality, basically saving/restoring snapshots of the chain state. # revert the state to `block_hash`
block = chain.get_block_by_hash(block_hash)
chaindb = chain.chaindb
chaindb._set_as_canonical_chain_head(chaindb.db, block.header, eth.constants.GENESIS_PARENT_HASH)
if block.number > 0:
chain.import_block(block)
else:
chain = chain.from_genesis_header(chaindb.db, block.header) This works, but it doesn't restore the state of pending transactions (if any), and it uses a private method, so it can break at any moment, and cannot be typechecked. I wonder if there's an official way of doing snapshots? |
In case anyone bumps into this issue, I've pivoted to just copy the chain via |
I'm trying to test smart contract security issues with py-evm. Suppose i execute a set of transactions, check out the contract state after the transactions and find no loophole triggered. The problem is how can i undo the latest one or two executed transactions (for further test)? Or, how can i set the chain state to the precise state where several designated transactions are executed?
Hope to know, thanks a lot!
The text was updated successfully, but these errors were encountered: