From 3cc7fbcc35ee91f529fee3bffa5530fc76fa598d Mon Sep 17 00:00:00 2001 From: Justin Florentine Date: Tue, 7 Nov 2023 15:38:29 -0500 Subject: [PATCH] test adjustments Signed-off-by: Justin Florentine --- .../besu/ethereum/core/TransactionTestFixture.java | 11 +++++------ .../eth/transactions/AbstractTransactionPoolTest.java | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/TransactionTestFixture.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/TransactionTestFixture.java index 933e6b3ce0b..d851a76ad30 100644 --- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/TransactionTestFixture.java +++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/TransactionTestFixture.java @@ -85,12 +85,11 @@ public Transaction createTransaction(final KeyPair keys) { builder.maxFeePerGas(maxFeePerGas.orElse(Wei.of(5000))); builder.accessList(accessListEntries.orElse(List.of())); builder.maxFeePerBlobGas(maxFeePerBlobGas.orElse(Wei.ONE)); - builder.versionedHashes( - versionedHashes.orElse(List.of(VersionedHash.DEFAULT_VERSIONED_HASH))); - blobs.ifPresent( - bwc -> { - builder.kzgBlobs(bwc.getKzgCommitments(), bwc.getBlobs(), bwc.getKzgProofs()); - }); + if(blobs.isPresent()) { + builder.kzgBlobs(blobs.get().getKzgCommitments(), blobs.get().getBlobs(), blobs.get().getKzgProofs()); + } else if(versionedHashes.isPresent()){ + builder.versionedHashes(versionedHashes.get()); + } break; } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java index 593e3659094..7d83c6f0a87 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTest.java @@ -150,7 +150,7 @@ public abstract class AbstractTransactionPoolTest { protected PendingTransactions transactions; protected final Transaction transaction0 = createTransaction(0); protected final Transaction transaction1 = createTransaction(1); - protected final Transaction transactionBlob = createBlobTransaction(0); + protected final Transaction transactionBlob = createBlobTransaction(2); protected final Transaction transactionOtherSender = createTransaction(1, KEY_PAIR2); private ExecutionContextTestFixture executionContext; @@ -326,7 +326,7 @@ public void shouldReturnLocalTransactionsWhenAppropriate(final boolean noLocalPr assertThat(transactions.size()).isEqualTo(3); assertThat(transactions.getLocalTransactions()).contains(localTransaction2); - assertThat(transactions.getPriorityTransactions().size()).isEqualTo(noLocalPriority ? 0 : 1); + assertThat(transactions.getPriorityTransactions()).hasSize(noLocalPriority ? 0 : 1); } @Test @@ -469,7 +469,7 @@ public void shouldReAddBlobTxsWhenReorgHappens() { addAndAssertRemoteTransactionsValid(transaction0); addAndAssertRemoteTransactionsValid(transaction1); - addAndAssertRemoteTransactionInvalid(transactionBlob); + addAndAssertRemoteTransactionsValid(transactionBlob); final BlockHeader commonParent = getHeaderForCurrentChainHead(); final Block originalFork1 = appendBlock(Difficulty.of(1000), commonParent, transaction0); @@ -1222,7 +1222,7 @@ public void shouldRejectRemote1559TxsWhenMaxFeePerGasBelowMinGasPrice(final bool assertThat( add1559TxAndGetPendingTxsCount( genesisBaseFee, minGasPrice, lastBlockBaseFee, txMaxFeePerGas, false, hasPriority)) - .isEqualTo(0); + .isZero(); } @ParameterizedTest @@ -1250,7 +1250,7 @@ public void shouldRejectLocal1559TxsWhenMaxFeePerGasBelowMinGasPrice() { assertThat( add1559TxAndGetPendingTxsCount( genesisBaseFee, minGasPrice, lastBlockBaseFee, txMaxFeePerGas, true, true)) - .isEqualTo(0); + .isZero(); } @Test