Repository navigation
fix(evm-rpc): validate transaction nonce as a wide quantity for Tempo 0x76 uint64 nonces - #598
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
… 0x76 uint64 nonces
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-tempo-moderato-0(namespaceevm-archive) was inCrashLoopBackOff(14+ restarts), which also tripped the "no data" alert. The fatal error, from the pod's previous-container logs:Block
0x2580bc7(39324103) on Tempo testnet (chainId0xa5bf= 42431) contains a type0x76Tempo transaction whosenonceis a full uint64 (0xffffffffffffffff, paired with a separatenonceKeyfor account abstraction). TheTransactionschema inevm/evm-rpc/src/rpc-data.tsvalidatednoncewithSMALL_QTY, which casts to a JSnumberand rejects anything aboveNumber.MAX_SAFE_INTEGER(2^53-1). Every fetch of this block therefore failed validation with a non-retryableDataValidationErrorand killed the dumper — a deterministic crash-loop, not a transient one.The data is legitimate on-chain data, not corruption: the rest of the transaction validates,
calculateTransactionsRootreproduces the block'stransactionsRoot(0x75823a8f…) andrecoverTxSenderrecovers the correctfromfor all txs including the0x76one — the verification/RLP path already treatsnonceas a wide value viaBigInt(tx.nonce)(verification.ts:655). Only the schema validator was too narrow.This corrects an oversight in the original Tempo support (#446), which added the
0x76fields and encoding but leftnonce: SMALL_QTY.Fix
Validate
Transaction.nonceasQTY(hex quantity →bigint) instead ofSMALL_QTY. This is a pure validation relaxation: the evm-rpc pipeline validates but never casts the result (getResultValidatorreturns the raw object), the exportedTransactionsource type is unchanged (stringboth before and after), and the dumper writes the untouched raw RPC JSON viatoRawBlock— so there is no change to on-disk data for any network, only that legitimate wide nonces stop crashing validation.Test (red → green)
Added fixture
evm/evm-rpc/test/fixtures/tempoModerato/39324103/block.json— the real failing block (5 txs, one0x76withnonce: "0xffffffffffffffff"). It is auto-discovered bytest/verification.test.ts.tempoModerato block 39324103 > schema validationfails (expected ValidationFailure to be undefined)schema validation,blockHash verification,transactionsRoot verification,transaction sender recovery, etc.transactionsRoot verificationandtransaction sender recoverypass both pre- and post-fix, proving the uint64 nonce is genuine on-chain data that encodes/recovers correctly.@subsquid/evm-rpcsuite green (442 passed | 29 skipped; one unrelated pre-existingbase-mainnetsender-recovery test is flaky on the default 5s timeout and passes at--testTimeout=30000).rush build -t @subsquid/evm-rpcclean;tsc --noEmitclean;rush change --verifypasses.Falsification
If
dump-tempo-moderato-0still exits with aDataValidationErrorafter this change, the failure is on a different field — re-read the stack. IftransactionsRoot verificationfor the fixture ever fails, the0x76RLP encoding (not the nonce width) is wrong.Related
Related to #551 (retry transient malformed block results), different root cause: #551 handles a transient proxy glitch that drops
nonce(retrying self-heals). This block's nonce is present, valid, and deterministic — retrying would loop forever; the validator itself must accept it. Not related to #591 (prestate-tracer state-diff nonce).TempoSignedAuthorization.nonceand evm-normalization'sqty2Int(src.nonce)keep the narrowernumberhandling and are out of scope here (not exercised by this block; the dumper does not call them).