Skip to content

Commit d3f70b3

Browse files
MariusVanDerWijdenshekhirin
authored andcommitted
core/txpool: check if initcode size is exceeded (ethereum#26504)
* core/txpool: check if initcode size is exceeded * core/txpool: move check
1 parent 3267593 commit d3f70b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/txpool/txpool.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package txpool
1818

1919
import (
2020
"errors"
21+
"fmt"
2122
"math"
2223
"math/big"
2324
"sort"
@@ -599,6 +600,10 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
599600
if tx.Size() > txMaxSize {
600601
return ErrOversizedData
601602
}
603+
// Check whether the init code size has been exceeded.
604+
if pool.shanghai && tx.To() == nil && len(tx.Data()) > params.MaxInitCodeSize {
605+
return fmt.Errorf("%w: code size %v limit %v", core.ErrMaxInitCodeSizeExceeded, len(tx.Data()), params.MaxInitCodeSize)
606+
}
602607
// Transactions can't be negative. This may never happen using RLP decoded
603608
// transactions but may occur if you create a transaction using the RPC.
604609
if tx.Value().Sign() < 0 {

0 commit comments

Comments
 (0)