From 63c2db8955ae14e98030b3709a97eac3aff4a1be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Negovanovi=C4=87?= Date: Wed, 6 Mar 2024 15:44:52 +0100 Subject: [PATCH] Fix tests --- txpool/queue_priced_test.go | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/txpool/queue_priced_test.go b/txpool/queue_priced_test.go index ed93258504..ab273f423e 100644 --- a/txpool/queue_priced_test.go +++ b/txpool/queue_priced_test.go @@ -24,15 +24,18 @@ func Test_maxPriceQueue(t *testing.T) { unsorted: []*types.Transaction{ // Highest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(2000), GasTipCap: big.NewInt(500), }), // Lowest tx fee types.NewTx(&types.LegacyTx{ + BaseTx: &types.BaseTx{}, GasPrice: big.NewInt(100), }), // Middle tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1500), GasTipCap: big.NewInt(200), }), @@ -40,16 +43,19 @@ func Test_maxPriceQueue(t *testing.T) { sorted: []*types.Transaction{ // Highest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(2000), GasTipCap: big.NewInt(500), }), // Middle tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1500), GasTipCap: big.NewInt(200), }), // Lowest tx fee types.NewTx(&types.LegacyTx{ + BaseTx: &types.BaseTx{}, GasPrice: big.NewInt(100), }), }, @@ -116,16 +122,19 @@ func Test_maxPriceQueue(t *testing.T) { unsorted: []*types.Transaction{ // Highest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(3000), GasTipCap: big.NewInt(100), }), // Lowest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1000), GasTipCap: big.NewInt(100), }), // Middle tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(2000), GasTipCap: big.NewInt(100), }), @@ -133,16 +142,19 @@ func Test_maxPriceQueue(t *testing.T) { sorted: []*types.Transaction{ // Highest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasTipCap: big.NewInt(100), GasFeeCap: big.NewInt(3000), }), // Middle tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(2000), GasTipCap: big.NewInt(100), }), // Lowest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1000), GasTipCap: big.NewInt(100), }), @@ -154,16 +166,19 @@ func Test_maxPriceQueue(t *testing.T) { unsorted: []*types.Transaction{ // Highest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1000), GasTipCap: big.NewInt(300), }), // Lowest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1000), GasTipCap: big.NewInt(100), }), // Middle tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1000), GasTipCap: big.NewInt(200), }), @@ -171,16 +186,19 @@ func Test_maxPriceQueue(t *testing.T) { sorted: []*types.Transaction{ // Highest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1000), GasTipCap: big.NewInt(300), }), // Middle tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1000), GasTipCap: big.NewInt(200), }), // Lowest tx fee types.NewTx(&types.DynamicFeeTx{ + BaseTx: &types.BaseTx{}, GasFeeCap: big.NewInt(1000), GasTipCap: big.NewInt(100), }), @@ -192,28 +210,34 @@ func Test_maxPriceQueue(t *testing.T) { unsorted: []*types.Transaction{ // Highest tx fee types.NewTx(&types.LegacyTx{ + BaseTx: &types.BaseTx{}, GasPrice: big.NewInt(1000), }), // Lowest tx fee types.NewTx(&types.LegacyTx{ + BaseTx: &types.BaseTx{}, GasPrice: big.NewInt(100), }), // Middle tx fee types.NewTx(&types.LegacyTx{ + BaseTx: &types.BaseTx{}, GasPrice: big.NewInt(500), }), }, sorted: []*types.Transaction{ // Highest tx fee types.NewTx(&types.LegacyTx{ + BaseTx: &types.BaseTx{}, GasPrice: big.NewInt(1000), }), // Middle tx fee types.NewTx(&types.LegacyTx{ + BaseTx: &types.BaseTx{}, GasPrice: big.NewInt(500), }), // Lowest tx fee types.NewTx(&types.LegacyTx{ + BaseTx: &types.BaseTx{}, GasPrice: big.NewInt(100), }), }, @@ -301,10 +325,10 @@ func generateTx(i int) *types.Transaction { case types.LegacyTxType: minGasPrice := 1000 * i maxGasPrice := 100000 * i - tx = types.NewTx(&types.LegacyTx{}) + tx = types.NewTx(&types.LegacyTx{BaseTx: &types.BaseTx{}}) tx.SetGasPrice(new(big.Int).SetInt64(int64(rand.Intn(maxGasPrice-minGasPrice) + minGasPrice))) case types.DynamicFeeTxType: - tx = types.NewTx(&types.DynamicFeeTx{}) + tx = types.NewTx(&types.DynamicFeeTx{BaseTx: &types.BaseTx{}}) minGasFeeCap := 1000 * i maxGasFeeCap := 100000 * i