[Cleanup] Remove Gas Budget Calculator (#2363)

Since there are no separate gas budgets for eip-1559 and non-eip-1559 txs,
we can return to the simpler method of just comparing against the gas limit.

This is a non-functional change.

Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
pull/2392/head
Ratan (Rai) Sur 4 years ago committed by GitHub
parent 51287459ab
commit de6c10d17f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java
  2. 2
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/results/tracing/flat/RewardTraceGeneratorTest.java
  3. 11
      ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreator.java
  4. 30
      ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/BlockTransactionSelector.java
  5. 51
      ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/BlockTransactionSelectorTest.java
  6. 45
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/fees/TransactionGasBudgetCalculator.java
  7. 3
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumBlockProcessor.java
  8. 10
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/AbstractBlockProcessor.java
  9. 4
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicBlockProcessor.java
  10. 1
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ClassicProtocolSpecs.java
  11. 5
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockProcessor.java
  12. 2
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java
  13. 15
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolSpec.java
  14. 12
      ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolSpecBuilder.java
  15. 97
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/core/fees/TransactionGasBudgetCalculatorTest.java
  16. 4
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/goquorum/GoQuorumBlockProcessorTest.java
  17. 3
      ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetBlockProcessorTest.java
  18. 3
      ethereum/retesteth/src/main/java/org/hyperledger/besu/ethereum/retesteth/NoRewardProtocolScheduleWrapper.java

@ -33,7 +33,6 @@ import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator; import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator;
import org.hyperledger.besu.ethereum.mainnet.PoWHasher; import org.hyperledger.besu.ethereum.mainnet.PoWHasher;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
@ -105,7 +104,6 @@ public class EthGetTransactionReceiptTest {
null, null,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier(),
Optional.empty(), Optional.empty(),
TransactionGasBudgetCalculator.frontier(),
null, null,
Optional.of(PoWHasher.ETHASH_LIGHT)); Optional.of(PoWHasher.ETHASH_LIGHT));
private final ProtocolSpec statusTransactionTypeSpec = private final ProtocolSpec statusTransactionTypeSpec =
@ -131,7 +129,6 @@ public class EthGetTransactionReceiptTest {
null, null,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier(),
Optional.empty(), Optional.empty(),
TransactionGasBudgetCalculator.frontier(),
null, null,
Optional.of(PoWHasher.ETHASH_LIGHT)); Optional.of(PoWHasher.ETHASH_LIGHT));

@ -25,7 +25,6 @@ import org.hyperledger.besu.ethereum.core.BlockBody;
import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockDataGenerator;
import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.mainnet.AbstractBlockProcessor; import org.hyperledger.besu.ethereum.mainnet.AbstractBlockProcessor;
import org.hyperledger.besu.ethereum.mainnet.ClassicBlockProcessor; import org.hyperledger.besu.ethereum.mainnet.ClassicBlockProcessor;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor;
@ -93,7 +92,6 @@ public class RewardTraceGeneratorTest {
blockReward, blockReward,
BlockHeader::getCoinbase, BlockHeader::getCoinbase,
true, true,
TransactionGasBudgetCalculator.frontier(),
Optional.empty()); Optional.empty());
when(protocolSpec.getBlockProcessor()).thenReturn(blockProcessor); when(protocolSpec.getBlockProcessor()).thenReturn(blockProcessor);

@ -219,17 +219,12 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator {
minBlockOccupancyRatio, minBlockOccupancyRatio,
isCancelled::get, isCancelled::get,
miningBeneficiary, miningBeneficiary,
protocolSpec.getTransactionPriceCalculator(), protocolSpec.getTransactionPriceCalculator());
protocolSpec.getGasBudgetCalculator());
if (transactions.isPresent()) { if (transactions.isPresent()) {
return selector.evaluateTransactions( return selector.evaluateTransactions(transactions.get());
processableBlockHeader.getNumber(),
processableBlockHeader.getGasLimit(),
transactions.get());
} else { } else {
return selector.buildTransactionListForBlock( return selector.buildTransactionListForBlock();
processableBlockHeader.getNumber(), processableBlockHeader.getGasLimit());
} }
} }

