Skip to content

chain(ethereum): treat Reth StackUnderflow/StackOverflow/OpcodeNotFound halts as deterministic#6645

Merged
incrypto32 merged 2 commits into
graphprotocol:masterfrom
cargopete:fix/reth-evm-halt-deterministic-6582
Jun 24, 2026
Merged

chain(ethereum): treat Reth StackUnderflow/StackOverflow/OpcodeNotFound halts as deterministic#6645
incrypto32 merged 2 commits into
graphprotocol:masterfrom
cargopete:fix/reth-evm-halt-deterministic-6582

Conversation

@cargopete

Copy link
Copy Markdown
Contributor

Fixes #6582.

Problem

Reth surfaces EVM halts through reth's EthApiError::EvmHalt(HaltReason), which is formatted with the reason's Debug representation:

// reth: crates/rpc/rpc-eth-types/src/error/mod.rs
#[error("EVM error: {0:?}")]
EvmHalt(HaltReason),

revm's HaltReason / InstructionResult variants are derived Debug, so they render in CamelCase with no spaces. A stack underflow therefore reaches eth_call error handling as:

EVM error: StackUnderflow

is_rpc_revert_message lower-cases the message and checks contains, so it compares against "evm error: stackunderflow". The existing space-separated entry "stack underflow" never matches this, so the error is treated as non-deterministic — the subgraph stalls/retries instead of recording a deterministic revert.

This is the same gap streamingfast/eth-go#10 closed on the Firehose side.

Fix

Add the missing reth halt variants (no spaces, matching the Debug output) to RPC_EXECUTION_ERRORS:

  • stackunderflow ← the reported bug
  • stackoverflow
  • opcodenotfound

The list already contains invalidjump and invalidfeopcode, which catch "EVM error: InvalidJump" / "InvalidFEOpcode" via this exact path — so the pattern is already established and proven; these three siblings were simply missed.

Note: reth's OutOfGas is intercepted before EvmHalt and rendered as "out of gas: ..." (with spaces), which the existing "out of gas" entry already matches — so unlike the Firehose list, a no-space outofgas is not required here.

Verification

@incrypto32

Copy link
Copy Markdown
Member

Thanks for the PR @cargopete.
Branch protection here requires signed commits, so the merge’s blocked. Mind re-signing and force-pushing this commit?

@cargopete

Copy link
Copy Markdown
Contributor Author

Thanks for the PR @cargopete.

Branch protection here requires signed commits, so the merge’s blocked. Mind re-signing and force-pushing this commit?

Sure thing, will do later today

@cargopete cargopete closed this Jun 23, 2026
@cargopete cargopete force-pushed the fix/reth-evm-halt-deterministic-6582 branch from 622030f to 07ae930 Compare June 23, 2026 18:49
@cargopete cargopete reopened this Jun 23, 2026
@cargopete

Copy link
Copy Markdown
Contributor Author

@incrypto32 should be done now

@incrypto32 incrypto32 merged commit 1ff462d into graphprotocol:master Jun 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Handle Reth StackUnderflow as deterministic

2 participants