fix: -32602 state-unavailable errors no longer classified deterministic - #12
Merged
maoueh merged 1 commit intoJul 14, 2026
Merged
Conversation
IsGenericDeterministicError trusted the JSON-RPC code alone, so -32602 (and -32600) errors were always deemed deterministic. Some nodes reuse -32602 for state/block unavailability (pruned node), which is transient and node-capability dependent: an archive node, or the same node later, answers the same call correctly. Downstream consumers cache deterministic errors permanently, poisoning the entry forever. Add NON_DETERMINISTIC_STATE_MESSAGES guard (case-insensitive substring) excluding "state is not available", "historical state that is not available" and "missing trie node". The last case matches the exact error observed in production on Monad RPC.
sduchesneau
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rpc.IsGenericDeterministicErrortrusted the JSON-RPC error code alone: any-32602(JSON_RPC_INVALID_ARGUMENT_ERROR) or-32600(JSON_RPC_INVALID_REQUEST_ERROR) was classified deterministic.Some nodes reuse
-32602for state/block unavailability (pruned node). This is transient and node-capability dependent — an archive node, or the same node at a different time, answers the exact same call correctly. Downstream consumers (e.g.evmx) cache deterministic errors permanently, so such an error poisons the(block, to, data)cache key forever.Exact error observed in production on Monad RPC:
Fix
Add a
NON_DETERMINISTIC_STATE_MESSAGESguard (case-insensitive substring match) checked before returningtruefromIsGenericDeterministicError:state is not availablehistorical state that is not availablemissing trie node-32602/-32600with revert or other genuine argument errors stay deterministic. The geth/reth/parity/ganache message-based functions are untouched.Tests
Table-driven cases added to
TestIsDeterministicErrorandTestIsGenericDeterministicError:-32602with state-unavailable messages (incl. the exact Monad production string) →false-32602with revert / plain "Invalid argument" → stilltrue-32600unaffectedtrueAll
./rpc/tests pass.Changelog
### Fixedentry added; the existing### Changed-32602note clarified with the exception.