Skip to content

Commit

Permalink
core/txpool: check if initcode size is exceeded (#26504)
Browse files Browse the repository at this point in the history
* core/txpool: check if initcode size is exceeded

* core/txpool: move check
  • Loading branch information
MariusVanDerWijden authored Jan 18, 2023
1 parent 4a3fb58 commit a35b654
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/txpool/txpool.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package txpool

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

0 comments on commit a35b654

Please sign in to comment.