-
Notifications
You must be signed in to change notification settings - Fork 679
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
Piper/refactor api for access to state db #621
Piper/refactor api for access to state db #621
Conversation
40d9a7a
to
6462b37
Compare
825803e
to
3540dd0
Compare
@carver mind looking this over. The gas estimation tests are now returning different numbers (looks to be consistently off by |
Problems that remain or surfaced with this PR.
|
return min(gas_plus_buffer, state.gas_limit) | ||
|
||
|
||
double_execution_cost = execute_plus_buffer(2) |
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.
This wasn't used anywhere and the new gas estimation API using the binary search seemed categorically superior so... removing this.
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.
Cool, good progress. Just one piece that I think is redundant.
evm/estimators/gas.py
Outdated
computation = state.do_call(transaction) | ||
snapshot = state.snapshot() | ||
try: | ||
computation = state.do_call(transaction) |
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.
do_call()
already does the snapshot/revert internally. Based on the name (and its presumed equivalence to rpc api's eth_call
), it seems reasonable to expect do_call()
to continue handling that. So I think this method's change can be undone.
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.
Also, we should be able to remove do_call
if we get enough of the stateless/pure stuff done right. Just calling down into one of the deeper APIs which doesn't mutate and throwing away the state diff (or something like that).
replaces #611
What was wrong?
The original context manager API for dealing with the
account_db
was built to make sure that thestate_root
stayed updated.I'm of the opinion that 1) we no longer need this mechanism and 2) that the readability overhead isn't worth it anymore.
How was it fixed?
Still a WIP but the plan is to take steps towards making
State
fully immutable. Things likeapply_transaction
and/orexecute_transaction
will return eitherstate_root, computation
or maybestate_diff, computation
.All of the other things like creation of the receipt will move upwards in the stack.
Cute Animal Picture