From ddcd0c35ccdefce1231d8b160b1fef5a08396d96 Mon Sep 17 00:00:00 2001 From: Matthew Whitehead Date: Tue, 29 Oct 2024 16:51:39 +0000 Subject: [PATCH 1/2] Don't create reward account if no reward Signed-off-by: Matthew Whitehead --- .../ethereum/mainnet/MainnetTransactionProcessor.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java index 30a1ea8e762..038635f0006 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java @@ -531,10 +531,11 @@ public TransactionProcessingResult processTransaction( final Wei coinbaseWeiDelta = coinbaseCalculator.price(usedGas, transactionGasPrice, blockHeader.getBaseFee()); - operationTracer.traceBeforeRewardTransaction(worldUpdater, transaction, coinbaseWeiDelta); - - final var coinbase = evmWorldUpdater.getOrCreate(miningBeneficiary); - coinbase.incrementBalance(coinbaseWeiDelta); + if (!coinbaseWeiDelta.isZero()) { + operationTracer.traceBeforeRewardTransaction(worldUpdater, transaction, coinbaseWeiDelta); + final var coinbase = evmWorldUpdater.getOrCreate(miningBeneficiary); + coinbase.incrementBalance(coinbaseWeiDelta); + } operationTracer.traceEndTransaction( worldUpdater, From 07bbfedd90de4d2fa0269a6ef6eee548105ec831 Mon Sep 17 00:00:00 2001 From: Matthew Whitehead Date: Thu, 31 Oct 2024 10:54:15 +0000 Subject: [PATCH 2/2] Remove unnecessary test stub Signed-off-by: Matthew Whitehead --- .../besu/ethereum/mainnet/MainnetTransactionProcessorTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessorTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessorTest.java index d8d9f3777ea..c40da7210e2 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessorTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessorTest.java @@ -108,7 +108,6 @@ void shouldWarmCoinbaseIfRequested() { .thenReturn(ValidationResult.valid()); when(transactionValidatorFactory.get().validateForSender(any(), any(), any())) .thenReturn(ValidationResult.valid()); - when(worldState.getOrCreate(any())).thenReturn(senderAccount); when(worldState.getOrCreateSenderAccount(any())).thenReturn(senderAccount); when(worldState.updater()).thenReturn(worldState);