Repository navigation
fix(evm-rpc): treat an omitted withdrawals array as empty when verifying withdrawalsRoot - #604
Open
SQD-Trevor-Agent wants to merge 1 commit into
Open
SQD-Trevor-Agent wants to merge 1 commit into
SQD-Trevor-Agent wants to merge 1 commit into
Conversation
…ing withdrawalsRoot
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.
Cause (proven)
dump-cronos-mainnet-traceless-0(evm-archivenamespace) was inCrashLoopBackOff(17+ restarts). The fatal error, from the pod's previous-container logs, is a non-retryableAssertionErrorinRpc.mapBlock:Cronos runs with
--verify-withdrawals-root. InmapBlock, whenblock.withdrawalsRoot != nullthe code didassertNotNull(block.withdrawals). Cronos (a Cosmos-EVM chain) has no withdrawals: its headerwithdrawalsRootis the canonical empty-trie root0x56e81f17…b421and the block body carrieswithdrawals: []. Fetched directly, both independent providers (dwellir and uniblock) returnwithdrawals: []with that empty root — the on-chain data is well-formed. But the response occasionally arrives with the emptywithdrawalsarray omitted (undefined), andassertNotNullthen turns that transient omission into a process crash — a crash-loop, since the dumper re-reaches the same block on every restart.This was confirmed as transient, not corrupt data: after the eRPC cache for block 101503527 was re-warmed, the dumper processed it cleanly and advanced past it (restart count held steady) — i.e. the field was present again.
Fix
Treat an omitted
withdrawalsarray as[](block.withdrawals ?? []). The subsequentassert.equal(block.withdrawalsRoot, computedRoot)still guards correctness: an empty list computes to the empty root (so Cronos verifies), while a genuinely missing non-empty set computes to the empty root and fails verification instead of being silently accepted.Test (red→green)
test/rpc.test.ts:tolerates an omitted empty withdrawals array— a block with the emptywithdrawalsRootand nowithdrawalsfield verifies and returns 1 block.still rejects a missing non-empty withdrawals set— a block with a non-emptywithdrawalsRootand nowithdrawalsfield throwsfailed to verify withdrawals root.pre-fix:
Tests 2 failed(both throw theassertNotNullfalsy-value AssertionError)post-fix:
Tests 2 passedfull
@subsquid/evm-rpcsuite green (rush build -t @subsquid/evm-rpcclean;tsc --noEmit -p tsconfig.test.jsonclean). One unrelated base-mainnet sender-recovery test hits the 5 s default timeout on slow hardware and passes at--testTimeout=60000.Falsification
If
dump-cronos-mainnet-traceless-0still exits with thisassertNotNullAssertionError after this change, the omission is not what crashes it. If it instead starts failingfailed to verify withdrawals root, a provider is returning a non-emptywithdrawalsRootwithout the matchingwithdrawals— a genuine provider data-quality issue to raise upstream.Related to #551 (same crash-loop class — a transient provider/proxy response killing the dumper) but a distinct path: #551 converts schema-validation errors to retries; this block passes schema validation (
withdrawalsis optional) and crashes later inmapBlock.