-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat: abstract RPC error over HaltReason
#14104
Conversation
be187a5
to
5c5521f
Compare
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.
makes sense,
some (doc) nits
ExecutionResult::Revert { .. } | ExecutionResult::Halt { .. } => { | ||
// We know that transaction succeeded with a higher gas limit before, so any failure | ||
// means that we need to increase 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.
hmm, this now exempts all haltreasons, I am not sure if this is okay.
judging from the docs it might because we don't expect those.
so this seems fine,
I'd like to keep the docs+context here
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.
last nit :)
// Both `OutOfGas` and `InvalidEFOpcode` can occur dynamically if the gas | ||
// left is too low. Treat this as an out of gas | ||
// condition, knowing that the call succeeds with a | ||
// higher gas limit. | ||
// | ||
// Common usage of invalid opcode in OpenZeppelin: | ||
// <https://github.com/OpenZeppelin/openzeppelin-contracts/blob/94697be8a3f0dfcd95dfb13ffbd39b5973f5c65d/contracts/metatx/ERC2771Forwarder.sol#L360-L367> | ||
|
||
// Increase the lowest gas limit. | ||
*lowest_gas_limit = tx_gas_limit; | ||
} | ||
err => { | ||
// These cases should be unreachable because we know the transaction | ||
// succeeds, but if they occur, treat them as an | ||
// error. |
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.
can we keep these docs, why we don't return an error on halt here?
Introduces
HaltReason
AT for EVM traits andFromEvmHalt
trait which is required to be implemented by RPC implementation error.For now the default halt reason is used everywhere because current revm does not yet have
ResultAndState
generic over it, but it should be easy to plug into existing traits once we migrate to new revm.