fix(evm-rpc): tolerate per-tx null trace/stateDiff in trace_replayBlockTransactions#541
Open
elina-chertova wants to merge 1 commit into
Open
fix(evm-rpc): tolerate per-tx null trace/stateDiff in trace_replayBlockTransactions#541elina-chertova wants to merge 1 commit into
elina-chertova wants to merge 1 commit into
Conversation
…ckTransactions
Some providers return `stateDiff: null` (or `trace: null`) for an individual
transaction inside an otherwise valid trace_replayBlockTransactions 200 response.
The per-tx validator required a non-null object and threw a fatal
DataValidationError ("invalid value at /0/stateDiff: null is not an object"),
crash-looping the dump.
Make the per-tx trace/stateDiff nullable and flag the block for retry via
_isInvalid, mirroring the block-level null handling added in #497 and the
debug_* trace paths.
Adds a regression test asserting the validator accepts a per-tx null.
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
The
evm-dumpfor gnosis-mainnet is stuck in a fatal crash-loop:The upstream provider returns a valid HTTP 200 for
trace_replayBlockTransactions, but withstateDiff: nullfor an individual transaction (verified: the same gnosis block returns a properstateDiffobject from two other providers, so thenullis a provider-side defect, not inherent to the chain). BecausegetTraceTransactionReplayValidatorrequiresstateDiff(andtrace) to be a non-null object when the tracer is requested, validation throws a fatalDataValidationErrorand the whole ingestion process crashes and crash-loops — a single provider hiccup takes down the dump.#497already added tolerance for a block-levelnull(whole array). This extends the same treatment to the per-transaction case it missed (/0/stateDiff).Fix
getTraceTransactionReplayValidator: make the per-txtraceandstateDifffields nullable, so a transientnullno longer fatally fails schema validation.addTraceTxReplays: when a requested tracer isnullfor any tx, flag the block_isInvalidfor retry (mirroring the block-levelnullpath from evm-rpc: tolerate null from trace_replayBlockTransactions (fixes tempo hotblocks crash-loop) #497 and thedebug_*_isInvalidguards) instead of letting corrupt data through.This makes the process survive a genuinely-external malformed response and retry the block, rather than crash-looping. (Complementary operator action — routing gnosis trace/stateDiff traffic away from the degraded provider — is being handled separately in ops; that only removes today's trigger, whereas this stops any provider hiccup from crash-looping ingestion.)
Test
evm/evm-rpc/test/trace-replay-null.test.ts— asserts the validator accepts a per-txnullstateDiff/trace. Fails on the pre-fix code ("... null is not an object"), passes after.rush build -t @subsquid/evm-rpc— green (compiles)vitest --run(evm-rpc) — 172 passed / 28 skipped, incl. the 2 newtsc --noEmit -p tsconfig.test.json— cleanFalsification: if a provider persistently returns
nullfor a block,_isInvalidretries 5× then throws (same as every other invalid-block path) — the durable resolution to a persistently-degraded provider is the routing change, not this PR; this PR ensures a transient null can no longer crash ingestion.