Skip to content

Commit

Permalink
feat(l2g): properly return NonceTooHigh
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
smartcontracts committed Jan 26, 2023
1 parent 9be7933 commit 33acb7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/thin-toes-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@eth-optimism/l2geth': patch
---

Has l2geth return a NonceToHigh response if the txn nonce is greater than the expected nonce.
4 changes: 3 additions & 1 deletion l2geth/core/tx_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 33acb7c

Please sign in to comment.