diff --git a/state/executor.go b/state/executor.go index a9ff0c5c93..a4f8d932e0 100644 --- a/state/executor.go +++ b/state/executor.go @@ -20,6 +20,7 @@ import ( const ( SpuriousDragonMaxCodeSize = 24576 + TxPoolMaxInitCodeSize = 2 * SpuriousDragonMaxCodeSize TxGas uint64 = 21000 // Per transaction not creating a contract TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract diff --git a/txpool/txpool.go b/txpool/txpool.go index e48a2a4af2..d9d3b13102 100644 --- a/txpool/txpool.go +++ b/txpool/txpool.go @@ -616,7 +616,7 @@ func (p *TxPool) validateTx(tx *types.Transaction) error { return ErrSmartContractRestricted } - if p.forks.EIP158 && len(tx.Input) > state.SpuriousDragonMaxCodeSize { + if p.forks.EIP158 && len(tx.Input) > state.TxPoolMaxInitCodeSize { return runtime.ErrMaxCodeSizeExceeded } } diff --git a/txpool/txpool_test.go b/txpool/txpool_test.go index 996d6780b7..2e203621c7 100644 --- a/txpool/txpool_test.go +++ b/txpool/txpool_test.go @@ -1750,12 +1750,12 @@ func TestPermissionSmartContractDeployment(t *testing.T) { ) }) - t.Run("Input larger then the MaxInitCodeSize", func(t *testing.T) { + t.Run("Input larger than the TxPoolMaxInitCodeSize", func(t *testing.T) { t.Parallel() pool := setupPool() pool.forks.EIP158 = true - input := make([]byte, state.SpuriousDragonMaxCodeSize+1) + input := make([]byte, state.TxPoolMaxInitCodeSize+1) _, err := rand.Read(input) require.NoError(t, err) @@ -1769,12 +1769,12 @@ func TestPermissionSmartContractDeployment(t *testing.T) { ) }) - t.Run("Input the same as MaxInitCodeSize", func(t *testing.T) { + t.Run("Input the same as TxPoolMaxInitCodeSize", func(t *testing.T) { t.Parallel() pool := setupPool() pool.forks.EIP158 = true - input := make([]byte, state.SpuriousDragonMaxCodeSize) + input := make([]byte, state.TxPoolMaxInitCodeSize) _, err := rand.Read(input) require.NoError(t, err)