From dca3824b5bcf8dd522587c5955cb18b3d2fd619b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= <93934272+Stefan-Ethernal@users.noreply.github.com> Date: Tue, 25 Apr 2023 15:25:09 +0200 Subject: [PATCH] Fix txpool unit tests (#1429) * Enable all forks at genesis and add unit test which checks that dynamic fee tx gets rejected if london hardfork is not enabled * Minor change * Fix --- txpool/txpool_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/txpool/txpool_test.go b/txpool/txpool_test.go index 87c02b96f1..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), } ) @@ -1835,6 +1836,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 */