@ -23,7 +23,6 @@ import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.WorldUpdater; import org.hyperledger.besu.ethereum.core.WorldUpdater;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator; import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator;
import org.hyperledger.besu.ethereum.eth.transactions.PendingTransactions; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransactions;
import org.hyperledger.besu.ethereum.eth.transactions.PendingTransactions.TransactionSelectionResult; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransactions.TransactionSelectionResult;
@ -107,7 +106,6 @@ public class BlockTransactionSelector {
private final AbstractBlockProcessor.TransactionReceiptFactory transactionReceiptFactory; private final AbstractBlockProcessor.TransactionReceiptFactory transactionReceiptFactory;
private final Address miningBeneficiary; private final Address miningBeneficiary;
private final TransactionPriceCalculator transactionPriceCalculator; private final TransactionPriceCalculator transactionPriceCalculator;
private final TransactionGasBudgetCalculator transactionGasBudgetCalculator;
private final TransactionSelectionResults transactionSelectionResult = private final TransactionSelectionResults transactionSelectionResult =
new TransactionSelectionResults(); new TransactionSelectionResults();
@ -123,8 +121,7 @@ public class BlockTransactionSelector {
final Double minBlockOccupancyRatio, final Double minBlockOccupancyRatio,
final Supplier<Boolean> isCancelled, final Supplier<Boolean> isCancelled,
final Address miningBeneficiary, final Address miningBeneficiary,
final TransactionPriceCalculator transactionPriceCalculator, final TransactionPriceCalculator transactionPriceCalculator) {
final TransactionGasBudgetCalculator transactionGasBudgetCalculator) {
this.transactionProcessor = transactionProcessor; this.transactionProcessor = transactionProcessor;
this.blockchain = blockchain; this.blockchain = blockchain;
this.worldState = worldState; this.worldState = worldState;
@ -136,7 +133,6 @@ public class BlockTransactionSelector {
this.minBlockOccupancyRatio = minBlockOccupancyRatio; this.minBlockOccupancyRatio = minBlockOccupancyRatio;
this.miningBeneficiary = miningBeneficiary; this.miningBeneficiary = miningBeneficiary;
this.transactionPriceCalculator = transactionPriceCalculator; this.transactionPriceCalculator = transactionPriceCalculator;
this.transactionGasBudgetCalculator = transactionGasBudgetCalculator;
} }
/* /*
@ -145,24 +141,20 @@ public class BlockTransactionSelector {
If running in a thread, it can be cancelled via the isCancelled supplier (which will result If running in a thread, it can be cancelled via the isCancelled supplier (which will result
in this throwing an CancellationException). in this throwing an CancellationException).
*/ */
public TransactionSelectionResults buildTransactionListForBlock( public TransactionSelectionResults buildTransactionListForBlock() {
final long blockNumber, final long gasLimit) {
pendingTransactions.selectTransactions( pendingTransactions.selectTransactions(
pendingTransaction -> evaluateTransaction(blockNumber, gasLimit, pendingTransaction)); pendingTransaction -> evaluateTransaction(pendingTransaction));
return transactionSelectionResult; return transactionSelectionResult;
} }
/** /**
* Evaluate the given transactions and return the result of that evaluation. * Evaluate the given transactions and return the result of that evaluation.
* *
* @param blockNumber The block number.
* @param gasLimit The gas limit.
* @param transactions The set of transactions to evaluate. * @param transactions The set of transactions to evaluate.
* @return The {@code TransactionSelectionResults} results of transaction evaluation. * @return The {@code TransactionSelectionResults} results of transaction evaluation.
*/ */
public TransactionSelectionResults evaluateTransactions( public TransactionSelectionResults evaluateTransactions(final List<Transaction> transactions) {
final long blockNumber, final long gasLimit, final List<Transaction> transactions) { transactions.forEach(this::evaluateTransaction);
transactions.forEach(transaction -> evaluateTransaction(blockNumber, gasLimit, transaction));
return transactionSelectionResult; return transactionSelectionResult;
} }
@ -175,13 +167,12 @@ public class BlockTransactionSelector {
* the space remaining in the block. * the space remaining in the block.
* *
*/ */
private TransactionSelectionResult evaluateTransaction( private TransactionSelectionResult evaluateTransaction(final Transaction transaction) {
final long blockNumber, final long gasLimit, final Transaction transaction) {
if (isCancelled.get()) { if (isCancelled.get()) {
throw new CancellationException("Cancelled during transaction selection."); throw new CancellationException("Cancelled during transaction selection.");
} }
if (transactionTooLargeForBlock(blockNumber, gasLimit, transaction)) { if (transactionTooLargeForBlock(transaction)) {
LOG.trace("{} too large to select for block creation", transaction); LOG.trace("{} too large to select for block creation", transaction);
if (blockOccupancyAboveThreshold()) { if (blockOccupancyAboveThreshold()) {
return TransactionSelectionResult.COMPLETE_OPERATION; return TransactionSelectionResult.COMPLETE_OPERATION;
@ -310,10 +301,9 @@ public class BlockTransactionSelector {
ValidationResult.valid()); ValidationResult.valid());
} }
private boolean transactionTooLargeForBlock( private boolean transactionTooLargeForBlock(final Transaction transaction) {
final long blockNumber, final long gasLimit, final Transaction transaction) { return transaction.getGasLimit()
return !transactionGasBudgetCalculator.hasBudget( > processableBlockHeader.getGasLimit() - transactionSelectionResult.getCumulativeGasUsed();
transaction, blockNumber, gasLimit, transactionSelectionResult.cumulativeGasUsed);
} }
private boolean blockOccupancyAboveThreshold() { private boolean blockOccupancyAboveThreshold() {

@ -40,7 +40,6 @@ import org.hyperledger.besu.ethereum.core.TransactionTestFixture;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.WorldState; import org.hyperledger.besu.ethereum.core.WorldState;
import org.hyperledger.besu.ethereum.core.WorldUpdater; import org.hyperledger.besu.ethereum.core.WorldUpdater;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator; import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator;
import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule; import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule;
import org.hyperledger.besu.ethereum.eth.transactions.PendingTransactions; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransactions;
@ -133,11 +132,10 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
assertThat(results.getTransactions().size()).isEqualTo(0); assertThat(results.getTransactions().size()).isEqualTo(0);
assertThat(results.getReceipts().size()).isEqualTo(0); assertThat(results.getReceipts().size()).isEqualTo(0);
@ -171,11 +169,10 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
assertThat(results.getTransactions().size()).isEqualTo(1); assertThat(results.getTransactions().size()).isEqualTo(1);
Assertions.assertThat(results.getTransactions()).contains(transaction); Assertions.assertThat(results.getTransactions()).contains(transaction);
@ -227,11 +224,10 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
assertThat(results.getTransactions().size()).isEqualTo(4); assertThat(results.getTransactions().size()).isEqualTo(4);
assertThat(results.getTransactions().contains(transactionsToInject.get(1))).isFalse(); assertThat(results.getTransactions().contains(transactionsToInject.get(1))).isFalse();
@ -271,11 +267,10 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
assertThat(results.getTransactions().size()).isEqualTo(3); assertThat(results.getTransactions().size()).isEqualTo(3);
@ -306,14 +301,13 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final Transaction tx = createTransaction(1); final Transaction tx = createTransaction(1);
pendingTransactions.addRemoteTransaction(tx); pendingTransactions.addRemoteTransaction(tx);
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
assertThat(results.getTransactions().size()).isEqualTo(0); assertThat(results.getTransactions().size()).isEqualTo(0);
assertThat(pendingTransactions.size()).isEqualTo(0); assertThat(pendingTransactions.size()).isEqualTo(0);
@ -336,8 +330,7 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.eip1559(), TransactionPriceCalculator.eip1559());
TransactionGasBudgetCalculator.frontier());
// this should fill up all the block space // this should fill up all the block space
final Transaction fillingLegacyTx = final Transaction fillingLegacyTx =
@ -376,7 +369,7 @@ public class BlockTransactionSelectorTest {
pendingTransactions.addRemoteTransaction(fillingLegacyTx); pendingTransactions.addRemoteTransaction(fillingLegacyTx);
pendingTransactions.addRemoteTransaction(extraEIP1559Tx); pendingTransactions.addRemoteTransaction(extraEIP1559Tx);
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
assertThat(results.getTransactions().size()).isEqualTo(1); assertThat(results.getTransactions().size()).isEqualTo(1);
} }
@ -404,8 +397,7 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final TransactionTestFixture txTestFixture = new TransactionTestFixture(); final TransactionTestFixture txTestFixture = new TransactionTestFixture();
// Add 3 transactions to the Pending Transactions, 79% of block, 100% of block and 10% of block // Add 3 transactions to the Pending Transactions, 79% of block, 100% of block and 10% of block
@ -430,7 +422,7 @@ public class BlockTransactionSelectorTest {
} }
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
assertThat(results.getTransactions().size()).isEqualTo(2); assertThat(results.getTransactions().size()).isEqualTo(2);
Assertions.assertThat(results.getTransactions().get(0)).isEqualTo(transactionsToInject.get(0)); Assertions.assertThat(results.getTransactions().get(0)).isEqualTo(transactionsToInject.get(0));
@ -461,8 +453,7 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final TransactionTestFixture txTestFixture = new TransactionTestFixture(); final TransactionTestFixture txTestFixture = new TransactionTestFixture();
// Add 4 transactions to the Pending Transactions 15% (ok), 79% (ok), 25% (too large), 10% // Add 4 transactions to the Pending Transactions 15% (ok), 79% (ok), 25% (too large), 10%
@ -496,7 +487,7 @@ public class BlockTransactionSelectorTest {
pendingTransactions.addRemoteTransaction(transaction4); pendingTransactions.addRemoteTransaction(transaction4);
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
assertThat(results.getTransactions().size()).isEqualTo(2); assertThat(results.getTransactions().size()).isEqualTo(2);
Assertions.assertThat(results.getTransactions().get(0)).isEqualTo(transaction1); Assertions.assertThat(results.getTransactions().get(0)).isEqualTo(transaction1);
@ -522,8 +513,7 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final TransactionTestFixture txTestFixture = new TransactionTestFixture(); final TransactionTestFixture txTestFixture = new TransactionTestFixture();
final Transaction validTransaction = final Transaction validTransaction =
@ -559,7 +549,7 @@ public class BlockTransactionSelectorTest {
TransactionProcessingResult.invalid( TransactionProcessingResult.invalid(
ValidationResult.invalid(TransactionInvalidReason.EXCEEDS_BLOCK_GAS_LIMIT))); ValidationResult.invalid(TransactionInvalidReason.EXCEEDS_BLOCK_GAS_LIMIT)));
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
Assertions.assertThat(pendingTransactions.getTransactionByHash(validTransaction.getHash())) Assertions.assertThat(pendingTransactions.getTransactionByHash(validTransaction.getHash()))
.isPresent(); .isPresent();
@ -603,11 +593,10 @@ public class BlockTransactionSelectorTest {
0.8, 0.8,
this::isCancelled, this::isCancelled,
miningBeneficiary, miningBeneficiary,
TransactionPriceCalculator.frontier(), TransactionPriceCalculator.frontier());
TransactionGasBudgetCalculator.frontier());
final BlockTransactionSelector.TransactionSelectionResults results = final BlockTransactionSelector.TransactionSelectionResults results =
selector.buildTransactionListForBlock(blockHeader.getNumber(), blockHeader.getGasLimit()); selector.buildTransactionListForBlock();
Assertions.assertThat(pendingTransactions.getTransactionByHash(futureTransaction.getHash())) Assertions.assertThat(pendingTransactions.getTransactionByHash(futureTransaction.getHash()))
.isPresent(); .isPresent();

@ -1,45 +0,0 @@
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.core.fees;
import org.hyperledger.besu.ethereum.core.Transaction;
@FunctionalInterface
public interface TransactionGasBudgetCalculator {
boolean hasBudget(
final Transaction transaction,
final long blockNumber,
final long gasLimit,
final long gasUsed);
static TransactionGasBudgetCalculator frontier() {
return gasBudgetCalculator((blockNumber, gasLimit, ignored) -> gasLimit);
}
static TransactionGasBudgetCalculator gasBudgetCalculator(
final BlockGasLimitCalculator blockGasLimitCalculator) {
return (transaction, blockNumber, gasLimit, gasUsed) -> {
final long remainingGasBudget =
blockGasLimitCalculator.apply(blockNumber, gasLimit, transaction) - gasUsed;
return Long.compareUnsigned(transaction.getGasLimit(), remainingGasBudget) <= 0;
};
}
@FunctionalInterface
interface BlockGasLimitCalculator {
long apply(final long blockNumber, final long gasLimit, Transaction transaction);
}
}

@ -29,7 +29,6 @@ import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.WorldUpdater; import org.hyperledger.besu.ethereum.core.WorldUpdater;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.mainnet.AbstractBlockProcessor; import org.hyperledger.besu.ethereum.mainnet.AbstractBlockProcessor;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor;
import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor; import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor;
@ -65,7 +64,6 @@ public class GoQuorumBlockProcessor extends MainnetBlockProcessor {
final Wei blockReward, final Wei blockReward,
final MiningBeneficiaryCalculator miningBeneficiaryCalculator, final MiningBeneficiaryCalculator miningBeneficiaryCalculator,
final boolean skipZeroBlockRewards, final boolean skipZeroBlockRewards,
final TransactionGasBudgetCalculator gasBudgetCalculator,
final Optional<GoQuorumPrivacyParameters> goQuorumPrivacyParameters) { final Optional<GoQuorumPrivacyParameters> goQuorumPrivacyParameters) {
super( super(
transactionProcessor, transactionProcessor,
@ -73,7 +71,6 @@ public class GoQuorumBlockProcessor extends MainnetBlockProcessor {
blockReward, blockReward,
miningBeneficiaryCalculator, miningBeneficiaryCalculator,
skipZeroBlockRewards, skipZeroBlockRewards,
gasBudgetCalculator,
Optional.empty()); Optional.empty());
this.goQuorumEnclave = goQuorumPrivacyParameters.orElseThrow().enclave(); this.goQuorumEnclave = goQuorumPrivacyParameters.orElseThrow().enclave();

@ -25,7 +25,6 @@ import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.WorldState; import org.hyperledger.besu.ethereum.core.WorldState;
import org.hyperledger.besu.ethereum.core.WorldUpdater; import org.hyperledger.besu.ethereum.core.WorldUpdater;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.privacy.storage.PrivateMetadataUpdater; import org.hyperledger.besu.ethereum.privacy.storage.PrivateMetadataUpdater;
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult; import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.ethereum.vm.BlockHashLookup; import org.hyperledger.besu.ethereum.vm.BlockHashLookup;
@ -125,21 +124,17 @@ public abstract class AbstractBlockProcessor implements BlockProcessor {
protected final MiningBeneficiaryCalculator miningBeneficiaryCalculator; protected final MiningBeneficiaryCalculator miningBeneficiaryCalculator;
protected final TransactionGasBudgetCalculator gasBudgetCalculator;
protected AbstractBlockProcessor( protected AbstractBlockProcessor(
final MainnetTransactionProcessor transactionProcessor, final MainnetTransactionProcessor transactionProcessor,
final TransactionReceiptFactory transactionReceiptFactory, final TransactionReceiptFactory transactionReceiptFactory,
final Wei blockReward, final Wei blockReward,
final MiningBeneficiaryCalculator miningBeneficiaryCalculator, final MiningBeneficiaryCalculator miningBeneficiaryCalculator,
final boolean skipZeroBlockRewards, final boolean skipZeroBlockRewards) {
final TransactionGasBudgetCalculator gasBudgetCalculator) {
this.transactionProcessor = transactionProcessor; this.transactionProcessor = transactionProcessor;
this.transactionReceiptFactory = transactionReceiptFactory; this.transactionReceiptFactory = transactionReceiptFactory;
this.blockReward = blockReward; this.blockReward = blockReward;
this.miningBeneficiaryCalculator = miningBeneficiaryCalculator; this.miningBeneficiaryCalculator = miningBeneficiaryCalculator;
this.skipZeroBlockRewards = skipZeroBlockRewards; this.skipZeroBlockRewards = skipZeroBlockRewards;
this.gasBudgetCalculator = gasBudgetCalculator;
} }
@Override @Override
@ -210,9 +205,8 @@ public abstract class AbstractBlockProcessor implements BlockProcessor {
protected boolean hasAvailableBlockBudget( protected boolean hasAvailableBlockBudget(
final BlockHeader blockHeader, final Transaction transaction, final long currentGasUsed) { final BlockHeader blockHeader, final Transaction transaction, final long currentGasUsed) {
if (!gasBudgetCalculator.hasBudget(
transaction, blockHeader.getNumber(), blockHeader.getGasLimit(), currentGasUsed)) {
final long remainingGasBudget = blockHeader.getGasLimit() - currentGasUsed; final long remainingGasBudget = blockHeader.getGasLimit() - currentGasUsed;
if (Long.compareUnsigned(transaction.getGasLimit(), remainingGasBudget) > 0) {
LOG.info( LOG.info(
"Block processing error: transaction gas limit {} exceeds available block budget" "Block processing error: transaction gas limit {} exceeds available block budget"
+ " remaining {}. Block {} Transaction {}", + " remaining {}. Block {} Transaction {}",

@ -19,7 +19,6 @@ import org.hyperledger.besu.ethereum.core.MutableAccount;
import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.WorldUpdater; import org.hyperledger.besu.ethereum.core.WorldUpdater;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.List; import java.util.List;
@ -48,8 +47,7 @@ public class ClassicBlockProcessor extends AbstractBlockProcessor {
transactionReceiptFactory, transactionReceiptFactory,
blockReward, blockReward,
miningBeneficiaryCalculator, miningBeneficiaryCalculator,
skipZeroBlockRewards, skipZeroBlockRewards);
TransactionGasBudgetCalculator.frontier());
eraLength = eraLen.orElse(DEFAULT_ERA_LENGTH); eraLength = eraLen.orElse(DEFAULT_ERA_LENGTH);
} }

@ -91,7 +91,6 @@ public class ClassicProtocolSpecs {
blockReward, blockReward,
miningBeneficiaryCalculator, miningBeneficiaryCalculator,
skipZeroBlockRewards, skipZeroBlockRewards,
gasBudgetCalculator,
goQuorumPrivacyParameters) -> goQuorumPrivacyParameters) ->
new ClassicBlockProcessor( new ClassicBlockProcessor(
transactionProcessor, transactionProcessor,

@ -21,7 +21,6 @@ import org.hyperledger.besu.ethereum.core.MutableAccount;
import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.WorldUpdater; import org.hyperledger.besu.ethereum.core.WorldUpdater;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@ -39,15 +38,13 @@ public class MainnetBlockProcessor extends AbstractBlockProcessor {
final Wei blockReward, final Wei blockReward,
final MiningBeneficiaryCalculator miningBeneficiaryCalculator, final MiningBeneficiaryCalculator miningBeneficiaryCalculator,
final boolean skipZeroBlockRewards, final boolean skipZeroBlockRewards,
final TransactionGasBudgetCalculator gasBudgetCalculator,
final Optional<GoQuorumPrivacyParameters> goQuorumPrivacyParameters) { final Optional<GoQuorumPrivacyParameters> goQuorumPrivacyParameters) {
super( super(
transactionProcessor, transactionProcessor,
transactionReceiptFactory, transactionReceiptFactory,
blockReward, blockReward,
miningBeneficiaryCalculator, miningBeneficiaryCalculator,
skipZeroBlockRewards, skipZeroBlockRewards);
gasBudgetCalculator);
} }
@Override @Override

@ -225,7 +225,6 @@ public abstract class MainnetProtocolSpecs {
blockReward, blockReward,
miningBeneficiaryCalculator, miningBeneficiaryCalculator,
skipZeroBlockRewards, skipZeroBlockRewards,
gasBudgetCalculator,
goQuorumPrivacyParameters) -> goQuorumPrivacyParameters) ->
new DaoBlockProcessor( new DaoBlockProcessor(
new MainnetBlockProcessor( new MainnetBlockProcessor(
@ -234,7 +233,6 @@ public abstract class MainnetProtocolSpecs {
blockReward, blockReward,
miningBeneficiaryCalculator, miningBeneficiaryCalculator,
skipZeroBlockRewards, skipZeroBlockRewards,
gasBudgetCalculator,
Optional.empty()))) Optional.empty())))
.name("DaoRecoveryInit"); .name("DaoRecoveryInit");
} }

@ -20,7 +20,6 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions;
import org.hyperledger.besu.ethereum.core.BlockImporter; import org.hyperledger.besu.ethereum.core.BlockImporter;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.fees.EIP1559; import org.hyperledger.besu.ethereum.core.fees.EIP1559;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator; import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator;
import org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor; import org.hyperledger.besu.ethereum.privacy.PrivateTransactionProcessor;
import org.hyperledger.besu.ethereum.vm.EVM; import org.hyperledger.besu.ethereum.vm.EVM;
@ -72,8 +71,6 @@ public class ProtocolSpec {
private final Optional<EIP1559> eip1559; private final Optional<EIP1559> eip1559;
private final TransactionGasBudgetCalculator gasBudgetCalculator;
private final BadBlockManager badBlockManager; private final BadBlockManager badBlockManager;
private final Optional<PoWHasher> powHasher; private final Optional<PoWHasher> powHasher;
@ -102,7 +99,6 @@ public class ProtocolSpec {
* @param gasCalculator the gas calculator to use. * @param gasCalculator the gas calculator to use.
* @param transactionPriceCalculator the transaction price calculator to use. * @param transactionPriceCalculator the transaction price calculator to use.
* @param eip1559 an {@link Optional} wrapping {@link EIP1559} manager class if appropriate. * @param eip1559 an {@link Optional} wrapping {@link EIP1559} manager class if appropriate.
* @param gasBudgetCalculator the gas budget calculator to use.
* @param badBlockManager the cache to use to keep invalid blocks * @param badBlockManager the cache to use to keep invalid blocks
* @param powHasher the proof-of-work hasher * @param powHasher the proof-of-work hasher
*/ */
@ -128,7 +124,6 @@ public class ProtocolSpec {
final GasCalculator gasCalculator, final GasCalculator gasCalculator,
final TransactionPriceCalculator transactionPriceCalculator, final TransactionPriceCalculator transactionPriceCalculator,
final Optional<EIP1559> eip1559, final Optional<EIP1559> eip1559,
final TransactionGasBudgetCalculator gasBudgetCalculator,
final BadBlockManager badBlockManager, final BadBlockManager badBlockManager,
final Optional<PoWHasher> powHasher) { final Optional<PoWHasher> powHasher) {
this.name = name; this.name = name;
@ -152,7 +147,6 @@ public class ProtocolSpec {
this.gasCalculator = gasCalculator; this.gasCalculator = gasCalculator;
this.transactionPriceCalculator = transactionPriceCalculator; this.transactionPriceCalculator = transactionPriceCalculator;
this.eip1559 = eip1559; this.eip1559 = eip1559;
this.gasBudgetCalculator = gasBudgetCalculator;
this.badBlockManager = badBlockManager; this.badBlockManager = badBlockManager;
this.powHasher = powHasher; this.powHasher = powHasher;
} }
@ -337,15 +331,6 @@ public class ProtocolSpec {
return eip1559.isPresent(); return eip1559.isPresent();
} }
/**
* Returns the gas budget calculator in this specification.
*
* @return the gas budget calculator
*/
public TransactionGasBudgetCalculator getGasBudgetCalculator() {
return gasBudgetCalculator;
}
/** /**
* Returns the bad blocks manager * Returns the bad blocks manager
* *

@ -26,7 +26,6 @@ import org.hyperledger.besu.ethereum.core.GoQuorumPrivacyParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.fees.EIP1559; import org.hyperledger.besu.ethereum.core.fees.EIP1559;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator; import org.hyperledger.besu.ethereum.core.fees.TransactionPriceCalculator;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnChainPrivacyPrecompiledContract; import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.OnChainPrivacyPrecompiledContract;
import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.PrivacyPrecompiledContract; import org.hyperledger.besu.ethereum.mainnet.precompiles.privacy.PrivacyPrecompiledContract;
@ -69,8 +68,6 @@ public class ProtocolSpecBuilder {
private TransactionPriceCalculator transactionPriceCalculator = private TransactionPriceCalculator transactionPriceCalculator =
TransactionPriceCalculator.frontier(); TransactionPriceCalculator.frontier();
private Optional<EIP1559> eip1559 = Optional.empty(); private Optional<EIP1559> eip1559 = Optional.empty();
private TransactionGasBudgetCalculator gasBudgetCalculator =
TransactionGasBudgetCalculator.frontier();
private BadBlockManager badBlockManager; private BadBlockManager badBlockManager;
private PoWHasher powHasher = PoWHasher.ETHASH_LIGHT; private PoWHasher powHasher = PoWHasher.ETHASH_LIGHT;
@ -228,12 +225,6 @@ public class ProtocolSpecBuilder {
return this; return this;
} }
public ProtocolSpecBuilder gasBudgetCalculator(
final TransactionGasBudgetCalculator gasBudgetCalculator) {
this.gasBudgetCalculator = gasBudgetCalculator;
return this;
}
public ProtocolSpecBuilder badBlocksManager(final BadBlockManager badBlockManager) { public ProtocolSpecBuilder badBlocksManager(final BadBlockManager badBlockManager) {
this.badBlockManager = badBlockManager; this.badBlockManager = badBlockManager;
return this; return this;
@ -301,7 +292,6 @@ public class ProtocolSpecBuilder {
blockReward, blockReward,
miningBeneficiaryCalculator, miningBeneficiaryCalculator,
skipZeroBlockRewards, skipZeroBlockRewards,
gasBudgetCalculator,
privacyParameters.getGoQuorumPrivacyParameters()); privacyParameters.getGoQuorumPrivacyParameters());
// Set private Tx Processor // Set private Tx Processor
PrivateTransactionProcessor privateTransactionProcessor = null; PrivateTransactionProcessor privateTransactionProcessor = null;
@ -369,7 +359,6 @@ public class ProtocolSpecBuilder {
gasCalculator, gasCalculator,
transactionPriceCalculator, transactionPriceCalculator,
eip1559, eip1559,
gasBudgetCalculator,
badBlockManager, badBlockManager,
Optional.ofNullable(powHasher)); Optional.ofNullable(powHasher));
} }
@ -402,7 +391,6 @@ public class ProtocolSpecBuilder {
Wei blockReward, Wei blockReward,
MiningBeneficiaryCalculator miningBeneficiaryCalculator, MiningBeneficiaryCalculator miningBeneficiaryCalculator,
boolean skipZeroBlockRewards, boolean skipZeroBlockRewards,
TransactionGasBudgetCalculator gasBudgetCalculator,
Optional<GoQuorumPrivacyParameters> goQuorumPrivacyParameters); Optional<GoQuorumPrivacyParameters> goQuorumPrivacyParameters);
} }

@ -1,97 +0,0 @@
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.ethereum.core.fees;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.plugin.data.TransactionType;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class TransactionGasBudgetCalculatorTest {
private static final TransactionGasBudgetCalculator FRONTIER_CALCULATOR =
TransactionGasBudgetCalculator.frontier();
private final TransactionGasBudgetCalculator gasBudgetCalculator;
private final boolean isEIP1559;
private final long transactionGasLimit;
private final long blockNumber;
private final long blockHeaderGasLimit;
private final long gasUsed;
private final boolean expectedHasBudget;
public TransactionGasBudgetCalculatorTest(
final TransactionGasBudgetCalculator gasBudgetCalculator,
final boolean isEIP1559,
final long transactionGasLimit,
final long blockNumber,
final long blockHeaderGasLimit,
final long gasUsed,
final boolean expectedHasBudget) {
this.gasBudgetCalculator = gasBudgetCalculator;
this.isEIP1559 = isEIP1559;
this.transactionGasLimit = transactionGasLimit;
this.blockNumber = blockNumber;
this.blockHeaderGasLimit = blockHeaderGasLimit;
this.gasUsed = gasUsed;
this.expectedHasBudget = expectedHasBudget;
}
@Parameterized.Parameters
public static Collection<Object[]> data() {
return Arrays.asList(
new Object[][] {
{FRONTIER_CALCULATOR, false, 5L, 1L, 10L, 0L, true},
{FRONTIER_CALCULATOR, false, 11L, 1L, 10L, 0L, false},
{FRONTIER_CALCULATOR, false, 5L, 1L, 10L, 6L, false},
{FRONTIER_CALCULATOR, true, 5L, 1L, 10L, 0L, true},
{FRONTIER_CALCULATOR, true, 11L, 1L, 10L, 0L, false},
{FRONTIER_CALCULATOR, true, 5L, 1L, 10L, 6L, false},
});
}
@Test
public void assertThatCalculatorWorks() {
assertThat(
gasBudgetCalculator.hasBudget(
transaction(isEIP1559, transactionGasLimit),
blockNumber,
blockHeaderGasLimit,
gasUsed))
.isEqualTo(expectedHasBudget);
}
private Transaction transaction(final boolean isEIP1559, final long gasLimit) {
final Transaction transaction = mock(Transaction.class);
if (isEIP1559) {
when(transaction.getType()).thenReturn(TransactionType.EIP1559);
} else {
when(transaction.getType()).thenReturn(TransactionType.FRONTIER);
}
when(transaction.getGasLimit()).thenReturn(gasLimit);
return transaction;
}
}

@ -34,7 +34,6 @@ import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Transaction;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.mainnet.AbstractBlockProcessor; import org.hyperledger.besu.ethereum.mainnet.AbstractBlockProcessor;
import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor; import org.hyperledger.besu.ethereum.mainnet.MainnetTransactionProcessor;
import org.hyperledger.besu.ethereum.referencetests.ReferenceTestBlockchain; import org.hyperledger.besu.ethereum.referencetests.ReferenceTestBlockchain;
@ -68,7 +67,6 @@ public class GoQuorumBlockProcessorTest {
Wei.ZERO, Wei.ZERO,
BlockHeader::getCoinbase, BlockHeader::getCoinbase,
true, true,
TransactionGasBudgetCalculator.frontier(),
Optional.of(goQuorumPrivacyParameters)); Optional.of(goQuorumPrivacyParameters));
final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap()); final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap());
@ -95,7 +93,6 @@ public class GoQuorumBlockProcessorTest {
Wei.ZERO, Wei.ZERO,
BlockHeader::getCoinbase, BlockHeader::getCoinbase,
false, false,
TransactionGasBudgetCalculator.frontier(),
Optional.of(goQuorumPrivacyParameters)); Optional.of(goQuorumPrivacyParameters));
final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap()); final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap());
@ -122,7 +119,6 @@ public class GoQuorumBlockProcessorTest {
Wei.ZERO, Wei.ZERO,
BlockHeader::getCoinbase, BlockHeader::getCoinbase,
false, false,
TransactionGasBudgetCalculator.frontier(),
Optional.of(goQuorumPrivacyParameters)); Optional.of(goQuorumPrivacyParameters));
final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap()); final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap());

@ -25,7 +25,6 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.Hash; import org.hyperledger.besu.ethereum.core.Hash;
import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.MutableWorldState;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.referencetests.ReferenceTestBlockchain; import org.hyperledger.besu.ethereum.referencetests.ReferenceTestBlockchain;
import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState; import org.hyperledger.besu.ethereum.referencetests.ReferenceTestWorldState;
@ -50,7 +49,6 @@ public class MainnetBlockProcessorTest {
Wei.ZERO, Wei.ZERO,
BlockHeader::getCoinbase, BlockHeader::getCoinbase,
true, true,
TransactionGasBudgetCalculator.frontier(),
Optional.empty()); Optional.empty());
final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap()); final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap());
@ -77,7 +75,6 @@ public class MainnetBlockProcessorTest {
Wei.ZERO, Wei.ZERO,
BlockHeader::getCoinbase, BlockHeader::getCoinbase,
false, false,
TransactionGasBudgetCalculator.frontier(),
Optional.empty()); Optional.empty());
final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap()); final MutableWorldState worldState = ReferenceTestWorldState.create(emptyMap());

@ -19,7 +19,6 @@ import org.hyperledger.besu.ethereum.MainnetBlockValidator;
import org.hyperledger.besu.ethereum.core.BlockImporter; import org.hyperledger.besu.ethereum.core.BlockImporter;
import org.hyperledger.besu.ethereum.core.TransactionFilter; import org.hyperledger.besu.ethereum.core.TransactionFilter;
import org.hyperledger.besu.ethereum.core.Wei; import org.hyperledger.besu.ethereum.core.Wei;
import org.hyperledger.besu.ethereum.core.fees.TransactionGasBudgetCalculator;
import org.hyperledger.besu.ethereum.mainnet.BlockProcessor; import org.hyperledger.besu.ethereum.mainnet.BlockProcessor;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockImporter; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockImporter;
import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor;
@ -49,7 +48,6 @@ public class NoRewardProtocolScheduleWrapper implements ProtocolSchedule {
Wei.ZERO, Wei.ZERO,
original.getMiningBeneficiaryCalculator(), original.getMiningBeneficiaryCalculator(),
original.isSkipZeroBlockRewards(), original.isSkipZeroBlockRewards(),
TransactionGasBudgetCalculator.frontier(),
Optional.empty()); Optional.empty());
final BlockValidator noRewardBlockValidator = final BlockValidator noRewardBlockValidator =
new MainnetBlockValidator( new MainnetBlockValidator(
@ -80,7 +78,6 @@ public class NoRewardProtocolScheduleWrapper implements ProtocolSchedule {
original.getGasCalculator(), original.getGasCalculator(),
original.getTransactionPriceCalculator(), original.getTransactionPriceCalculator(),
original.getEip1559(), original.getEip1559(),
original.getGasBudgetCalculator(),
original.getBadBlocksManager(), original.getBadBlocksManager(),
Optional.empty()); Optional.empty());
} }

Loading…
Cancel
Save