You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Looking for a similar functionality, basically saving/restoring snapshots of the chain state. eth-tester is doing it via some undocumented API:
# revert the state to `block_hash`block=chain.get_block_by_hash(block_hash)
chaindb=chain.chaindbchaindb._set_as_canonical_chain_head(chaindb.db, block.header, eth.constants.GENESIS_PARENT_HASH)
ifblock.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 eth.tools.builder.chain.copy(). Copies the pending transactions as well. Hopefully it's supposed to be public API and is not going away.
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: