diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java index 554de25ccf1..39a4f0673e8 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockTransactionSelectorTest.java @@ -827,12 +827,12 @@ public void decreaseOfMinGasPriceAtRuntimeIncludeTxThatWasPreviouslyNotSelected( public void shouldNotSelectTransactionsWithPriorityFeeLessThanConfig() { ProcessableBlockHeader blockHeader = createBlock(5_000_000, Wei.ONE); miningParameters.setMinPriorityFeePerGas(Wei.of(7)); - final Transaction tx1 = createTransaction(1, Wei.of(8), 100_000); - ensureTransactionIsValid(tx1); - // transaction tx2 should not be selected - final Transaction tx2 = createTransaction(2, Wei.of(7), 100_000); - ensureTransactionIsValid(tx2); - transactionPool.addRemoteTransactions(List.of(tx1, tx2)); + final Transaction txSelected = createTransaction(1, Wei.of(8), 100_000); + ensureTransactionIsValid(txSelected); + // transaction txNotSelected should not be selected + final Transaction txNotSelected = createTransaction(2, Wei.of(7), 100_000); + ensureTransactionIsValid(txNotSelected); + transactionPool.addRemoteTransactions(List.of(txSelected, txNotSelected)); final BlockTransactionSelector selector = createBlockSelector( @@ -845,10 +845,11 @@ public void shouldNotSelectTransactionsWithPriorityFeeLessThanConfig() { final TransactionSelectionResults results = selector.buildTransactionListForBlock(); - assertThat(results.getSelectedTransactions()).containsOnly(tx1); + assertThat(results.getSelectedTransactions()).containsOnly(txSelected); assertThat(results.getNotSelectedTransactions()) .containsOnly( - entry(tx2, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN)); + entry( + txNotSelected, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN)); } protected BlockTransactionSelector createBlockSelector( diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java index 739b4f56d7c..1ef0fa8f2ff 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LondonFeeMarketBlockTransactionSelectorTest.java @@ -222,22 +222,23 @@ public void shouldNotSelectTransactionsWithPriorityFeeLessThanConfig() { ProcessableBlockHeader blockHeader = createBlock(5_000_000, Wei.ONE); miningParameters.setMinPriorityFeePerGas(Wei.of(7)); - final Transaction tx1 = createEIP1559Transaction(1, Wei.of(8), Wei.of(8), 100_000); - ensureTransactionIsValid(tx1); + final Transaction txSelected1 = createEIP1559Transaction(1, Wei.of(8), Wei.of(8), 100_000); + ensureTransactionIsValid(txSelected1); - // transaction tx2 should not be selected - final Transaction tx2 = createEIP1559Transaction(2, Wei.of(7), Wei.of(7), 100_000); - ensureTransactionIsValid(tx2); + // transaction txNotSelected1 should not be selected + final Transaction txNotSelected1 = createEIP1559Transaction(2, Wei.of(7), Wei.of(7), 100_000); + ensureTransactionIsValid(txNotSelected1); - // transaction tx3 should be selected - final Transaction tx3 = createEIP1559Transaction(3, Wei.of(8), Wei.of(8), 100_000); - ensureTransactionIsValid(tx3); + // transaction txSelected2 should be selected + final Transaction txSelected2 = createEIP1559Transaction(3, Wei.of(8), Wei.of(8), 100_000); + ensureTransactionIsValid(txSelected2); - // transaction tx4 should not be selected - final Transaction tx4 = createEIP1559Transaction(4, Wei.of(8), Wei.of(6), 100_000); - ensureTransactionIsValid(tx4); + // transaction txNotSelected2 should not be selected + final Transaction txNotSelected2 = createEIP1559Transaction(4, Wei.of(8), Wei.of(6), 100_000); + ensureTransactionIsValid(txNotSelected2); - transactionPool.addRemoteTransactions(List.of(tx1, tx2, tx3, tx4)); + transactionPool.addRemoteTransactions( + List.of(txSelected1, txNotSelected1, txSelected2, txNotSelected2)); assertThat(transactionPool.getPendingTransactions().size()).isEqualTo(4); @@ -252,10 +253,12 @@ public void shouldNotSelectTransactionsWithPriorityFeeLessThanConfig() { final TransactionSelectionResults results = selector.buildTransactionListForBlock(); - assertThat(results.getSelectedTransactions()).containsOnly(tx1, tx3); + assertThat(results.getSelectedTransactions()).containsOnly(txSelected1, txSelected2); assertThat(results.getNotSelectedTransactions()) .containsOnly( - entry(tx2, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN), - entry(tx4, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN)); + entry( + txNotSelected1, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN), + entry( + txNotSelected2, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN)); } } diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/MinPriorityFeePerGasTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/MinPriorityFeePerGasTransactionSelectorTest.java index c200c49d5da..a86dc73ee46 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/MinPriorityFeePerGasTransactionSelectorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/MinPriorityFeePerGasTransactionSelectorTest.java @@ -57,32 +57,33 @@ public void initialize() { @Test public void shouldNotSelectWhen_PriorityFeePerGas_IsLessThan_MinPriorityFeePerGas() { var transaction = mockTransactionWithPriorityFee(minPriorityFeeParameter - 1); - assertSelection(transaction, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN); + assertSelectionResult( + transaction, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN); } @Test public void shouldSelectWhen_PriorityFeePerGas_IsEqual_MinPriorityFeePerGas() { var transaction = mockTransactionWithPriorityFee(minPriorityFeeParameter); - assertSelection(transaction, TransactionSelectionResult.SELECTED); + assertSelectionResult(transaction, TransactionSelectionResult.SELECTED); } @Test public void shouldSelectWhen_PriorityFeePerGas_IsGreaterThan_MinPriorityFeePerGas() { var transaction = mockTransactionWithPriorityFee(minPriorityFeeParameter + 1); - assertSelection(transaction, TransactionSelectionResult.SELECTED); + assertSelectionResult(transaction, TransactionSelectionResult.SELECTED); } @Test public void shouldSelectWhenPrioritySender() { var prioritySenderTransaction = mockTransactionWithPriorityFee(minPriorityFeeParameter - 1); - assertSelection( + assertSelectionResult( prioritySenderTransaction, TransactionSelectionResult.PRIORITY_FEE_PER_GAS_BELOW_CURRENT_MIN); when(prioritySenderTransaction.hasPriority()).thenReturn(true); - assertSelection(prioritySenderTransaction, TransactionSelectionResult.SELECTED); + assertSelectionResult(prioritySenderTransaction, TransactionSelectionResult.SELECTED); } - private void assertSelection( + private void assertSelectionResult( final PendingTransaction transaction, final TransactionSelectionResult expectedResult) { var actualResult = transactionSelector.evaluateTransactionPreProcessing(transaction, null); assertThat(actualResult).isEqualTo(expectedResult);