Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Mar 6, 2024
1 parent 6d89cb1 commit 63c2db8
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions txpool/queue_priced_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,32 +24,38 @@ 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),
}),
},
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),
}),
},
Expand Down Expand Up @@ -116,33 +122,39 @@ 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),
}),
},
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),
}),
Expand All @@ -154,33 +166,39 @@ 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),
}),
},
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),
}),
Expand All @@ -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),
}),
},
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 63c2db8

Please sign in to comment.