From 30e511d7cf4feca7cf8433630dc2f281d500c0de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= Date: Tue, 25 Apr 2023 14:28:56 +0200 Subject: [PATCH 1/3] Enable all forks at genesis and add unit test which checks that dynamic fee tx gets rejected if london hardfork is not enabled --- txpool/txpool_test.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/txpool/txpool_test.go b/txpool/txpool_test.go index 87c02b96f1..75dea1e314 100644 --- a/txpool/txpool_test.go +++ b/txpool/txpool_test.go @@ -86,7 +86,7 @@ func newTestPoolWithSlots(maxSlots uint64, mockStore ...store) (*TxPool, error) return NewTxPool( hclog.NewNullLogger(), - forks.At(0), + chain.AllForksEnabled.At(0), storeToUse, nil, nil, @@ -1835,6 +1835,22 @@ func TestPermissionSmartContractDeployment(t *testing.T) { ErrTipAboveFeeCap, ) }) + + t.Run("dynamic fee tx placed without EIP-1559 fork enabled", func(t *testing.T) { + t.Parallel() + pool := setupPool() + pool.forks.London = false + + tx := newTx(defaultAddr, 0, 1) + tx.Type = types.DynamicFeeTx + tx.GasFeeCap = big.NewInt(10000) + tx.GasTipCap = big.NewInt(100000) + + assert.ErrorIs(t, + pool.addTx(local, signTx(tx)), + ErrInvalidTxType, + ) + }) } /* "Integrated" tests */ From 5dc15094ad26c8b317bcff5217922f08c9d7504f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= Date: Tue, 25 Apr 2023 14:32:07 +0200 Subject: [PATCH 2/3] Minor change --- txpool/txpool_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/txpool/txpool_test.go b/txpool/txpool_test.go index 75dea1e314..67f58142b2 100644 --- a/txpool/txpool_test.go +++ b/txpool/txpool_test.go @@ -1836,7 +1836,7 @@ func TestPermissionSmartContractDeployment(t *testing.T) { ) }) - t.Run("dynamic fee tx placed without EIP-1559 fork enabled", func(t *testing.T) { + t.Run("dynamic fee tx placed without eip-1559 fork enabled", func(t *testing.T) { t.Parallel() pool := setupPool() pool.forks.London = false From 66419d4c2d4edabfe35d1dbb9df53f343a2bd691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= Date: Tue, 25 Apr 2023 14:45:03 +0200 Subject: [PATCH 3/3] Fix --- txpool/txpool_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/txpool/txpool_test.go b/txpool/txpool_test.go index 67f58142b2..2cf7e354fc 100644 --- a/txpool/txpool_test.go +++ b/txpool/txpool_test.go @@ -34,6 +34,7 @@ var ( forks = &chain.Forks{ Homestead: chain.NewFork(0), Istanbul: chain.NewFork(0), + London: chain.NewFork(0), } ) @@ -86,7 +87,7 @@ func newTestPoolWithSlots(maxSlots uint64, mockStore ...store) (*TxPool, error) return NewTxPool( hclog.NewNullLogger(), - chain.AllForksEnabled.At(0), + forks.At(0), storeToUse, nil, nil,