Skip to content

Commit fbd6f50

Browse files
chain(ethereum): Expand deterministic RPC execution errors list
Signed-off-by: Maksim Dimitrov <dimitrov.maksim@gmail.com>
1 parent 5525bcd commit fbd6f50

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

chain/ethereum/src/call_helper.rs

Lines changed: 8 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,15 @@ 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",
5659
];
5760

5861
/// Helper that checks if a geth style RPC error message corresponds to a revert.
59-
fn is_geth_revert_message(message: &str) -> bool {
62+
fn is_rpc_revert_message(message: &str) -> bool {
6063
let env_geth_call_errors = ENV_VARS.geth_eth_call_errors.iter();
61-
let mut execution_errors = GETH_EXECUTION_ERRORS
64+
let mut execution_errors = RPC_EXECUTION_ERRORS
6265
.iter()
6366
.copied()
6467
.chain(env_geth_call_errors.map(|s| s.as_str()));
@@ -90,7 +93,7 @@ pub fn interpret_eth_call_error(
9093
}
9194

9295
if let RpcError::ErrorResp(rpc_error) = &err {
93-
if is_geth_revert_message(&rpc_error.message) {
96+
if is_rpc_revert_message(&rpc_error.message) {
9497
return reverted(logger, &rpc_error.message);
9598
}
9699
}

0 commit comments

Comments
 (0)