Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions chain/ethereum/src/ethereum_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,10 @@ impl EthereumAdapter {

const XDAI_REVERT: &str = "revert";

// Deterministic Geth execution errors. We might need to expand this as
// Deterministic RPC execution errors. We might need to expand this as
// subgraphs come across other errors. See
// https://github.com/ethereum/go-ethereum/blob/cd57d5cd38ef692de8fbedaa56598b4e9fbfbabc/core/vm/errors.go
const GETH_EXECUTION_ERRORS: &[&str] = &[
const RPC_EXECUTION_ERRORS: &[&str] = &[
// The "revert" substring covers a few known error messages, including:
// Hardhat: "error: transaction reverted",
// Ganache and Moonbeam: "vm exception while processing transaction: revert",
Expand All @@ -641,10 +641,14 @@ impl EthereumAdapter {
// See f0af4ab0-6b7c-4b68-9141-5b79346a5f61 for why the gas limit is considered deterministic.
"out of gas",
"stack underflow",
"vm execution error",
"invalidjump",
"notactivated",
"invalidfeopcode",
];

let env_geth_call_errors = ENV_VARS.geth_eth_call_errors.iter();
let mut geth_execution_errors = GETH_EXECUTION_ERRORS
let mut execution_errors = RPC_EXECUTION_ERRORS
.iter()
.copied()
.chain(env_geth_call_errors.map(|s| s.as_str()));
Expand All @@ -665,9 +669,9 @@ impl EthereumAdapter {
// A successful response.
Ok(bytes) => Ok(call::Retval::Value(scalar::Bytes::from(bytes))),

// Check for Geth revert.
// Check for RPC revert.
Err(web3::Error::Rpc(rpc_error))
if geth_execution_errors
if execution_errors
.any(|e| rpc_error.message.to_lowercase().contains(e)) =>
{
reverted(&logger, &rpc_error.message)
Expand Down