From 308f7a3dbc5b21fbe4d5f6ab4587672fba26a419 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Wed, 24 Sep 2025 10:44:01 +0800 Subject: [PATCH] core/txpool: add nonce eip-2681 check --- core/txpool/validation.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/txpool/validation.go b/core/txpool/validation.go index df53f30a86..4b54eac50d 100644 --- a/core/txpool/validation.go +++ b/core/txpool/validation.go @@ -116,6 +116,10 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types if _, err := types.Sender(signer, tx); err != nil { return fmt.Errorf("%w: %v", ErrInvalidSender, err) } + // Limit nonce to 2^64-1 per EIP-2681 + if tx.Nonce()+1 < tx.Nonce() { + return core.ErrNonceMax + } // Ensure the transaction has more gas than the bare minimum needed to cover // the transaction metadata intrGas, err := core.IntrinsicGas(tx.Data(), tx.AccessList(), tx.SetCodeAuthorizations(), tx.To() == nil, true, rules.IsIstanbul, rules.IsShanghai)