From 33acb7c6ac19dcda93d07228acb4aabab8a4bc12 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 25 Jan 2023 20:26:27 -0500 Subject: [PATCH] feat(l2g): properly return NonceTooHigh Has the Sequencer properly return NonceTooHigh when the nonce on a transaction is higher than the nonce of the account. NonceTooHigh is not typically in this codepath, but here it makes sense because there is no mempool and the txn is being rejected outright. --- .changeset/thin-toes-remember.md | 5 +++++ l2geth/core/tx_pool.go | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/thin-toes-remember.md diff --git a/.changeset/thin-toes-remember.md b/.changeset/thin-toes-remember.md new file mode 100644 index 000000000000..c48732f2723b --- /dev/null +++ b/.changeset/thin-toes-remember.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Has l2geth return a NonceToHigh response if the txn nonce is greater than the expected nonce. diff --git a/l2geth/core/tx_pool.go b/l2geth/core/tx_pool.go index 666cfd57a150..66d91fb1acd4 100644 --- a/l2geth/core/tx_pool.go +++ b/l2geth/core/tx_pool.go @@ -555,8 +555,10 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { } // Ensure the transaction adheres to nonce ordering if rcfg.UsingOVM { - if pool.currentState.GetNonce(from) != tx.Nonce() { + if pool.currentState.GetNonce(from) > tx.Nonce() { return ErrNonceTooLow + } else if pool.currentState.GetNonce(from) < tx.Nonce() { + return ErrNonceTooHigh } } else { if pool.currentState.GetNonce(from) > tx.Nonce() {