-
Notifications
You must be signed in to change notification settings - Fork 20.9k
core/vm: add a failed flag to detect tx execution status #14637
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
Conversation
which is used to indicate whether state revert happen during state transition. if child's revert flag been set, it will also affect its parent recursively
detect whether tx is reverted during state transition and save to receipt if so.
37734c1
to
f19d90f
Compare
reverted
in receiptcb7d283
to
af0c5ef
Compare
Motivation: Current problem with gas estimation is not all cases is correct using gas metrics, e.g. in the frontier contract deploys can fail without consuming all gas due to have not enough gas to store contract code. So a `failed` flag is useful which can detect the vm execution status. In Addition: the `Reverted` flag has been removed, since it is too sensitive to insert addtional field to it.
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.
LGTM
This is a really useful improvement - but wouldn't it be a lot more useful if it bubbled up the actual error, rather than just a boolean indicating an error occurred? |
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.
LGTM!
Would have liked to combine this code with some feature to allow developers to know the source of a failure: a pc
and an address
, but I guess that can be implemented later on.
Motivation for this PR:
Now the gas is estimated through the gas is consumed all. But this method does not apply to all scenes. e.g. in the frontier contract deploys can fail without consuming all gas due to have not enough gas to store contract code.
So a
failed
flag returned by vm is useful to detect whether an error occurred during the execution of the transaction. It can help to estimate gas accurately.