-
Notifications
You must be signed in to change notification settings - Fork 133
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
Upgrade to Py-EVM 0.2.0a10 compatible #53
Conversation
@pipermerriam it needs review, thanks! |
@@ -249,11 +249,11 @@ def take_snapshot(self): | |||
def revert_to_snapshot(self, snapshot): | |||
block = self.chain.get_block_by_hash(snapshot) | |||
if block.number > 0: | |||
self.chain.chaindb.set_as_canonical_chain_head(block.header) | |||
self.chain.chaindb._set_as_canonical_chain_head(block.header) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ewww, do we no longer have a public API we can access for this? We should fix that (not now but soon) by moving it back to being a public API.
cc @carver to ask what the reason was for making this private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some ways, it was to highlight issues like this. Headers entered this way would not have a score lookup, or a hash->header lookup. You should only call this if you really know what you're doing. Giving callers a way to reach into the EVM and violate its own fork choice rule seems like asking for trouble.
The public call should generally be to persist_header_to_db()
. Or, in this case, it seems like we should actually be using py-evm's own snapshot()
and revert()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, off the top of my head, the py-evm snapshot()
and revert()
methods only work within block boundaries. Need to go recheck this. If that's the case we need to come up with an alternate solution.
Good to go when CI passes. I'll get you a release when merged. Feel free to poke me if it seems like I've forgotten |
@hwwhww released as |
Export type annotations to importing projects
What was wrong?
The interface of Py-EVM is changed, so it's not compatible with the latest Py-EVM.
How was it fixed?
eth_tester.backends.pyevm.main._execute_and_revert_transaction
.BaseChainDB.set_as_canonical_chain_head
was renamed toBaseChainDB._set_as_canonical_chain_head
, so I also have to change whereeth-tester
calls this function, but it may look not good to call a protected function of py-evm. Do we need to open an issue for that?Cute Animal Picture