New cli options to limit rewards return by eth_feeHistory (#6202)

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
pull/6232/head
Gabriel-Trintinalia 12 months ago committed by GitHub
parent 9f87ec48b2
commit 9d57927572
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 65
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  2. 71
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  3. 5
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/MigratingMiningCoordinator.java
  4. 9
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreatorFactory.java
  5. 5
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftMiningCoordinator.java
  6. 5
      consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java
  7. 5
      consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/TransitionCoordinator.java
  8. 18
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/ApiConfiguration.java
  9. 63
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthFeeHistory.java
  10. 6
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/EthJsonRpcMethods.java
  11. 85
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthFeeHistoryTest.java
  12. 4
      ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractMinerExecutor.java
  13. 5
      ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractMiningCoordinator.java
  14. 2
      ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/MiningCoordinator.java
  15. 5
      ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/NoopMiningCoordinator.java

@ -1217,6 +1217,29 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
description = "Maximum gas price for eth_gasPrice (default: ${DEFAULT-VALUE})")
private final Long apiGasPriceMax = 500_000_000_000L;
@CommandLine.Option(
names = {"--api-priority-fee-limiting-enabled"},
hidden = true,
description =
"Set to enable priority fee limit in eth_feeHistory (default: ${DEFAULT-VALUE})")
private final Boolean apiPriorityFeeLimitingEnabled = false;
@CommandLine.Option(
names = {"--api-priority-fee-lower-bound-coefficient"},
hidden = true,
description =
"Coefficient for setting the lower limit of minimum priority fee in eth_feeHistory (default: ${DEFAULT-VALUE})")
private final Long apiPriorityFeeLowerBoundCoefficient =
ApiConfiguration.DEFAULT_LOWER_BOUND_PRIORITY_FEE_COEFFICIENT;
@CommandLine.Option(
names = {"--api-priority-fee-upper-bound-coefficient"},
hidden = true,
description =
"Coefficient for setting the upper limit of minimum priority fee in eth_feeHistory (default: ${DEFAULT-VALUE})")
private final Long apiPriorityFeeUpperBoundCoefficient =
ApiConfiguration.DEFAULT_UPPER_BOUND_PRIORITY_FEE_COEFFICIENT;
@CommandLine.Option(
names = {"--static-nodes-file"},
paramLabel = MANDATORY_FILE_FORMAT_HELP,
@ -1875,6 +1898,17 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
}
}
private void checkApiOptionsDependencies() {
CommandLineUtils.checkOptionDependencies(
logger,
commandLine,
"--api-priority-fee-limiting-enabled",
!apiPriorityFeeLimitingEnabled,
asList(
"--api-priority-fee-upper-bound-coefficient",
"--api-priority-fee-lower-bound-coefficient"));
}
private void ensureValidPeerBoundParams() {
maxPeers = p2PDiscoveryOptionGroup.maxPeers;
peersLowerBound = unstableNetworkingOptions.toDomainObject().getPeerLowerBound();
@ -2485,15 +2519,28 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
}
private ApiConfiguration apiConfiguration() {
return ImmutableApiConfiguration.builder()
.gasPriceBlocks(apiGasPriceBlocks)
.gasPricePercentile(apiGasPricePercentile)
.gasPriceMinSupplier(
getMiningParameters().getMinTransactionGasPrice().getAsBigInteger()::longValueExact)
.gasPriceMax(apiGasPriceMax)
.maxLogsRange(rpcMaxLogsRange)
.gasCap(rpcGasCap)
.build();
checkApiOptionsDependencies();
var builder =
ImmutableApiConfiguration.builder()
.gasPriceBlocks(apiGasPriceBlocks)
.gasPricePercentile(apiGasPricePercentile)
.gasPriceMinSupplier(
getMiningParameters().getMinTransactionGasPrice().getAsBigInteger()::longValueExact)
.gasPriceMax(apiGasPriceMax)
.maxLogsRange(rpcMaxLogsRange)
.gasCap(rpcGasCap)
.isPriorityFeeLimitingEnabled(apiPriorityFeeLimitingEnabled);
if (apiPriorityFeeLimitingEnabled) {
if (apiPriorityFeeLowerBoundCoefficient > apiPriorityFeeUpperBoundCoefficient) {
throw new ParameterException(
this.commandLine,
"--api-priority-fee-lower-bound-coefficient cannot be greater than the value of --api-priority-fee-upper-bound-coefficient");
}
builder
.lowerBoundPriorityFeeCoefficient(apiPriorityFeeLowerBoundCoefficient)
.upperBoundPriorityFeeCoefficient(apiPriorityFeeUpperBoundCoefficient);
}
return builder.build();
}
/**

@ -1609,6 +1609,77 @@ public class BesuCommandTest extends CommandTestAbstract {
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void apiPriorityFeeLimitingEnabledOptionMustBeUsed() {
parseCommand("--api-priority-fee-limiting-enabled");
verify(mockRunnerBuilder).apiConfiguration(apiConfigurationCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(apiConfigurationCaptor.getValue())
.isEqualTo(ImmutableApiConfiguration.builder().isPriorityFeeLimitingEnabled(true).build());
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void apiPriorityFeeLowerBoundCoefficientOptionMustBeUsed() {
final long lowerBound = 150L;
parseCommand(
"--api-priority-fee-lower-bound-coefficient",
Long.toString(lowerBound),
"--api-priority-fee-limiting-enabled");
verify(mockRunnerBuilder).apiConfiguration(apiConfigurationCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(apiConfigurationCaptor.getValue())
.isEqualTo(
ImmutableApiConfiguration.builder()
.lowerBoundPriorityFeeCoefficient(lowerBound)
.isPriorityFeeLimitingEnabled(true)
.build());
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void
apiPriorityFeeLowerBoundCoefficients_MustNotBeGreaterThan_apiPriorityFeeUpperBoundCoefficient() {
final long lowerBound = 200L;
final long upperBound = 100L;
parseCommand(
"--api-priority-fee-limiting-enabled",
"--api-priority-fee-lower-bound-coefficient",
Long.toString(lowerBound),
"--api-priority-fee-upper-bound-coefficient",
Long.toString(upperBound));
Mockito.verifyNoInteractions(mockRunnerBuilder);
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8))
.contains(
"--api-priority-fee-lower-bound-coefficient cannot be greater than the value of --api-priority-fee-upper-bound-coefficient");
}
@Test
public void apiPriorityFeeUpperBoundCoefficientsOptionMustBeUsed() {
final long upperBound = 200L;
parseCommand(
"--api-priority-fee-upper-bound-coefficient",
Long.toString(upperBound),
"--api-priority-fee-limiting-enabled");
verify(mockRunnerBuilder).apiConfiguration(apiConfigurationCaptor.capture());
verify(mockRunnerBuilder).build();
assertThat(apiConfigurationCaptor.getValue())
.isEqualTo(
ImmutableApiConfiguration.builder()
.upperBoundPriorityFeeCoefficient(upperBound)
.isPriorityFeeLimitingEnabled(true)
.build());
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
@Test
public void p2pPeerUpperBound_without_p2pPeerLowerBound_shouldSetLowerBoundEqualToUpperBound() {

@ -103,6 +103,11 @@ public class MigratingMiningCoordinator implements MiningCoordinator, BlockAdded
return activeMiningCoordinator.getMinTransactionGasPrice();
}
@Override
public Wei getMinPriorityFeePerGas() {
return activeMiningCoordinator.getMinPriorityFeePerGas();
}
@Override
public void setExtraData(final Bytes extraData) {
activeMiningCoordinator.setExtraData(extraData);

@ -147,6 +147,15 @@ public class BftBlockCreatorFactory<T extends BftConfigOptions> {
return miningParameters.getMinTransactionGasPrice();
}
/**
* Gets min priority fee per gas
*
* @return min priority fee per gas
*/
public Wei getMinPriorityFeePerGas() {
return miningParameters.getMinPriorityFeePerGas();
}
/**
* Create extra data bytes.
*

@ -148,6 +148,11 @@ public class BftMiningCoordinator implements MiningCoordinator, BlockAddedObserv
return blockCreatorFactory.getMinTransactionGasPrice();
}
@Override
public Wei getMinPriorityFeePerGas() {
return blockCreatorFactory.getMinPriorityFeePerGas();
}
@Override
public void setExtraData(final Bytes extraData) {
blockCreatorFactory.setExtraData(extraData);

@ -211,6 +211,11 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene
return miningParameters.getMinTransactionGasPrice();
}
@Override
public Wei getMinPriorityFeePerGas() {
return miningParameters.getMinPriorityFeePerGas();
}
@Override
public void setExtraData(final Bytes extraData) {
this.miningParameters.setExtraData(extraData);

@ -101,6 +101,11 @@ public class TransitionCoordinator extends TransitionUtils<MiningCoordinator>
return dispatchFunctionAccordingToMergeState(MiningCoordinator::getMinTransactionGasPrice);
}
@Override
public Wei getMinPriorityFeePerGas() {
return dispatchFunctionAccordingToMergeState(MiningCoordinator::getMinPriorityFeePerGas);
}
@Override
public void setExtraData(final Bytes extraData) {
miningCoordinator.setExtraData(extraData);

@ -24,6 +24,9 @@ import org.immutables.value.Value;
@Value.Style(allParameters = true)
public abstract class ApiConfiguration {
public static final long DEFAULT_LOWER_BOUND_PRIORITY_FEE_COEFFICIENT = 0L;
public static final long DEFAULT_UPPER_BOUND_PRIORITY_FEE_COEFFICIENT = Long.MAX_VALUE;
@Value.Default
public long getGasPriceBlocks() {
return 100;
@ -59,4 +62,19 @@ public abstract class ApiConfiguration {
public Long getGasCap() {
return 0L;
}
@Value.Default
public boolean isPriorityFeeLimitingEnabled() {
return false;
}
@Value.Default
public Long getLowerBoundPriorityFeeCoefficient() {
return DEFAULT_LOWER_BOUND_PRIORITY_FEE_COEFFICIENT;
}
@Value.Default
public Long getUpperBoundPriorityFeeCoefficient() {
return DEFAULT_UPPER_BOUND_PRIORITY_FEE_COEFFICIENT;
}
}

@ -18,6 +18,7 @@ import static java.util.stream.Collectors.toUnmodifiableList;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcMethod;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.parameters.BlockParameter;
@ -28,6 +29,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSucces
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.FeeHistory;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.ImmutableFeeHistory;
import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockHeader;
@ -53,14 +55,22 @@ import com.google.common.collect.Streams;
public class EthFeeHistory implements JsonRpcMethod {
private final ProtocolSchedule protocolSchedule;
private final Blockchain blockchain;
private final MiningCoordinator miningCoordinator;
private final ApiConfiguration apiConfiguration;
private final Cache<RewardCacheKey, List<Wei>> cache;
private static final int MAXIMUM_CACHE_SIZE = 100_000;
record RewardCacheKey(Hash blockHash, List<Double> rewardPercentiles) {}
public EthFeeHistory(final ProtocolSchedule protocolSchedule, final Blockchain blockchain) {
public EthFeeHistory(
final ProtocolSchedule protocolSchedule,
final Blockchain blockchain,
final MiningCoordinator miningCoordinator,
final ApiConfiguration apiConfiguration) {
this.protocolSchedule = protocolSchedule;
this.blockchain = blockchain;
this.miningCoordinator = miningCoordinator;
this.apiConfiguration = apiConfiguration;
this.cache = Caffeine.newBuilder().maximumSize(MAXIMUM_CACHE_SIZE).build();
}
@ -203,7 +213,16 @@ public class EthFeeHistory implements JsonRpcMethod {
final List<Long> transactionsGasUsed = calculateTransactionsGasUsed(block);
final List<TransactionInfo> transactionsInfo =
generateTransactionsInfo(transactions, transactionsGasUsed, baseFee);
return calculateRewards(rewardPercentiles, block, transactionsInfo);
var realRewards = calculateRewards(rewardPercentiles, block, transactionsInfo);
// If the priority fee boundary is set, return the bounded rewards. Otherwise, return the real
// rewards.
if (apiConfiguration.isPriorityFeeLimitingEnabled()) {
return boundRewards(realRewards);
} else {
return realRewards;
}
}
private List<Wei> calculateRewards(
@ -235,6 +254,46 @@ public class EthFeeHistory implements JsonRpcMethod {
return rewards;
}
/**
* This method returns a list of bounded rewards.
*
* @param rewards The list of rewards to be bounded.
* @return The list of bounded rewards.
*/
private List<Wei> boundRewards(final List<Wei> rewards) {
Wei minPriorityFee = miningCoordinator.getMinPriorityFeePerGas();
Wei lowerBound =
minPriorityFee.multiply(apiConfiguration.getLowerBoundPriorityFeeCoefficient()).divide(100);
Wei upperBound =
minPriorityFee.multiply(apiConfiguration.getUpperBoundPriorityFeeCoefficient()).divide(100);
return rewards.stream().map(reward -> boundReward(reward, lowerBound, upperBound)).toList();
}
/**
* This method bounds the reward between a lower and upper limit.
*
* @param reward The reward to be bounded.
* @param lowerBound The lower limit for the reward.
* @param upperBound The upper limit for the reward.
* @return The bounded reward.
*/
private Wei boundReward(final Wei reward, final Wei lowerBound, final Wei upperBound) {
// If the reward is less than the lower bound, return the lower bound.
if (reward.compareTo(lowerBound) <= 0) {
return lowerBound;
}
// If the reward is greater than the upper bound, return the upper bound.
if (reward.compareTo(upperBound) > 0) {
return upperBound;
}
// If the reward is within the bounds, return the reward as is.
return reward;
}
private List<Long> calculateTransactionsGasUsed(final Block block) {
final List<Long> transactionsGasUsed = new ArrayList<>();
long cumulativeGasUsed = 0L;

@ -130,7 +130,11 @@ public class EthJsonRpcMethods extends ApiGroupJsonRpcMethods {
blockchainQueries.getWorldStateArchive(),
protocolSchedule,
apiConfiguration.getGasCap())),
new EthFeeHistory(protocolSchedule, blockchainQueries.getBlockchain()),
new EthFeeHistory(
protocolSchedule,
blockchainQueries.getBlockchain(),
miningCoordinator,
apiConfiguration),
new EthGetCode(blockchainQueries),
new EthGetLogs(blockchainQueries, apiConfiguration.getMaxLogsRange()),
new EthGetProof(blockchainQueries),

