diff --git a/core/tx_pool.go b/core/tx_pool.go index cfa86f988e..5fa2b5c479 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -18,6 +18,7 @@ package core import ( "errors" + "fmt" "math" "math/big" "sort" @@ -614,6 +615,10 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error { if uint64(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", 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 { diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index e7e98339d0..4112361b38 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -64,9 +64,12 @@ var ( // JumpTable contains the EVM opcodes supported at a given fork. type JumpTable [256]*operation +// newShanghaiInstructionSet returns the frontier, homestead, byzantium, +// contantinople, istanbul, petersburg, berlin, london and shanghai instructions. func newShanghaiInstructionSet() JumpTable { instructionSet := newLondonInstructionSet() - enable3860(&instructionSet) + enable3855(&instructionSet) // PUSH0 instruction https://eips.ethereum.org/EIPS/eip-3855 + enable3860(&instructionSet) // Limit and meter initcode https://eips.ethereum.org/EIPS/eip-3860 return instructionSet } diff --git a/params/version.go b/params/version.go index a26f0b46cb..b745a58bdc 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 3 // Major version component of the current release VersionMinor = 2 // Minor version component of the current release - VersionPatch = 1 // Patch version component of the current release + VersionPatch = 2 // Patch version component of the current release VersionMeta = "alpha" // Version metadata to append to the version string )