Commit 7d083a21 authored by Liam Horne's avatar Liam Horne Committed by GitHub

Merge pull request #1257 from ethereum-optimism/fix/l2-geth-nonces

l2geth: only accept txs with exact nonce
parents 50f0d97b 709c85d6
---
'@eth-optimism/l2geth': patch
---
Prevents the sequencer from accepting transactions with a too high nonce
...@@ -560,9 +560,15 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { ...@@ -560,9 +560,15 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
return ErrUnderpriced return ErrUnderpriced
} }
// Ensure the transaction adheres to nonce ordering // Ensure the transaction adheres to nonce ordering
if vm.UsingOVM {
if pool.currentState.GetNonce(from) != tx.Nonce() {
return ErrNonceTooLow
}
} else {
if pool.currentState.GetNonce(from) > tx.Nonce() { if pool.currentState.GetNonce(from) > tx.Nonce() {
return ErrNonceTooLow return ErrNonceTooLow
} }
}
// Transactor should have enough funds to cover the costs // Transactor should have enough funds to cover the costs
// cost == V + GP * GL // cost == V + GP * GL
if vm.UsingOVM { if vm.UsingOVM {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment