feat: ExecutionError utils #83
0xpolarzero
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Would love to get some
ExecutionError
/EvmError
utils for classifying and decoding raw hex data returned from a failed transaction into a human-readable output.If this fits into ox, I'll be happy to open a PR to implement!
Some context below:
Proposal:
ExecutionError
/EvmError
module — standard EVM-error decodingProblem
Every client (Geth, Reth, Anvil, Hardhat, …) returns execution failures differently. A few examples:
Yet the raw revert data always follows one of four ABI patterns:
Ox lacks a single helper that turns this hex blob into something human-readable.
API sketch
This could roughly look like this:
Implementation notes
Essentially uses ox utilities (
Hex
,Bytes
,AbiParameters
,AbiError
).Map known panic codes (0x01, 0x11, 0x12, …) to Solidity descriptions, which doesn't need to be guessed.
If
abi
is provided, it can fully decode the error.Reference
RevertError
definition and doc-comment (reth.rs)RevertReason::decode
(alloy.rs)abi.UnpackRevert
docs line (pkg.go.dev)RevertDecoder
support (github.com)Quick example
This would basically allow to trade the returned data for a unified error object, with a known format, regardless of the client implementation.
Link to deep research with o3
Beta Was this translation helpful? Give feedback.
All reactions