Skip to content

Commit 8d3dcb2

Browse files
chain(ethereum): Expand deterministic RPC execution errors list (#6355)
* chain(ethereum): Expand deterministic RPC execution errors list Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com> * chain(ethereum): Add reth's invalidfeopcode Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com> --------- Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com>
1 parent f76c9ee commit 8d3dcb2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

chain/ethereum/src/call_helper.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ const PARITY_REVERT_PREFIX: &str = "revert";
3636

3737
const XDAI_REVERT: &str = "revert";
3838

39-
// Deterministic Geth execution errors. We might need to expand this as
39+
// Deterministic RPC execution errors. We might need to expand this as
4040
// subgraphs come across other errors. See
4141
// https://github.com/ethereum/go-ethereum/blob/cd57d5cd38ef692de8fbedaa56598b4e9fbfbabc/core/vm/errors.go
42-
const GETH_EXECUTION_ERRORS: &[&str] = &[
42+
const RPC_EXECUTION_ERRORS: &[&str] = &[
4343
// The "revert" substring covers a few known error messages, including:
4444
// Hardhat: "error: transaction reverted",
4545
// Ganache and Moonbeam: "vm exception while processing transaction: revert",
@@ -53,12 +53,16 @@ const GETH_EXECUTION_ERRORS: &[&str] = &[
5353
// See f0af4ab0-6b7c-4b68-9141-5b79346a5f61 for why the gas limit is considered deterministic.
5454
"out of gas",
5555
"stack underflow",
56+
"vm execution error",
57+
"invalidjump",
58+
"notactivated",
59+
"invalidfeopcode",
5660
];
5761

5862
/// Helper that checks if a geth style RPC error message corresponds to a revert.
59-
fn is_geth_revert_message(message: &str) -> bool {
63+
fn is_rpc_revert_message(message: &str) -> bool {
6064
let env_geth_call_errors = ENV_VARS.geth_eth_call_errors.iter();
61-
let mut execution_errors = GETH_EXECUTION_ERRORS
65+
let mut execution_errors = RPC_EXECUTION_ERRORS
6266
.iter()
6367
.copied()
6468
.chain(env_geth_call_errors.map(|s| s.as_str()));
@@ -90,7 +94,7 @@ pub fn interpret_eth_call_error(
9094
}
9195

9296
if let RpcError::ErrorResp(rpc_error) = &err {
93-
if is_geth_revert_message(&rpc_error.message) {
97+
if is_rpc_revert_message(&rpc_error.message) {
9498
return reverted(logger, &rpc_error.message);
9599
}
96100
}

0 commit comments

Comments
 (0)