Skip to content

fix(evm-rpc): treat transaction nonce as optional for OP-stack deposit txs - #542

Open
elina-chertova wants to merge 2 commits into
masterfrom
alert-fix/YgI6h3-optimism-deposit-nonce
Open

fix(evm-rpc): treat transaction nonce as optional for OP-stack deposit txs#542
elina-chertova wants to merge 2 commits into
masterfrom
alert-fix/YgI6h3-optimism-deposit-nonce

Conversation

@elina-chertova

Copy link
Copy Markdown
Contributor

Problem

dump-optimism-mainnet-0 (namespace evm-archive) entered CrashLoopBackOff with a fatal:

DataValidationError: fullTransactions: invalid value at /0/nonce: undefined is not a hex encoded natural number

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 the nonce field on OP-stack deposit transactions (type 0x7e); Dwellir includes it (nonce: 0x2efae9e). The Transaction schema (rpc-data.ts:261) had nonce: 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: nonceoption(SMALL_QTY) (deposit txs may legitimately omit it).
  • verification.ts: guard the 16 non-deposit encoder uses of BigInt(tx.nonce) with assertNotNull (house style). Deposit-tx (0x7e) encoding and sender-recovery never read nonce.
  • rpc.ts: guard the 2 Cronos phantom-tx qty2Int(tx.nonce) calls (gated by isCronosMainnet, 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

  • Full evm-rpc suite: 172 passed, 0 failed (existing Cronos nonce tests still pass).
  • rush build --to @subsquid/evm-rpc: clean (all 12 deps + evm-rpc).

Scope

Only optimism-mainnet shares this cause. The other stalled evm-archive networks have distinct failures (eRPC ErrNetworkNotSupported, gnosis null stateDiff, manta withdrawals-root, throttle-only) — coincidental cluster sharing only the rollout trigger. Not addressed here.

…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.
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.

2 participants