@ -23,8 +23,11 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.hyperledger.besu.consensus.merge.blockcreation.MergeCoordinator;
import org.hyperledger.besu.datatypes.Hash;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.api.ApiConfiguration;
import org.hyperledger.besu.ethereum.api.ImmutableApiConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequest;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.exception.InvalidJsonRpcParameters;
@ -35,6 +38,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.FeeHistory;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.ImmutableFeeHistory;
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.ImmutableFeeHistoryResult;
import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator;
import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.Block;
@ -64,6 +68,7 @@ public class EthFeeHistoryTest {
private MutableBlockchain blockchain;
private EthFeeHistory method;
private ProtocolSchedule protocolSchedule;
private MiningCoordinator miningCoordinator;
@BeforeEach
public void setUp() {
@ -72,7 +77,15 @@ public class EthFeeHistoryTest {
blockchain = createInMemoryBlockchain(genesisBlock);
gen.blockSequence(genesisBlock, 10)
.forEach(block -> blockchain.appendBlock(block, gen.receipts(block)));
method = new EthFeeHistory(protocolSchedule, blockchain);
miningCoordinator = mock(MergeCoordinator.class);
when(miningCoordinator.getMinPriorityFeePerGas()).thenReturn(Wei.ONE);
method =
new EthFeeHistory(
protocolSchedule,
blockchain,
miningCoordinator,
ImmutableApiConfiguration.builder().build());
}
@Test
@ -121,12 +134,63 @@ public class EthFeeHistoryTest {
public void shouldComputeRewardsCorrectly() {
// Define the percentiles of rewards we want to compute
List<Double> rewardPercentiles =
Arrays.asList(0.0, 5.0, 10.0, 30.0, 31.0, 59.0, 60.0, 61.0, 100.0);
Arrays.asList(0.0, 5.0, 10.0, 27.50, 31.0, 59.0, 60.0, 61.0, 100.0);
Block block = mock(Block.class);
Blockchain blockchain = mockBlockchainTransactionsWithPriorityFee(block);
EthFeeHistory ethFeeHistory =
new EthFeeHistory(
null, blockchain, miningCoordinator, ImmutableApiConfiguration.builder().build());
List<Wei> rewards = ethFeeHistory.computeRewards(rewardPercentiles, block);
// Define the expected rewards for each percentile
// The expected rewards match the fees of the transactions at each percentile in the
// rewardPercentiles list
List<Wei> expectedRewards = Stream.of(1, 1, 2, 5, 5, 6, 6, 7, 7).map(Wei::of).toList();
List<Wei> expectedRewards = Stream.of(1, 1, 2, 4, 5, 6, 6, 7, 7).map(Wei::of).toList();
// Check that the number of computed rewards is equal to the number of requested percentiles
assertThat(rewards.size()).isEqualTo(rewardPercentiles.size());
assertThat(expectedRewards).isEqualTo(rewards);
}
@Test
public void shouldBoundRewardsCorrectly() {
// This test checks that the rewards are correctly bounded by the lower and upper limits.
// The lower and upper limits are defined by the lowerBoundPriorityFeeCoefficient and
// upperBoundPriorityFeeCoefficient in the ApiConfiguration.
// The lower limit is 2.0 (Wei.One * 200L / 100) and the upper limit is 5.0 (Wei.One * 500L /
// 100).
// The rewards are computed for a list of percentiles, and the expected bounded rewards are
// defined for each percentile.
// The test checks that the computed rewards match the expected bounded rewards.
List<Double> rewardPercentiles =
Arrays.asList(0.0, 5.0, 10.0, 27.50, 31.0, 59.0, 60.0, 61.0, 100.0);
Block block = mock(Block.class);
Blockchain blockchain = mockBlockchainTransactionsWithPriorityFee(block);
ApiConfiguration apiConfiguration =
ImmutableApiConfiguration.builder()
.isPriorityFeeLimitingEnabled(true)
.lowerBoundPriorityFeeCoefficient(200L) // Min reward = Wei.One * 200L / 100 = 2.0
.upperBoundPriorityFeeCoefficient(500L)
.build(); // Max reward = Wei.One * 500L / 100 = 5.0
EthFeeHistory ethFeeHistory =
new EthFeeHistory(null, blockchain, miningCoordinator, apiConfiguration);
List<Wei> rewards = ethFeeHistory.computeRewards(rewardPercentiles, block);
// Define the expected bounded rewards for each percentile
List<Wei> expectedBoundedRewards = Stream.of(2, 2, 2, 4, 5, 5, 5, 5, 5).map(Wei::of).toList();
assertThat(expectedBoundedRewards).isEqualTo(rewards);
}
private Blockchain mockBlockchainTransactionsWithPriorityFee(final Block block) {
final Blockchain blockchain = mock(Blockchain.class);
// Define a list of gas used and fee pairs. Each pair represents a transaction in the block.
// The first number is the gas used by the transaction, and the second number the fee.
@ -141,21 +205,6 @@ public class EthFeeHistoryTest {
gasUsedAndFee.add(new Object[] {800, 7L}); // 100.0%
Collections.shuffle(gasUsedAndFee);
Block block = mock(Block.class);
Blockchain blockchain = mockBlockchainTransactionsWithPriorityFee(gasUsedAndFee, block);
EthFeeHistory ethFeeHistory = new EthFeeHistory(null, blockchain);
List<Wei> rewards = ethFeeHistory.computeRewards(rewardPercentiles, block);
// Check that the number of computed rewards is equal to the number of requested percentiles
assertThat(rewards.size()).isEqualTo(rewardPercentiles.size());
assertThat(rewards).isEqualTo(expectedRewards);
}
private Blockchain mockBlockchainTransactionsWithPriorityFee(
final List<Object[]> gasUsedAndFee, final Block block) {
final Blockchain blockchain = mock(Blockchain.class);
when(block.getHash()).thenReturn(Hash.wrap(Bytes32.wrap(Bytes.random(32))));
BlockBody body = mock(BlockBody.class);
BlockHeader blockHeader = mock(BlockHeader.class);

@ -110,6 +110,10 @@ public abstract class AbstractMinerExecutor<M extends BlockMiner<? extends Abstr
return miningParameters.getMinTransactionGasPrice();
}
public Wei getMinPriorityFeePerGas() {
return miningParameters.getMinPriorityFeePerGas();
}
public abstract Optional<Address> getCoinbase();
public void changeTargetGasLimit(final Long newTargetGasLimit) {

@ -207,6 +207,11 @@ public abstract class AbstractMiningCoordinator<
return executor.getMinTransactionGasPrice();
}
@Override
public Wei getMinPriorityFeePerGas() {
return executor.getMinPriorityFeePerGas();
}
@Override
public void setExtraData(final Bytes extraData) {
executor.setExtraData(extraData);

@ -58,6 +58,8 @@ public interface MiningCoordinator {
Wei getMinTransactionGasPrice();
Wei getMinPriorityFeePerGas();
void setExtraData(Bytes extraData);
default void setCoinbase(final Address coinbase) {

@ -64,6 +64,11 @@ public class NoopMiningCoordinator implements MiningCoordinator {
return miningParameters.getMinTransactionGasPrice();
}
@Override
public Wei getMinPriorityFeePerGas() {
return miningParameters.getMinPriorityFeePerGas();
}
@Override
public void setExtraData(final Bytes extraData) {}

Loading…
Cancel
Save