fix(evm-rpc): treat transaction nonce as optional for OP-stack deposit txs - #542
Open
elina-chertova wants to merge 2 commits into
Open
fix(evm-rpc): treat transaction nonce as optional for OP-stack deposit txs#542elina-chertova wants to merge 2 commits into
elina-chertova wants to merge 2 commits into
Conversation
…t txs OP-stack deposit transactions (type 0x7e) may be returned without a `nonce` field by some providers (e.g. Alchemy), while others (Dwellir/geth) include it. The strict `nonce: SMALL_QTY` validator rejected the former with a fatal DataValidationError, crash-looping the archive dumper on every Optimism/Base/etc. block. Make `nonce` optional in the Transaction schema and assert its presence only where it is actually consumed (RLP encoding of signed tx types and Cronos phantom-tx detection); deposit-tx encoding and sender recovery do not use it. Adds a regression test with a real fixture.
OP-stack deposit txs (type 0x7e) may omit `nonce`; the rpc.Transaction schema now makes it optional, so mapTransaction must tolerate undefined. Fixes the evm-normalization build failure that broke CI.
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
dump-optimism-mainnet-0(namespaceevm-archive) entered CrashLoopBackOff with a fatal:Root cause
Infra commit
248d45930("Roll out eRPC to almost every archive ingester", ~1h before onset) routed Optimism ingestion through eRPC → Alchemy instead of Dwellir. Alchemy omits thenoncefield on OP-stack deposit transactions (type0x7e); Dwellir includes it (nonce: 0x2efae9e). TheTransactionschema (rpc-data.ts:261) hadnonce: SMALL_QTY(required), so validation rejected every deposit tx from Alchemy.The surface "Alchemy 429 / CUPS cascade" was noise — the crash is a validation failure, not throttling.
Fix
rpc-data.ts:nonce→option(SMALL_QTY)(deposit txs may legitimately omit it).verification.ts: guard the 16 non-deposit encoder uses ofBigInt(tx.nonce)withassertNotNull(house style). Deposit-tx (0x7e) encoding and sender-recovery never readnonce.rpc.ts: guard the 2 Cronos phantom-txqty2Int(tx.nonce)calls (gated byisCronosMainnet, never runs on OP-stack).rpc-data.test.ts: regression test built from the real Alchemy deposit-tx fixture. Red pre-fix (reproduces the exact prod error) → green post-fix.Validation
rush build --to @subsquid/evm-rpc: clean (all 12 deps + evm-rpc).Scope
Only
optimism-mainnetshares this cause. The other stalledevm-archivenetworks have distinct failures (eRPCErrNetworkNotSupported, gnosis nullstateDiff, manta withdrawals-root, throttle-only) — coincidental cluster sharing only the rollout trigger. Not addressed here.