diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java index 21ca45070b..76e18812b0 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java @@ -27,7 +27,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.InProcessRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.ipc.JsonRpcIpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration; @@ -101,7 +101,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable private final boolean revertReasonEnabled; private final String name; - private MiningParameters miningParameters; + private MiningConfiguration miningConfiguration; private TransactionPoolConfiguration txPoolConfiguration; private final List runCommand; private PrivacyParameters privacyParameters = PrivacyParameters.DEFAULT; @@ -139,7 +139,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable public BesuNode( final String name, final Optional dataPath, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final TransactionPoolConfiguration txPoolConfiguration, final JsonRpcConfiguration jsonRpcConfiguration, final Optional engineRpcConfiguration, @@ -191,7 +191,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable }, () -> this.keyPair = KeyPairUtil.loadKeyPair(homeDirectory)); this.name = name; - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; this.txPoolConfiguration = txPoolConfiguration; this.jsonRpcConfiguration = jsonRpcConfiguration; this.engineRpcConfiguration = engineRpcConfiguration; @@ -678,12 +678,12 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable this.bootnodes.addAll(bootnodes); } - public MiningParameters getMiningParameters() { - return miningParameters; + public MiningConfiguration getMiningParameters() { + return miningConfiguration; } - public void setMiningParameters(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public void setMiningParameters(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; } public TransactionPoolConfiguration getTransactionPoolConfiguration() { diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index 036a1e0019..a76a3e6dcb 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -36,8 +36,8 @@ import org.hyperledger.besu.ethereum.api.ApiConfiguration; import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.InProcessRpcConfiguration; import org.hyperledger.besu.ethereum.chain.Blockchain; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.plugins.PluginConfiguration; import org.hyperledger.besu.ethereum.core.plugins.PluginInfo; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; @@ -448,7 +448,7 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { final BesuControllerBuilder builder, final MetricsSystem metricsSystem, final KeyValueStorageProvider storageProvider, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { builder .synchronizerConfiguration(synchronizerConfiguration) @@ -461,7 +461,7 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { .evmConfiguration(EvmConfiguration.DEFAULT) .maxPeers(25) .maxRemotelyInitiatedPeers(15) - .miningParameters(miningParameters) + .miningParameters(miningConfiguration) .randomPeerPriority(false) .besuComponent(null); return builder.build(); @@ -564,11 +564,11 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { } @Provides - public MiningParameters provideMiningParameters( + public MiningConfiguration provideMiningParameters( final TransactionSelectionServiceImpl transactionSelectionServiceImpl, final BesuNode node) { final var miningParameters = - ImmutableMiningParameters.builder() + ImmutableMiningConfiguration.builder() .from(node.getMiningParameters()) .transactionSelectionService(transactionSelectionServiceImpl) .build(); @@ -579,11 +579,11 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { @Provides @Inject BesuConfiguration provideBesuConfiguration( - final Path dataDir, final MiningParameters miningParameters, final BesuNode node) { + final Path dataDir, final MiningConfiguration miningConfiguration, final BesuNode node) { final BesuConfigurationImpl commonPluginConfiguration = new BesuConfigurationImpl(); commonPluginConfiguration.init( dataDir, dataDir.resolve(DATABASE_PATH), node.getDataStorageConfiguration()); - commonPluginConfiguration.withMiningParameters(miningParameters); + commonPluginConfiguration.withMiningParameters(miningConfiguration); return commonPluginConfiguration; } } diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java index ba69e4ddd7..5840f1e4f1 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java @@ -21,7 +21,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.InProcessRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.ipc.JsonRpcIpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration; import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration; @@ -40,7 +40,7 @@ public class BesuNodeConfiguration { private final String name; private final Optional dataPath; - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; private final TransactionPoolConfiguration transactionPoolConfiguration; private final JsonRpcConfiguration jsonRpcConfiguration; private final Optional engineRpcConfiguration; @@ -78,7 +78,7 @@ public class BesuNodeConfiguration { BesuNodeConfiguration( final String name, final Optional dataPath, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final TransactionPoolConfiguration transactionPoolConfiguration, final JsonRpcConfiguration jsonRpcConfiguration, final Optional engineRpcConfiguration, @@ -113,7 +113,7 @@ public class BesuNodeConfiguration { final boolean strictTxReplayProtectionEnabled, final Map environment) { this.name = name; - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; this.transactionPoolConfiguration = transactionPoolConfiguration; this.jsonRpcConfiguration = jsonRpcConfiguration; this.engineRpcConfiguration = engineRpcConfiguration; @@ -154,8 +154,8 @@ public class BesuNodeConfiguration { return name; } - public MiningParameters getMiningParameters() { - return miningParameters; + public MiningConfiguration getMiningParameters() { + return miningConfiguration; } public TransactionPoolConfiguration getTransactionPoolConfiguration() { diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java index ead01ce97d..9b000f56f1 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java @@ -33,9 +33,9 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.ipc.JsonRpcIpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration; import org.hyperledger.besu.ethereum.api.tls.FileBasedPasswordProvider; import org.hyperledger.besu.ethereum.core.AddressHelpers; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration; import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration; @@ -61,8 +61,8 @@ public class BesuNodeConfigurationBuilder { private String name; private Optional dataPath = Optional.empty(); - private MiningParameters miningParameters = - ImmutableMiningParameters.builder() + private MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder().coinbase(AddressHelpers.ofValue(1)).build()) .build(); @@ -125,13 +125,14 @@ public class BesuNodeConfigurationBuilder { } public BesuNodeConfigurationBuilder miningEnabled(final boolean enabled) { - this.miningParameters = miningParameters.setMiningEnabled(enabled); + this.miningConfiguration = miningConfiguration.setMiningEnabled(enabled); this.jsonRpcConfiguration.addRpcApi(RpcApis.MINER.name()); return this; } - public BesuNodeConfigurationBuilder miningConfiguration(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public BesuNodeConfigurationBuilder miningConfiguration( + final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; this.jsonRpcConfiguration.addRpcApi(RpcApis.MINER.name()); return this; } @@ -527,7 +528,7 @@ public class BesuNodeConfigurationBuilder { return new BesuNodeConfiguration( name, dataPath, - miningParameters, + miningConfiguration, transactionPoolConfiguration, jsonRpcConfiguration, Optional.of(engineRpcConfiguration), diff --git a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bft/BftMiningAcceptanceTest.java b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bft/BftMiningAcceptanceTest.java index 1e741a5cc6..177987aaaf 100644 --- a/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bft/BftMiningAcceptanceTest.java +++ b/acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bft/BftMiningAcceptanceTest.java @@ -17,9 +17,9 @@ package org.hyperledger.besu.tests.acceptance.bft; import org.hyperledger.besu.config.JsonUtil; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.AddressHelpers; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.tests.acceptance.dsl.account.Account; import org.hyperledger.besu.tests.acceptance.dsl.blockchain.Amount; import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; @@ -62,8 +62,8 @@ public class BftMiningAcceptanceTest extends ParameterizedBftTestBase { final String testName, final BftAcceptanceTestParameterization nodeFactory) throws Exception { setUp(testName, nodeFactory); final BesuNode minerNode = nodeFactory.createNode(besu, "miner1"); - final MiningParameters zeroGasMiningParams = - ImmutableMiningParameters.builder() + final MiningConfiguration zeroGasMiningParams = + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .isMiningEnabled(true) diff --git a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java index 96eef547fe..d6619d6c12 100644 --- a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java @@ -70,7 +70,7 @@ import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.manager.EthPeers; @@ -773,7 +773,7 @@ public class RunnerBuilder { final TransactionPool transactionPool = besuController.getTransactionPool(); final MiningCoordinator miningCoordinator = besuController.getMiningCoordinator(); - final MiningParameters miningParameters = besuController.getMiningParameters(); + final MiningConfiguration miningConfiguration = besuController.getMiningParameters(); final BlockchainQueries blockchainQueries = new BlockchainQueries( @@ -783,7 +783,7 @@ public class RunnerBuilder { Optional.of(dataDir.resolve(CACHE_PATH)), Optional.of(besuController.getProtocolManager().ethContext().getScheduler()), apiConfiguration, - miningParameters); + miningConfiguration); final PrivacyParameters privacyParameters = besuController.getPrivacyParameters(); @@ -802,7 +802,7 @@ public class RunnerBuilder { Optional stratumServer = Optional.empty(); - if (miningParameters.isStratumMiningEnabled()) { + if (miningConfiguration.isStratumMiningEnabled()) { if (!(miningCoordinator instanceof PoWMiningCoordinator powMiningCoordinator)) { throw new IllegalArgumentException( "Stratum mining requires the network option(--network) to be set to CLASSIC. Stratum server requires a PoWMiningCoordinator not " @@ -813,9 +813,9 @@ public class RunnerBuilder { new StratumServer( vertx, powMiningCoordinator, - miningParameters.getStratumPort(), - miningParameters.getStratumNetworkInterface(), - miningParameters.getUnstable().getStratumExtranonce(), + miningConfiguration.getStratumPort(), + miningConfiguration.getStratumNetworkInterface(), + miningConfiguration.getUnstable().getStratumExtranonce(), metricsSystem)); miningCoordinator.addEthHashObserver(stratumServer.get()); LOG.debug("added ethash observer: {}", stratumServer.get()); @@ -849,7 +849,7 @@ public class RunnerBuilder { blockchainQueries, synchronizer, transactionPool, - miningParameters, + miningConfiguration, miningCoordinator, metricsSystem, supportedCapabilities, @@ -896,7 +896,7 @@ public class RunnerBuilder { blockchainQueries, synchronizer, transactionPool, - miningParameters, + miningConfiguration, miningCoordinator, metricsSystem, supportedCapabilities, @@ -989,7 +989,7 @@ public class RunnerBuilder { blockchainQueries, synchronizer, transactionPool, - miningParameters, + miningConfiguration, miningCoordinator, metricsSystem, supportedCapabilities, @@ -1070,7 +1070,7 @@ public class RunnerBuilder { blockchainQueries, synchronizer, transactionPool, - miningParameters, + miningConfiguration, miningCoordinator, metricsSystem, supportedCapabilities, @@ -1111,7 +1111,7 @@ public class RunnerBuilder { blockchainQueries, synchronizer, transactionPool, - miningParameters, + miningConfiguration, miningCoordinator, metricsSystem, supportedCapabilities, @@ -1273,7 +1273,7 @@ public class RunnerBuilder { final BlockchainQueries blockchainQueries, final Synchronizer synchronizer, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final MiningCoordinator miningCoordinator, final ObservableMetricsSystem metricsSystem, final Set supportedCapabilities, @@ -1308,7 +1308,7 @@ public class RunnerBuilder { protocolContext, filterManager, transactionPool, - miningParameters, + miningConfiguration, miningCoordinator, metricsSystem, supportedCapabilities, diff --git a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java index 8a01236725..b974dcd315 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java @@ -113,7 +113,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.ipc.JsonRpcIpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.Blockchain; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MiningParametersMetrics; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.VersionMetadata; @@ -338,7 +338,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { Suppliers.memoize(this::readGenesisConfigFile); private final Supplier genesisConfigOptionsSupplier = Suppliers.memoize(this::readGenesisConfigOptions); - private final Supplier miningParametersSupplier = + private final Supplier miningParametersSupplier = Suppliers.memoize(this::getMiningParameters); private RocksDBPlugin rocksDBPlugin; @@ -2117,7 +2117,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable { return txPoolConfBuilder.build(); } - private MiningParameters getMiningParameters() { + private MiningConfiguration getMiningParameters() { miningOptions.setTransactionSelectionService(transactionSelectionServiceImpl); final var miningParameters = miningOptions.toDomainObject(); getGenesisBlockPeriodSeconds(genesisConfigOptionsSupplier.get()) @@ -2169,8 +2169,8 @@ public class BesuCommand implements DefaultCommandValues, Runnable { return dataStorageConfiguration; } - private void initMiningParametersMetrics(final MiningParameters miningParameters) { - new MiningParametersMetrics(getMetricsSystem(), miningParameters); + private void initMiningParametersMetrics(final MiningConfiguration miningConfiguration) { + new MiningParametersMetrics(getMetricsSystem(), miningConfiguration); } private OptionalInt getGenesisBlockPeriodSeconds( diff --git a/besu/src/main/java/org/hyperledger/besu/cli/options/MiningOptions.java b/besu/src/main/java/org/hyperledger/besu/cli/options/MiningOptions.java index a884edfe33..fa0cf4dc06 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/options/MiningOptions.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/options/MiningOptions.java @@ -17,27 +17,27 @@ package org.hyperledger.besu.cli.options; import static com.google.common.base.Preconditions.checkNotNull; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; -import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME; -import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME; -import static org.hyperledger.besu.ethereum.core.MiningParameters.MutableInitValues.DEFAULT_EXTRA_DATA; -import static org.hyperledger.besu.ethereum.core.MiningParameters.MutableInitValues.DEFAULT_MIN_BLOCK_OCCUPANCY_RATIO; -import static org.hyperledger.besu.ethereum.core.MiningParameters.MutableInitValues.DEFAULT_MIN_PRIORITY_FEE_PER_GAS; -import static org.hyperledger.besu.ethereum.core.MiningParameters.MutableInitValues.DEFAULT_MIN_TRANSACTION_GAS_PRICE; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_MAX_OMMERS_DEPTH; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_POS_BLOCK_CREATION_MAX_TIME; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_POS_BLOCK_CREATION_REPETITION_MIN_DURATION; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_POW_JOB_TTL; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_REMOTE_SEALERS_LIMIT; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_REMOTE_SEALERS_TTL; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.MutableInitValues.DEFAULT_EXTRA_DATA; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.MutableInitValues.DEFAULT_MIN_BLOCK_OCCUPANCY_RATIO; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.MutableInitValues.DEFAULT_MIN_PRIORITY_FEE_PER_GAS; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.MutableInitValues.DEFAULT_MIN_TRANSACTION_GAS_PRICE; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_MAX_OMMERS_DEPTH; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_POS_BLOCK_CREATION_MAX_TIME; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_POS_BLOCK_CREATION_REPETITION_MIN_DURATION; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_POW_JOB_TTL; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_REMOTE_SEALERS_LIMIT; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_REMOTE_SEALERS_TTL; import org.hyperledger.besu.cli.converter.PositiveNumberConverter; import org.hyperledger.besu.cli.util.CommandLineUtils; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.plugin.services.TransactionSelectionService; import org.hyperledger.besu.util.number.PositiveNumber; @@ -50,7 +50,7 @@ import picocli.CommandLine.Option; import picocli.CommandLine.ParameterException; /** The Mining CLI options. */ -public class MiningOptions implements CLIOptions { +public class MiningOptions implements CLIOptions { @Option( names = {"--miner-enabled"}, @@ -300,43 +300,45 @@ public class MiningOptions implements CLIOptions { } } - static MiningOptions fromConfig(final MiningParameters miningParameters) { + static MiningOptions fromConfig(final MiningConfiguration miningConfiguration) { final MiningOptions miningOptions = MiningOptions.create(); - miningOptions.setTransactionSelectionService(miningParameters.getTransactionSelectionService()); - miningOptions.isMiningEnabled = miningParameters.isMiningEnabled(); - miningOptions.iStratumMiningEnabled = miningParameters.isStratumMiningEnabled(); - miningOptions.stratumNetworkInterface = miningParameters.getStratumNetworkInterface(); - miningOptions.stratumPort = miningParameters.getStratumPort(); - miningOptions.extraData = miningParameters.getExtraData(); - miningOptions.minTransactionGasPrice = miningParameters.getMinTransactionGasPrice(); - miningOptions.minPriorityFeePerGas = miningParameters.getMinPriorityFeePerGas(); - miningOptions.minBlockOccupancyRatio = miningParameters.getMinBlockOccupancyRatio(); + miningOptions.setTransactionSelectionService( + miningConfiguration.getTransactionSelectionService()); + miningOptions.isMiningEnabled = miningConfiguration.isMiningEnabled(); + miningOptions.iStratumMiningEnabled = miningConfiguration.isStratumMiningEnabled(); + miningOptions.stratumNetworkInterface = miningConfiguration.getStratumNetworkInterface(); + miningOptions.stratumPort = miningConfiguration.getStratumPort(); + miningOptions.extraData = miningConfiguration.getExtraData(); + miningOptions.minTransactionGasPrice = miningConfiguration.getMinTransactionGasPrice(); + miningOptions.minPriorityFeePerGas = miningConfiguration.getMinPriorityFeePerGas(); + miningOptions.minBlockOccupancyRatio = miningConfiguration.getMinBlockOccupancyRatio(); miningOptions.nonPoaBlockTxsSelectionMaxTime = - miningParameters.getNonPoaBlockTxsSelectionMaxTime(); - miningOptions.poaBlockTxsSelectionMaxTime = miningParameters.getPoaBlockTxsSelectionMaxTime(); + miningConfiguration.getNonPoaBlockTxsSelectionMaxTime(); + miningOptions.poaBlockTxsSelectionMaxTime = + miningConfiguration.getPoaBlockTxsSelectionMaxTime(); miningOptions.unstableOptions.remoteSealersLimit = - miningParameters.getUnstable().getRemoteSealersLimit(); + miningConfiguration.getUnstable().getRemoteSealersLimit(); miningOptions.unstableOptions.remoteSealersTimeToLive = - miningParameters.getUnstable().getRemoteSealersTimeToLive(); + miningConfiguration.getUnstable().getRemoteSealersTimeToLive(); miningOptions.unstableOptions.powJobTimeToLive = - miningParameters.getUnstable().getPowJobTimeToLive(); + miningConfiguration.getUnstable().getPowJobTimeToLive(); miningOptions.unstableOptions.maxOmmersDepth = - miningParameters.getUnstable().getMaxOmmerDepth(); + miningConfiguration.getUnstable().getMaxOmmerDepth(); miningOptions.unstableOptions.stratumExtranonce = - miningParameters.getUnstable().getStratumExtranonce(); + miningConfiguration.getUnstable().getStratumExtranonce(); miningOptions.unstableOptions.posBlockCreationMaxTime = - miningParameters.getUnstable().getPosBlockCreationMaxTime(); + miningConfiguration.getUnstable().getPosBlockCreationMaxTime(); miningOptions.unstableOptions.posBlockCreationRepetitionMinDuration = - miningParameters.getUnstable().getPosBlockCreationRepetitionMinDuration(); + miningConfiguration.getUnstable().getPosBlockCreationRepetitionMinDuration(); - miningParameters.getCoinbase().ifPresent(coinbase -> miningOptions.coinbase = coinbase); - miningParameters.getTargetGasLimit().ifPresent(tgl -> miningOptions.targetGasLimit = tgl); + miningConfiguration.getCoinbase().ifPresent(coinbase -> miningOptions.coinbase = coinbase); + miningConfiguration.getTargetGasLimit().ifPresent(tgl -> miningOptions.targetGasLimit = tgl); return miningOptions; } @Override - public MiningParameters toDomainObject() { + public MiningConfiguration toDomainObject() { checkNotNull( transactionSelectionService, "transactionSelectionService must be set before using this object"); @@ -356,7 +358,7 @@ public class MiningOptions implements CLIOptions { updatableInitValuesBuilder.coinbase(coinbase); } - return ImmutableMiningParameters.builder() + return ImmutableMiningConfiguration.builder() .transactionSelectionService(transactionSelectionService) .mutableInitValues(updatableInitValuesBuilder.build()) .isStratumMiningEnabled(iStratumMiningEnabled) @@ -365,7 +367,7 @@ public class MiningOptions implements CLIOptions { .nonPoaBlockTxsSelectionMaxTime(nonPoaBlockTxsSelectionMaxTime) .poaBlockTxsSelectionMaxTime(poaBlockTxsSelectionMaxTime) .unstable( - ImmutableMiningParameters.Unstable.builder() + ImmutableMiningConfiguration.Unstable.builder() .remoteSealersLimit(unstableOptions.remoteSealersLimit) .remoteSealersTimeToLive(unstableOptions.remoteSealersTimeToLive) .powJobTimeToLive(unstableOptions.powJobTimeToLive) diff --git a/besu/src/main/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommand.java b/besu/src/main/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommand.java index 5bd0aacee2..95617fe8ca 100644 --- a/besu/src/main/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommand.java +++ b/besu/src/main/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommand.java @@ -31,9 +31,9 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.blockcreation.IncrementingNonceGenerator; import org.hyperledger.besu.ethereum.chain.Blockchain; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.metrics.MetricsService; import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration; @@ -265,12 +265,12 @@ public class BlocksSubCommand implements Runnable { } } - private MiningParameters getMiningParameters() { + private MiningConfiguration getMiningParameters() { final Wei minTransactionGasPrice = Wei.ZERO; // Extradata and coinbase can be configured on a per-block level via the json file final Address coinbase = Address.ZERO; final Bytes extraData = Bytes.EMPTY; - return ImmutableMiningParameters.builder() + return ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .nonceGenerator(new IncrementingNonceGenerator(0)) @@ -377,7 +377,7 @@ public class BlocksSubCommand implements Runnable { return parentCommand .parentCommand .setupControllerBuilder() - .miningParameters(MiningParameters.newDefault()) + .miningParameters(MiningConfiguration.newDefault()) .build(); } diff --git a/besu/src/main/java/org/hyperledger/besu/controller/BesuController.java b/besu/src/main/java/org/hyperledger/besu/controller/BesuController.java index fb99318905..238e5c3c1c 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/BesuController.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/BesuController.java @@ -24,7 +24,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.methods.JsonRpcMethods; import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.manager.EthPeers; @@ -71,7 +71,7 @@ public class BesuController implements java.io.Closeable { private final MiningCoordinator miningCoordinator; private final PrivacyParameters privacyParameters; private final List closeables; - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; private final PluginServiceFactory additionalPluginServices; private final SyncState syncState; private final EthPeers ethPeers; @@ -91,7 +91,7 @@ public class BesuController implements java.io.Closeable { * @param transactionPool the transaction pool * @param miningCoordinator the mining coordinator * @param privacyParameters the privacy parameters - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param additionalJsonRpcMethodsFactory the additional json rpc methods factory * @param nodeKey the node key * @param closeables the closeables @@ -111,7 +111,7 @@ public class BesuController implements java.io.Closeable { final TransactionPool transactionPool, final MiningCoordinator miningCoordinator, final PrivacyParameters privacyParameters, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final JsonRpcMethods additionalJsonRpcMethodsFactory, final NodeKey nodeKey, final List closeables, @@ -132,7 +132,7 @@ public class BesuController implements java.io.Closeable { this.miningCoordinator = miningCoordinator; this.privacyParameters = privacyParameters; this.closeables = closeables; - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; this.additionalPluginServices = additionalPluginServices; this.ethPeers = ethPeers; this.storageProvider = storageProvider; @@ -265,8 +265,8 @@ public class BesuController implements java.io.Closeable { * * @return the mining parameters */ - public MiningParameters getMiningParameters() { - return miningParameters; + public MiningConfiguration getMiningParameters() { + return miningConfiguration; } /** diff --git a/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java index 6a4cc203a3..5eb5e1214d 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java @@ -43,7 +43,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.chain.VariablesStorage; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; @@ -144,7 +144,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides protected BigInteger networkId; /** The Mining parameters. */ - protected MiningParameters miningParameters; + protected MiningConfiguration miningConfiguration; /** The Metrics system. */ protected ObservableMetricsSystem metricsSystem; @@ -296,11 +296,11 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides /** * Mining parameters besu controller builder. * - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @return the besu controller builder */ - public BesuControllerBuilder miningParameters(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public BesuControllerBuilder miningParameters(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; return this; } @@ -543,7 +543,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides checkNotNull(syncConfig, "Missing sync config"); checkNotNull(ethereumWireProtocolConfiguration, "Missing ethereum protocol configuration"); checkNotNull(networkId, "Missing network ID"); - checkNotNull(miningParameters, "Missing mining parameters"); + checkNotNull(miningConfiguration, "Missing mining parameters"); checkNotNull(metricsSystem, "Missing metrics system"); checkNotNull(privacyParameters, "Missing privacy parameters"); checkNotNull(dataDirectory, "Missing data directory"); // Why do we need this? @@ -680,7 +680,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides syncState, transactionPoolConfiguration, besuComponent.map(BesuComponent::getBlobCache).orElse(new BlobCache()), - miningParameters); + miningConfiguration); final List peerValidators = createPeerValidators(protocolSchedule); @@ -734,7 +734,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides protocolSchedule, protocolContext, transactionPool, - miningParameters, + miningConfiguration, syncState, ethProtocolManager); @@ -745,7 +745,8 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides createSubProtocolConfiguration(ethProtocolManager, maybeSnapProtocolManager); final JsonRpcMethods additionalJsonRpcMethodFactory = - createAdditionalJsonRpcMethodFactory(protocolContext, protocolSchedule, miningParameters); + createAdditionalJsonRpcMethodFactory( + protocolContext, protocolSchedule, miningConfiguration); if (DataStorageFormat.BONSAI.equals(dataStorageConfiguration.getDataStorageFormat())) { final DiffBasedSubStorageConfiguration subStorageConfiguration = @@ -779,7 +780,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides transactionPool, miningCoordinator, privacyParameters, - miningParameters, + miningConfiguration, additionalJsonRpcMethodFactory, nodeKey, closeables, @@ -938,13 +939,13 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides * * @param protocolContext the protocol context * @param protocolSchedule the protocol schedule - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @return the json rpc methods */ protected JsonRpcMethods createAdditionalJsonRpcMethodFactory( final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { return apis -> Collections.emptyMap(); } @@ -972,7 +973,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides * @param protocolSchedule the protocol schedule * @param protocolContext the protocol context * @param transactionPool the transaction pool - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param syncState the sync state * @param ethProtocolManager the eth protocol manager * @return the mining coordinator @@ -981,7 +982,7 @@ public abstract class BesuControllerBuilder implements MiningParameterOverrides ProtocolSchedule protocolSchedule, ProtocolContext protocolContext, TransactionPool transactionPool, - MiningParameters miningParameters, + MiningConfiguration miningConfiguration, SyncState syncState, EthProtocolManager ethProtocolManager); diff --git a/besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java index 77bf60b034..19840fb73d 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.methods.JsonRpcMethods; import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; @@ -74,8 +74,8 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder { protected JsonRpcMethods createAdditionalJsonRpcMethodFactory( final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, - final MiningParameters miningParameters) { - return new CliqueJsonRpcMethods(protocolContext, protocolSchedule, miningParameters); + final MiningConfiguration miningConfiguration) { + return new CliqueJsonRpcMethods(protocolContext, protocolSchedule, miningConfiguration); } @Override @@ -83,7 +83,7 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder { final ProtocolSchedule protocolSchedule, final ProtocolContext protocolContext, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final SyncState syncState, final EthProtocolManager ethProtocolManager) { final CliqueMinerExecutor miningExecutor = @@ -92,7 +92,7 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder { protocolSchedule, transactionPool, nodeKey, - miningParameters, + miningConfiguration, new CliqueBlockScheduler( clock, protocolContext.getConsensusContext(CliqueContext.class).getValidatorProvider(), @@ -113,7 +113,7 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder { .getBlockchain() .observeBlockAdded( o -> - miningParameters.setBlockPeriodSeconds( + miningConfiguration.setBlockPeriodSeconds( forksSchedule .getFork(o.getBlock().getHeader().getNumber() + 1) .getValue() @@ -134,7 +134,7 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder { nodeKey, isRevertReasonEnabled, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -171,7 +171,7 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder { } @Override - public MiningParameters getMiningParameterOverrides(final MiningParameters fromCli) { + public MiningConfiguration getMiningParameterOverrides(final MiningConfiguration fromCli) { // Clique mines by default, reflect that with in the mining parameters: return fromCli.setMiningEnabled(true); } diff --git a/besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java index 0d0f8d2fd8..3ecd5a6c41 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java @@ -33,7 +33,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.methods.JsonRpcMethods; 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.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthContext; @@ -128,7 +128,7 @@ public class ConsensusScheduleBesuControllerBuilder extends BesuControllerBuilde final ProtocolSchedule protocolSchedule, final ProtocolContext protocolContext, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final SyncState syncState, final EthProtocolManager ethProtocolManager) { @@ -143,7 +143,7 @@ public class ConsensusScheduleBesuControllerBuilder extends BesuControllerBuilde protocolSchedule, protocolContext, transactionPool, - miningParameters, + miningConfiguration, syncState, ethProtocolManager))) .collect(Collectors.toList()); @@ -206,10 +206,11 @@ public class ConsensusScheduleBesuControllerBuilder extends BesuControllerBuilde protected JsonRpcMethods createAdditionalJsonRpcMethodFactory( final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { return besuControllerBuilderSchedule .get(0L) - .createAdditionalJsonRpcMethodFactory(protocolContext, protocolSchedule, miningParameters); + .createAdditionalJsonRpcMethodFactory( + protocolContext, protocolSchedule, miningConfiguration); } @Override @@ -297,9 +298,9 @@ public class ConsensusScheduleBesuControllerBuilder extends BesuControllerBuilde } @Override - public BesuControllerBuilder miningParameters(final MiningParameters miningParameters) { - besuControllerBuilderSchedule.values().forEach(b -> b.miningParameters(miningParameters)); - return super.miningParameters(miningParameters); + public BesuControllerBuilder miningParameters(final MiningConfiguration miningConfiguration) { + besuControllerBuilderSchedule.values().forEach(b -> b.miningParameters(miningConfiguration)); + return super.miningParameters(miningConfiguration); } @Override diff --git a/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java index 738dcfc596..ae08b11cca 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java @@ -60,7 +60,7 @@ import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.chain.MinedBlockObserver; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.SnapProtocol; @@ -114,8 +114,8 @@ public class IbftBesuControllerBuilder extends BftBesuControllerBuilder { protected JsonRpcMethods createAdditionalJsonRpcMethodFactory( final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, - final MiningParameters miningParameters) { - return new IbftJsonRpcMethods(protocolContext, protocolSchedule, miningParameters); + final MiningConfiguration miningConfiguration) { + return new IbftJsonRpcMethods(protocolContext, protocolSchedule, miningConfiguration); } @Override @@ -141,7 +141,7 @@ public class IbftBesuControllerBuilder extends BftBesuControllerBuilder { final ProtocolSchedule protocolSchedule, final ProtocolContext protocolContext, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final SyncState syncState, final EthProtocolManager ethProtocolManager) { final MutableBlockchain blockchain = protocolContext.getBlockchain(); @@ -156,7 +156,7 @@ public class IbftBesuControllerBuilder extends BftBesuControllerBuilder { protocolContext, bftProtocolSchedule, forksSchedule, - miningParameters, + miningConfiguration, localAddress, bftExtraDataCodec().get(), ethProtocolManager.ethContext().getScheduler()); @@ -247,7 +247,7 @@ public class IbftBesuControllerBuilder extends BftBesuControllerBuilder { .getBlockchain() .observeBlockAdded( o -> - miningParameters.setBlockPeriodSeconds( + miningConfiguration.setBlockPeriodSeconds( forksSchedule .getFork(o.getBlock().getHeader().getNumber() + 1) .getValue() @@ -303,7 +303,7 @@ public class IbftBesuControllerBuilder extends BftBesuControllerBuilder { isRevertReasonEnabled, bftExtraDataCodec().get(), evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java index dbd2c5904a..a642539ac5 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java @@ -21,7 +21,7 @@ import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; import org.hyperledger.besu.ethereum.blockcreation.PoWMinerExecutor; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.Blockchain; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; @@ -46,7 +46,7 @@ public class MainnetBesuControllerBuilder extends BesuControllerBuilder { final ProtocolSchedule protocolSchedule, final ProtocolContext protocolContext, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final SyncState syncState, final EthProtocolManager ethProtocolManager) { @@ -55,7 +55,7 @@ public class MainnetBesuControllerBuilder extends BesuControllerBuilder { protocolContext, protocolSchedule, transactionPool, - miningParameters, + miningConfiguration, new DefaultBlockScheduler( MainnetBlockHeaderValidator.MINIMUM_SECONDS_SINCE_PARENT, MainnetBlockHeaderValidator.TIMESTAMP_TOLERANCE_S, @@ -68,11 +68,11 @@ public class MainnetBesuControllerBuilder extends BesuControllerBuilder { protocolContext.getBlockchain(), executor, syncState, - miningParameters.getUnstable().getRemoteSealersLimit(), - miningParameters.getUnstable().getRemoteSealersTimeToLive()); + miningConfiguration.getUnstable().getRemoteSealersLimit(), + miningConfiguration.getUnstable().getRemoteSealersTimeToLive()); miningCoordinator.addMinedBlockObserver(ethProtocolManager); - miningCoordinator.setStratumMiningEnabled(miningParameters.isStratumMiningEnabled()); - if (miningParameters.isMiningEnabled()) { + miningCoordinator.setStratumMiningEnabled(miningConfiguration.isStratumMiningEnabled()); + if (miningConfiguration.isMiningEnabled()) { miningCoordinator.enable(); } @@ -100,7 +100,7 @@ public class MainnetBesuControllerBuilder extends BesuControllerBuilder { Optional.of(privacyParameters), Optional.of(isRevertReasonEnabled), Optional.of(evmConfiguration), - super.miningParameters, + super.miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java index f5fc75959e..e7c1a5c40d 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java @@ -26,7 +26,7 @@ import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthMessages; @@ -67,14 +67,14 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder { final ProtocolSchedule protocolSchedule, final ProtocolContext protocolContext, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final SyncState syncState, final EthProtocolManager ethProtocolManager) { return createTransitionMiningCoordinator( protocolSchedule, protocolContext, transactionPool, - miningParameters, + miningConfiguration, syncState, new BackwardSyncContext( protocolContext, @@ -140,7 +140,7 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder { * @param protocolSchedule the protocol schedule * @param protocolContext the protocol context * @param transactionPool the transaction pool - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param syncState the sync state * @param backwardSyncContext the backward sync context * @param ethScheduler the scheduler @@ -150,7 +150,7 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder { final ProtocolSchedule protocolSchedule, final ProtocolContext protocolContext, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final SyncState syncState, final BackwardSyncContext backwardSyncContext, final EthScheduler ethScheduler) { @@ -165,7 +165,7 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder { protocolSchedule, ethScheduler, transactionPool, - miningParameters, + miningConfiguration, backwardSyncContext, depositContractAddress); } @@ -176,7 +176,7 @@ public class MergeBesuControllerBuilder extends BesuControllerBuilder { genesisConfigOptions, privacyParameters, isRevertReasonEnabled, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/besu/src/main/java/org/hyperledger/besu/controller/MiningParameterOverrides.java b/besu/src/main/java/org/hyperledger/besu/controller/MiningParameterOverrides.java index e4cebc0d64..ae2ae250ba 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/MiningParameterOverrides.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/MiningParameterOverrides.java @@ -14,7 +14,7 @@ */ package org.hyperledger.besu.controller; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; /** * This interface wraps the provided MiningParameters to enable controller-specific parameter @@ -27,7 +27,7 @@ public interface MiningParameterOverrides { * @param fromCli The mining parameters that contains original values. * @return MiningParameters constructed from provided param with additional overridden parameters. */ - default MiningParameters getMiningParameterOverrides(final MiningParameters fromCli) { + default MiningConfiguration getMiningParameterOverrides(final MiningConfiguration fromCli) { return fromCli; } } diff --git a/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java index 498435e4af..75aff30871 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java @@ -69,7 +69,7 @@ import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.chain.MinedBlockObserver; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.SnapProtocol; @@ -130,12 +130,12 @@ public class QbftBesuControllerBuilder extends BftBesuControllerBuilder { protected JsonRpcMethods createAdditionalJsonRpcMethodFactory( final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { return new QbftJsonRpcMethods( protocolContext, protocolSchedule, - miningParameters, + miningConfiguration, createReadOnlyValidatorProvider(protocolContext.getBlockchain()), bftConfigOptions); } @@ -181,7 +181,7 @@ public class QbftBesuControllerBuilder extends BftBesuControllerBuilder { final ProtocolSchedule protocolSchedule, final ProtocolContext protocolContext, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final SyncState syncState, final EthProtocolManager ethProtocolManager) { final MutableBlockchain blockchain = protocolContext.getBlockchain(); @@ -196,7 +196,7 @@ public class QbftBesuControllerBuilder extends BftBesuControllerBuilder { protocolContext, bftProtocolSchedule, qbftForksSchedule, - miningParameters, + miningConfiguration, localAddress, bftExtraDataCodec().get(), ethProtocolManager.ethContext().getScheduler()); @@ -289,12 +289,12 @@ public class QbftBesuControllerBuilder extends BftBesuControllerBuilder { .getBlockchain() .observeBlockAdded( o -> { - miningParameters.setBlockPeriodSeconds( + miningConfiguration.setBlockPeriodSeconds( qbftForksSchedule .getFork(o.getBlock().getHeader().getNumber() + 1) .getValue() .getBlockPeriodSeconds()); - miningParameters.setEmptyBlockPeriodSeconds( + miningConfiguration.setEmptyBlockPeriodSeconds( qbftForksSchedule .getFork(o.getBlock().getHeader().getNumber() + 1) .getValue() @@ -351,7 +351,7 @@ public class QbftBesuControllerBuilder extends BftBesuControllerBuilder { isRevertReasonEnabled, bftExtraDataCodec().get(), evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java b/besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java index 703592f90a..3530621fc6 100644 --- a/besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java @@ -30,8 +30,8 @@ import org.hyperledger.besu.ethereum.ProtocolContext; 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.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthContext; @@ -102,7 +102,7 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder { final ProtocolSchedule protocolSchedule, final ProtocolContext protocolContext, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final SyncState syncState, final EthProtocolManager ethProtocolManager) { @@ -112,8 +112,8 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder { // PoA consensus mines by default, get consensus-specific mining parameters for // TransitionCoordinator: - MiningParameters transitionMiningParameters = - preMergeBesuControllerBuilder.getMiningParameterOverrides(miningParameters); + MiningConfiguration transitionMiningConfiguration = + preMergeBesuControllerBuilder.getMiningParameterOverrides(miningConfiguration); // construct a transition backward sync context BackwardSyncContext transitionBackwardsSyncContext = @@ -131,10 +131,10 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder { transitionProtocolSchedule.getPreMergeSchedule(), protocolContext, transactionPool, - ImmutableMiningParameters.builder() - .from(miningParameters) + ImmutableMiningConfiguration.builder() + .from(miningConfiguration) .mutableInitValues( - ImmutableMiningParameters.MutableInitValues.builder() + ImmutableMiningConfiguration.MutableInitValues.builder() .isMiningEnabled(false) .build()) .build(), @@ -144,7 +144,7 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder { transitionProtocolSchedule, protocolContext, transactionPool, - transitionMiningParameters, + transitionMiningConfiguration, syncState, transitionBackwardsSyncContext, ethProtocolManager.ethContext().getScheduler())); @@ -329,9 +329,9 @@ public class TransitionBesuControllerBuilder extends BesuControllerBuilder { } @Override - public BesuControllerBuilder miningParameters(final MiningParameters miningParameters) { - super.miningParameters(miningParameters); - return propagateConfig(z -> z.miningParameters(miningParameters)); + public BesuControllerBuilder miningParameters(final MiningConfiguration miningConfiguration) { + super.miningParameters(miningConfiguration); + return propagateConfig(z -> z.miningParameters(miningConfiguration)); } @Override diff --git a/besu/src/main/java/org/hyperledger/besu/services/BesuConfigurationImpl.java b/besu/src/main/java/org/hyperledger/besu/services/BesuConfigurationImpl.java index 6d9a5410c4..39db58ee4d 100644 --- a/besu/src/main/java/org/hyperledger/besu/services/BesuConfigurationImpl.java +++ b/besu/src/main/java/org/hyperledger/besu/services/BesuConfigurationImpl.java @@ -16,7 +16,7 @@ package org.hyperledger.besu.services; import org.hyperledger.besu.cli.options.stable.JsonRpcHttpOptions; import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration; import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.plugin.services.storage.DataStorageFormat; @@ -31,7 +31,7 @@ public class BesuConfigurationImpl implements BesuConfiguration { private DataStorageConfiguration dataStorageConfiguration; // defaults - private MiningParameters miningParameters; + private MiningConfiguration miningConfiguration; private Optional rpcHttpHost = Optional.of("http://localhost"); private Optional rpcHttpPort = Optional.of(8545); @@ -59,11 +59,11 @@ public class BesuConfigurationImpl implements BesuConfiguration { /** * Set the mining parameters * - * @param miningParameters configured mining parameters + * @param miningConfiguration configured mining parameters * @return BesuConfigurationImpl instance */ - public BesuConfigurationImpl withMiningParameters(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public BesuConfigurationImpl withMiningParameters(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; return this; } @@ -106,7 +106,7 @@ public class BesuConfigurationImpl implements BesuConfiguration { @Override public Wei getMinGasPrice() { - return miningParameters.getMinTransactionGasPrice(); + return miningConfiguration.getMinTransactionGasPrice(); } @Override diff --git a/besu/src/test/java/org/hyperledger/besu/FlexGroupPrivacyTest.java b/besu/src/test/java/org/hyperledger/besu/FlexGroupPrivacyTest.java index a246d18d2f..ff205e8751 100644 --- a/besu/src/test/java/org/hyperledger/besu/FlexGroupPrivacyTest.java +++ b/besu/src/test/java/org/hyperledger/besu/FlexGroupPrivacyTest.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.GasLimitCalculator; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; @@ -150,7 +150,7 @@ class FlexGroupPrivacyTest { .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .storageProvider(new InMemoryKeyValueStorageProvider()) .networkId(BigInteger.ONE) - .miningParameters(MiningParameters.newDefault()) + .miningParameters(MiningConfiguration.newDefault()) .dataStorageConfiguration(dataStorageConfiguration) .nodeKey(NodeKeyUtils.generate()) .metricsSystem(new NoOpMetricsSystem()) diff --git a/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java b/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java index 5a58091577..87bab916f2 100644 --- a/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java +++ b/besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.chain.GenesisState; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.forkid.ForkId; import org.hyperledger.besu.ethereum.forkid.ForkIdManager; import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule; @@ -174,7 +174,7 @@ public class ForkIdsNetworkConfigTest { (DefaultProtocolSchedule) MainnetProtocolSchedule.fromConfig( configOptions, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem())); @@ -184,7 +184,7 @@ public class ForkIdsNetworkConfigTest { MergeProtocolSchedule.create( configOptions, false, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem())); diff --git a/besu/src/test/java/org/hyperledger/besu/PrivacyReorgTest.java b/besu/src/test/java/org/hyperledger/besu/PrivacyReorgTest.java index 6298b70a95..a79b664458 100644 --- a/besu/src/test/java/org/hyperledger/besu/PrivacyReorgTest.java +++ b/besu/src/test/java/org/hyperledger/besu/PrivacyReorgTest.java @@ -47,7 +47,7 @@ import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; import org.hyperledger.besu.ethereum.core.InMemoryPrivacyStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; @@ -547,7 +547,7 @@ public class PrivacyReorgTest { .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .storageProvider(new InMemoryKeyValueStorageProvider()) .networkId(BigInteger.ONE) - .miningParameters(MiningParameters.newDefault()) + .miningParameters(MiningConfiguration.newDefault()) .nodeKey(NodeKeyUtils.generate()) .metricsSystem(new NoOpMetricsSystem()) .dataDirectory(dataDir) diff --git a/besu/src/test/java/org/hyperledger/besu/PrivacyTest.java b/besu/src/test/java/org/hyperledger/besu/PrivacyTest.java index 4d488ced3b..305d786b8b 100644 --- a/besu/src/test/java/org/hyperledger/besu/PrivacyTest.java +++ b/besu/src/test/java/org/hyperledger/besu/PrivacyTest.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.GasLimitCalculator; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; @@ -125,7 +125,7 @@ class PrivacyTest { .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .storageProvider(new InMemoryKeyValueStorageProvider()) .networkId(BigInteger.ONE) - .miningParameters(MiningParameters.newDefault()) + .miningParameters(MiningConfiguration.newDefault()) .dataStorageConfiguration(dataStorageConfiguration) .nodeKey(NodeKeyUtils.generate()) .metricsSystem(new NoOpMetricsSystem()) diff --git a/besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java index 7c5579d471..230de6efd2 100644 --- a/besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java @@ -49,7 +49,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.manager.EthContext; @@ -128,7 +128,7 @@ public final class RunnerBuilderTest { when(besuController.getProtocolContext()).thenReturn(protocolContext); when(besuController.getProtocolSchedule()).thenReturn(protocolSchedule); when(besuController.getNodeKey()).thenReturn(nodeKey); - when(besuController.getMiningParameters()).thenReturn(mock(MiningParameters.class)); + when(besuController.getMiningParameters()).thenReturn(mock(MiningConfiguration.class)); when(besuController.getPrivacyParameters()).thenReturn(mock(PrivacyParameters.class)); when(besuController.getTransactionPool()) .thenReturn(mock(TransactionPool.class, RETURNS_DEEP_STUBS)); diff --git a/besu/src/test/java/org/hyperledger/besu/RunnerTest.java b/besu/src/test/java/org/hyperledger/besu/RunnerTest.java index 6324fabb74..4239cbdc34 100644 --- a/besu/src/test/java/org/hyperledger/besu/RunnerTest.java +++ b/besu/src/test/java/org/hyperledger/besu/RunnerTest.java @@ -46,7 +46,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockImporter; import org.hyperledger.besu.ethereum.core.BlockSyncTestUtils; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; @@ -196,7 +196,7 @@ public final class RunnerTest { .isPeerTaskSystemEnabled(isPeerTaskSystemEnabled) .build(); final ObservableMetricsSystem noOpMetricsSystem = new NoOpMetricsSystem(); - final var miningParameters = MiningParameters.newDefault(); + final var miningParameters = MiningConfiguration.newDefault(); final var dataStorageConfiguration = DataStorageConfiguration.DEFAULT_FOREST_CONFIG; // Setup Runner with blocks final BesuController controllerAhead = @@ -415,11 +415,11 @@ public final class RunnerTest { final Path dataDir, final Path dbDir, final DataStorageConfiguration dataStorageConfiguration, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { final var besuConfiguration = new BesuConfigurationImpl(); besuConfiguration .init(dataDir, dbDir, dataStorageConfiguration) - .withMiningParameters(miningParameters); + .withMiningParameters(miningConfiguration); return new KeyValueStorageProviderBuilder() .withStorageFactory( new RocksDBKeyValueStorageFactory( @@ -488,14 +488,14 @@ public final class RunnerTest { final NodeKey nodeKey, final StorageProvider storageProvider, final ObservableMetricsSystem metricsSystem, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { return new MainnetBesuControllerBuilder() .genesisConfigFile(genesisConfig) .synchronizerConfiguration(syncConfig) .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .dataDirectory(dataDir) .networkId(NETWORK_ID) - .miningParameters(miningParameters) + .miningParameters(miningConfiguration) .nodeKey(nodeKey) .storageProvider(storageProvider) .metricsSystem(metricsSystem) diff --git a/besu/src/test/java/org/hyperledger/besu/chainexport/RlpBlockExporterTest.java b/besu/src/test/java/org/hyperledger/besu/chainexport/RlpBlockExporterTest.java index bbc7dea1ab..e76c06fe2d 100644 --- a/besu/src/test/java/org/hyperledger/besu/chainexport/RlpBlockExporterTest.java +++ b/besu/src/test/java/org/hyperledger/besu/chainexport/RlpBlockExporterTest.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; @@ -94,7 +94,7 @@ public final class RlpBlockExporterTest { .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .storageProvider(new InMemoryKeyValueStorageProvider()) .networkId(BigInteger.ONE) - .miningParameters(MiningParameters.newDefault()) + .miningParameters(MiningConfiguration.newDefault()) .nodeKey(NodeKeyUtils.generate()) .metricsSystem(new NoOpMetricsSystem()) .privacyParameters(PrivacyParameters.DEFAULT) diff --git a/besu/src/test/java/org/hyperledger/besu/chainimport/JsonBlockImporterTest.java b/besu/src/test/java/org/hyperledger/besu/chainimport/JsonBlockImporterTest.java index bc52cb60be..2b534660ed 100644 --- a/besu/src/test/java/org/hyperledger/besu/chainimport/JsonBlockImporterTest.java +++ b/besu/src/test/java/org/hyperledger/besu/chainimport/JsonBlockImporterTest.java @@ -32,8 +32,8 @@ import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Transaction; @@ -458,7 +458,7 @@ public abstract class JsonBlockImporterTest { .storageProvider(new InMemoryKeyValueStorageProvider()) .networkId(BigInteger.valueOf(10)) .miningParameters( - ImmutableMiningParameters.builder() + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .isMiningEnabled(true) diff --git a/besu/src/test/java/org/hyperledger/besu/chainimport/RlpBlockImporterTest.java b/besu/src/test/java/org/hyperledger/besu/chainimport/RlpBlockImporterTest.java index 2d9e587c3f..9f405d4cb3 100644 --- a/besu/src/test/java/org/hyperledger/besu/chainimport/RlpBlockImporterTest.java +++ b/besu/src/test/java/org/hyperledger/besu/chainimport/RlpBlockImporterTest.java @@ -26,7 +26,7 @@ import org.hyperledger.besu.controller.BesuController; import org.hyperledger.besu.cryptoservices.NodeKeyUtils; import org.hyperledger.besu.ethereum.GasLimitCalculator; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; @@ -69,7 +69,7 @@ public final class RlpBlockImporterTest { .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .storageProvider(new InMemoryKeyValueStorageProvider()) .networkId(BigInteger.ONE) - .miningParameters(MiningParameters.newDefault()) + .miningParameters(MiningConfiguration.newDefault()) .nodeKey(NodeKeyUtils.generate()) .metricsSystem(new NoOpMetricsSystem()) .privacyParameters(PrivacyParameters.DEFAULT) @@ -103,7 +103,7 @@ public final class RlpBlockImporterTest { .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .storageProvider(new InMemoryKeyValueStorageProvider()) .networkId(BigInteger.ONE) - .miningParameters(MiningParameters.newDefault()) + .miningParameters(MiningConfiguration.newDefault()) .nodeKey(NodeKeyUtils.generate()) .metricsSystem(new NoOpMetricsSystem()) .privacyParameters(PrivacyParameters.DEFAULT) @@ -134,7 +134,7 @@ public final class RlpBlockImporterTest { .ethProtocolConfiguration(EthProtocolConfiguration.defaultConfig()) .storageProvider(new InMemoryKeyValueStorageProvider()) .networkId(BigInteger.ONE) - .miningParameters(MiningParameters.newDefault()) + .miningParameters(MiningConfiguration.newDefault()) .nodeKey(NodeKeyUtils.generate()) .metricsSystem(new NoOpMetricsSystem()) .privacyParameters(PrivacyParameters.DEFAULT) diff --git a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java index cf3c40860d..ea06f406ed 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java @@ -57,7 +57,7 @@ import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.handlers.TimeoutOptions; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl; @@ -277,8 +277,8 @@ public class BesuCommandTest extends CommandTestAbstract { verify(mockRunnerBuilder).build(); verify(mockControllerBuilderFactory).fromEthNetworkConfig(ethNetworkArg.capture(), any()); - final ArgumentCaptor miningArg = - ArgumentCaptor.forClass(MiningParameters.class); + final ArgumentCaptor miningArg = + ArgumentCaptor.forClass(MiningConfiguration.class); verify(mockControllerBuilder).synchronizerConfiguration(syncConfigurationCaptor.capture()); verify(mockControllerBuilder).dataDirectory(isNotNull()); verify(mockControllerBuilder).miningParameters(miningArg.capture()); diff --git a/besu/src/test/java/org/hyperledger/besu/cli/CascadingDefaultProviderTest.java b/besu/src/test/java/org/hyperledger/besu/cli/CascadingDefaultProviderTest.java index 4cdd8163d9..c142838814 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/CascadingDefaultProviderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/CascadingDefaultProviderTest.java @@ -33,7 +33,7 @@ import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.ethereum.api.graphql.GraphQLConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.sync.SyncMode; import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration; import org.hyperledger.besu.ethereum.p2p.peers.EnodeURLImpl; @@ -200,7 +200,7 @@ public class CascadingDefaultProviderTest extends CommandTestAbstract { setEnvironmentVariable("BESU_MINER_COINBASE", expectedCoinbase); parseCommand("--config-file", configFile); - final var captMiningParameters = ArgumentCaptor.forClass(MiningParameters.class); + final var captMiningParameters = ArgumentCaptor.forClass(MiningConfiguration.class); verify(mockControllerBuilder).miningParameters(captMiningParameters.capture()); assertThat(captMiningParameters.getValue().getCoinbase()) @@ -219,7 +219,7 @@ public class CascadingDefaultProviderTest extends CommandTestAbstract { setEnvironmentVariable("BESU_MINER_COINBASE", "0x0000000000000000000000000000000000000004"); parseCommand("--config-file", configFile, "--miner-coinbase", expectedCoinbase); - final var captMiningParameters = ArgumentCaptor.forClass(MiningParameters.class); + final var captMiningParameters = ArgumentCaptor.forClass(MiningConfiguration.class); verify(mockControllerBuilder).miningParameters(captMiningParameters.capture()); assertThat(captMiningParameters.getValue().getCoinbase()) diff --git a/besu/src/test/java/org/hyperledger/besu/cli/options/MiningOptionsTest.java b/besu/src/test/java/org/hyperledger/besu/cli/options/MiningOptionsTest.java index e32ff0e463..f94504ea47 100644 --- a/besu/src/test/java/org/hyperledger/besu/cli/options/MiningOptionsTest.java +++ b/besu/src/test/java/org/hyperledger/besu/cli/options/MiningOptionsTest.java @@ -15,19 +15,19 @@ package org.hyperledger.besu.cli.options; import static org.assertj.core.api.Assertions.assertThat; -import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME; -import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_POS_BLOCK_CREATION_MAX_TIME; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_POS_BLOCK_CREATION_MAX_TIME; import static org.mockito.Mockito.atMost; import static org.mockito.Mockito.verify; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.GasLimitCalculator; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.Unstable; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.Unstable; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.util.number.PositiveNumber; import java.io.IOException; @@ -42,7 +42,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.junit.jupiter.MockitoExtension; @ExtendWith(MockitoExtension.class) -public class MiningOptionsTest extends AbstractCLIOptionsTest { +public class MiningOptionsTest extends AbstractCLIOptionsTest { @Test public void besuDoesNotStartInMiningModeIfCoinbaseNotSet() { @@ -390,13 +390,13 @@ public class MiningOptionsTest extends AbstractCLIOptionsTest bftBesuControllerBuilder.createAdditionalJsonRpcMethodFactory( - protocolContext, protocolSchedule, MiningParameters.newDefault())) + protocolContext, protocolSchedule, MiningConfiguration.newDefault())) .isInstanceOf(NullPointerException.class) .hasMessage("transactionValidatorProvider should have been initialised"); } diff --git a/besu/src/test/java/org/hyperledger/besu/controller/TransitionControllerBuilderTest.java b/besu/src/test/java/org/hyperledger/besu/controller/TransitionControllerBuilderTest.java index 40d72e4ed1..24b0133a0f 100644 --- a/besu/src/test/java/org/hyperledger/besu/controller/TransitionControllerBuilderTest.java +++ b/besu/src/test/java/org/hyperledger/besu/controller/TransitionControllerBuilderTest.java @@ -35,10 +35,10 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; import org.hyperledger.besu.ethereum.eth.sync.state.SyncState; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; @@ -84,7 +84,7 @@ public class TransitionControllerBuilderTest { CliqueBesuControllerBuilder cliqueBuilder = new CliqueBesuControllerBuilder(); BesuControllerBuilder powBuilder = new MainnetBesuControllerBuilder(); MergeBesuControllerBuilder postMergeBuilder = new MergeBesuControllerBuilder(); - MiningParameters miningParameters; + MiningConfiguration miningConfiguration; TransitionProtocolSchedule transitionProtocolSchedule; @@ -118,27 +118,27 @@ public class TransitionControllerBuilderTest { .thenReturn(mergeContext); when(ethProtocolManager.ethContext().getScheduler()) .thenReturn(new DeterministicEthScheduler()); - miningParameters = MiningParameters.newDefault(); + miningConfiguration = MiningConfiguration.newDefault(); } @Test public void assertCliqueMiningOverridePreMerge() { - assertThat(miningParameters.isMiningEnabled()).isFalse(); + assertThat(miningConfiguration.isMiningEnabled()).isFalse(); var transCoordinator = buildTransitionCoordinator(cliqueBuilder, postMergeBuilder); assertThat(transCoordinator.isMiningBeforeMerge()).isTrue(); } @Test public void assertPoWIsNotMiningPreMerge() { - assertThat(miningParameters.isMiningEnabled()).isFalse(); + assertThat(miningConfiguration.isMiningEnabled()).isFalse(); var transCoordinator = buildTransitionCoordinator(powBuilder, postMergeBuilder); assertThat(transCoordinator.isMiningBeforeMerge()).isFalse(); } @Test public void assertPowMiningPreMerge() { - miningParameters = - ImmutableMiningParameters.builder() + miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues(MutableInitValues.builder().isMiningEnabled(true).build()) .build(); var transCoordinator = buildTransitionCoordinator(powBuilder, postMergeBuilder); @@ -273,7 +273,7 @@ public class TransitionControllerBuilderTest { transitionProtocolSchedule, protocolContext, transactionPool, - miningParameters, + miningConfiguration, syncState, ethProtocolManager); diff --git a/besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java b/besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java index ddf68ba14b..79885115f4 100644 --- a/besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java +++ b/besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.core.TransactionTestFixture; @@ -173,7 +173,7 @@ public class BesuEventsImplTest { syncState, txPoolConfig, new BlobCache(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); serviceImpl = new BesuEventsImpl( diff --git a/besu/src/test/java/org/hyperledger/besu/services/TraceServiceImplTest.java b/besu/src/test/java/org/hyperledger/besu/services/TraceServiceImplTest.java index 1e734f6231..bcbf1c2fe7 100644 --- a/besu/src/test/java/org/hyperledger/besu/services/TraceServiceImplTest.java +++ b/besu/src/test/java/org/hyperledger/besu/services/TraceServiceImplTest.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; import org.hyperledger.besu.evm.log.Log; import org.hyperledger.besu.evm.worldstate.WorldView; @@ -80,7 +80,7 @@ class TraceServiceImplTest { blockchainSetupUtil.getProtocolSchedule(), blockchain, worldStateArchive, - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); traceService = new TraceServiceImpl(blockchainQueries, blockchainSetupUtil.getProtocolSchedule()); } diff --git a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java index 551a8c3f44..2ceedb7189 100644 --- a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java +++ b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java @@ -22,7 +22,7 @@ import org.hyperledger.besu.cryptoservices.NodeKey; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; @@ -63,7 +63,7 @@ public class CliqueProtocolSchedule { * @param privacyParameters the privacy parameters * @param isRevertReasonEnabled the is revert reason enabled * @param evmConfiguration the evm configuration - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled * @param metricsSystem A metricSystem instance to be able to expose metrics in the underlying @@ -77,7 +77,7 @@ public class CliqueProtocolSchedule { final PrivacyParameters privacyParameters, final boolean isRevertReasonEnabled, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -115,7 +115,7 @@ public class CliqueProtocolSchedule { privacyParameters, isRevertReasonEnabled, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem) @@ -130,7 +130,7 @@ public class CliqueProtocolSchedule { * @param nodeKey the node key * @param isRevertReasonEnabled the is revert reason enabled * @param evmConfiguration the evm configuration - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled * @param metricsSystem A metricSystem instance to be able to expose metrics in the underlying @@ -144,7 +144,7 @@ public class CliqueProtocolSchedule { final NodeKey nodeKey, final boolean isRevertReasonEnabled, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -155,7 +155,7 @@ public class CliqueProtocolSchedule { PrivacyParameters.DEFAULT, isRevertReasonEnabled, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreator.java b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreator.java index ed17529a9f..18d3449ba8 100644 --- a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreator.java +++ b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreator.java @@ -29,7 +29,7 @@ import org.hyperledger.besu.ethereum.blockcreation.AbstractBlockCreator; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.SealableBlockHeader; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; @@ -48,7 +48,7 @@ public class CliqueBlockCreator extends AbstractBlockCreator { /** * Instantiates a new Clique block creator. * - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param extraDataCalculator the extra data calculator * @param transactionPool the pending transactions * @param protocolContext the protocol context @@ -58,7 +58,7 @@ public class CliqueBlockCreator extends AbstractBlockCreator { * @param ethScheduler the scheduler for asynchronous block creation tasks */ public CliqueBlockCreator( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final ExtraDataCalculator extraDataCalculator, final TransactionPool transactionPool, final ProtocolContext protocolContext, @@ -67,7 +67,7 @@ public class CliqueBlockCreator extends AbstractBlockCreator { final EpochManager epochManager, final EthScheduler ethScheduler) { super( - miningParameters, + miningConfiguration, __ -> Util.publicKeyToAddress(nodeKey.getPublicKey()), extraDataCalculator, transactionPool, diff --git a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutor.java b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutor.java index ef3d58fbff..998a237e91 100644 --- a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutor.java +++ b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutor.java @@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.blockcreation.AbstractMinerExecutor; import org.hyperledger.besu.ethereum.chain.MinedBlockObserver; import org.hyperledger.besu.ethereum.chain.PoWObserver; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; @@ -70,7 +70,7 @@ public class CliqueMinerExecutor extends AbstractMinerExecutor final ProtocolSchedule protocolSchedule, final TransactionPool transactionPool, final NodeKey nodeKey, - final MiningParameters miningParams, + final MiningConfiguration miningParams, final AbstractBlockScheduler blockScheduler, final EpochManager epochManager, final ForksSchedule forksSchedule, @@ -97,7 +97,7 @@ public class CliqueMinerExecutor extends AbstractMinerExecutor final Function blockCreator = (header) -> new CliqueBlockCreator( - miningParameters, + miningConfiguration, this::calculateExtraData, transactionPool, protocolContext, @@ -119,7 +119,7 @@ public class CliqueMinerExecutor extends AbstractMinerExecutor @Override public Optional
getCoinbase() { - return miningParameters.getCoinbase(); + return miningConfiguration.getCoinbase(); } /** @@ -134,7 +134,7 @@ public class CliqueMinerExecutor extends AbstractMinerExecutor final Bytes vanityDataToInsert = ConsensusHelpers.zeroLeftPad( - miningParameters.getExtraData(), CliqueExtraData.EXTRA_VANITY_LENGTH); + miningConfiguration.getExtraData(), CliqueExtraData.EXTRA_VANITY_LENGTH); // Building ON TOP of canonical head, if the next block is epoch, include validators. if (epochManager.isEpochBlock(parentHeader.getNumber() + 1)) { diff --git a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/jsonrpc/CliqueJsonRpcMethods.java b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/jsonrpc/CliqueJsonRpcMethods.java index 762cce1c56..4e1e75f54c 100644 --- a/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/jsonrpc/CliqueJsonRpcMethods.java +++ b/consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/jsonrpc/CliqueJsonRpcMethods.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.methods.ApiGroupJsonRpcMethods; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive; @@ -41,22 +41,22 @@ import java.util.Map; public class CliqueJsonRpcMethods extends ApiGroupJsonRpcMethods { private final ProtocolContext context; private final ProtocolSchedule protocolSchedule; - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; /** * Instantiates a new Clique json rpc methods. * * @param context the protocol context * @param protocolSchedule the protocol schedule - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters */ public CliqueJsonRpcMethods( final ProtocolContext context, final ProtocolSchedule protocolSchedule, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { this.context = context; this.protocolSchedule = protocolSchedule; - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; } @Override @@ -69,7 +69,7 @@ public class CliqueJsonRpcMethods extends ApiGroupJsonRpcMethods { final MutableBlockchain blockchain = context.getBlockchain(); final WorldStateArchive worldStateArchive = context.getWorldStateArchive(); final BlockchainQueries blockchainQueries = - new BlockchainQueries(protocolSchedule, blockchain, worldStateArchive, miningParameters); + new BlockchainQueries(protocolSchedule, blockchain, worldStateArchive, miningConfiguration); final ValidatorProvider validatorProvider = context.getConsensusContext(CliqueContext.class).getValidatorProvider(); diff --git a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java index 5cbdbb6d06..083604af6f 100644 --- a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java +++ b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java @@ -32,7 +32,7 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; @@ -68,7 +68,7 @@ public class CliqueProtocolScheduleTest { NODE_KEY, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -94,7 +94,7 @@ public class CliqueProtocolScheduleTest { NODE_KEY, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) @@ -120,7 +120,7 @@ public class CliqueProtocolScheduleTest { NODE_KEY, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem())) @@ -142,7 +142,7 @@ public class CliqueProtocolScheduleTest { NODE_KEY, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem())) @@ -168,7 +168,7 @@ public class CliqueProtocolScheduleTest { NODE_KEY, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java index ca76517c62..fdc068ddef 100644 --- a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java +++ b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java @@ -49,9 +49,9 @@ import org.hyperledger.besu.ethereum.core.AddressHelpers; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; @@ -106,7 +106,7 @@ public class CliqueBlockCreatorTest { proposerNodeKey, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -146,11 +146,11 @@ public class CliqueBlockCreatorTest { final Address coinbase = AddressHelpers.ofValue(1); - final MiningParameters miningParameters = createMiningParameters(extraData, coinbase); + final MiningConfiguration miningConfiguration = createMiningParameters(extraData, coinbase); final CliqueBlockCreator blockCreator = new CliqueBlockCreator( - miningParameters, + miningConfiguration, parent -> extraData, createTransactionPool(), protocolContext, @@ -175,11 +175,11 @@ public class CliqueBlockCreatorTest { when(voteProvider.getVoteAfterBlock(any(), any())) .thenReturn(Optional.of(new ValidatorVote(VoteType.ADD, coinbase, a1))); - final MiningParameters miningParameters = createMiningParameters(extraData, coinbase); + final MiningConfiguration miningConfiguration = createMiningParameters(extraData, coinbase); final CliqueBlockCreator blockCreator = new CliqueBlockCreator( - miningParameters, + miningConfiguration, parent -> extraData, createTransactionPool(), protocolContext, @@ -209,11 +209,11 @@ public class CliqueBlockCreatorTest { when(mockVoteProvider.getVoteAfterBlock(any(), any())) .thenReturn(Optional.of(new ValidatorVote(VoteType.ADD, coinbase, a1))); - final MiningParameters miningParameters = createMiningParameters(extraData, coinbase); + final MiningConfiguration miningConfiguration = createMiningParameters(extraData, coinbase); final CliqueBlockCreator blockCreator = new CliqueBlockCreator( - miningParameters, + miningConfiguration, parent -> extraData, createTransactionPool(), protocolContext, @@ -252,10 +252,10 @@ public class CliqueBlockCreatorTest { return transactionPool; } - private static MiningParameters createMiningParameters( + private static MiningConfiguration createMiningParameters( final Bytes extraData, final Address coinbase) { - final MiningParameters miningParameters = - ImmutableMiningParameters.builder() + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .extraData(extraData) @@ -264,6 +264,6 @@ public class CliqueBlockCreatorTest { .coinbase(coinbase) .build()) .build(); - return miningParameters; + return miningConfiguration; } } diff --git a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java index 1aa2d75ef3..3d6dbd77db 100644 --- a/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java +++ b/consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java @@ -39,9 +39,9 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.AddressHelpers; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; @@ -105,7 +105,7 @@ public class CliqueMinerExecutorTest { proposerNodeKey, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -117,7 +117,7 @@ public class CliqueMinerExecutorTest { public void extraDataCreatedOnEpochBlocksContainsValidators() { final Bytes vanityData = generateRandomVanityData(); - final MiningParameters miningParameters = createMiningParameters(vanityData); + final MiningConfiguration miningConfiguration = createMiningParameters(vanityData); final CliqueMinerExecutor executor = new CliqueMinerExecutor( @@ -125,7 +125,7 @@ public class CliqueMinerExecutorTest { cliqueProtocolSchedule, createTransactionPool(), proposerNodeKey, - miningParameters, + miningConfiguration, mock(CliqueBlockScheduler.class), new EpochManager(EPOCH_LENGTH), null, @@ -153,7 +153,7 @@ public class CliqueMinerExecutorTest { public void extraDataForNonEpochBlocksDoesNotContainValidaors() { final Bytes vanityData = generateRandomVanityData(); - final MiningParameters miningParameters = createMiningParameters(vanityData); + final MiningConfiguration miningConfiguration = createMiningParameters(vanityData); final CliqueMinerExecutor executor = new CliqueMinerExecutor( @@ -161,7 +161,7 @@ public class CliqueMinerExecutorTest { cliqueProtocolSchedule, createTransactionPool(), proposerNodeKey, - miningParameters, + miningConfiguration, mock(CliqueBlockScheduler.class), new EpochManager(EPOCH_LENGTH), null, @@ -189,7 +189,7 @@ public class CliqueMinerExecutorTest { final Bytes initialVanityData = generateRandomVanityData(); final Bytes modifiedVanityData = generateRandomVanityData(); - final MiningParameters miningParameters = createMiningParameters(initialVanityData); + final MiningConfiguration miningConfiguration = createMiningParameters(initialVanityData); final CliqueMinerExecutor executor = new CliqueMinerExecutor( @@ -197,13 +197,13 @@ public class CliqueMinerExecutorTest { cliqueProtocolSchedule, createTransactionPool(), proposerNodeKey, - miningParameters, + miningConfiguration, mock(CliqueBlockScheduler.class), new EpochManager(EPOCH_LENGTH), null, ethScheduler); - miningParameters.setExtraData(modifiedVanityData); + miningConfiguration.setExtraData(modifiedVanityData); final Bytes extraDataBytes = executor.calculateExtraData(blockHeaderBuilder.buildHeader()); final CliqueExtraData cliqueExtraData = @@ -253,8 +253,8 @@ public class CliqueMinerExecutorTest { return Bytes.wrap(vanityData); } - private static MiningParameters createMiningParameters(final Bytes vanityData) { - return ImmutableMiningParameters.builder() + private static MiningConfiguration createMiningParameters(final Bytes vanityData) { + return ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .extraData(vanityData) diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java index 0df63452b3..29ec30d667 100644 --- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java +++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.consensus.common.ForksSchedule; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule; @@ -58,7 +58,7 @@ public abstract class BaseBftProtocolScheduleBuilder { * @param isRevertReasonEnabled the is revert reason enabled * @param bftExtraDataCodec the bft extra data codec * @param evmConfiguration the evm configuration - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @param metricsSystem metricsSystem A metricSystem instance to be able to expose metrics in the @@ -72,7 +72,7 @@ public abstract class BaseBftProtocolScheduleBuilder { final boolean isRevertReasonEnabled, final BftExtraDataCodec bftExtraDataCodec, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -96,7 +96,7 @@ public abstract class BaseBftProtocolScheduleBuilder { privacyParameters, isRevertReasonEnabled, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem) diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreator.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreator.java index 6bc0254b69..70d18fc3c9 100644 --- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreator.java +++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreator.java @@ -25,7 +25,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.blockcreation.AbstractBlockCreator; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.SealableBlockHeader; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; @@ -46,7 +46,7 @@ public class BftBlockCreator extends AbstractBlockCreator { /** * Instantiates a new Bft block creator. * - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param forksSchedule the forks schedule * @param localAddress the local address * @param extraDataCalculator the extra data calculator @@ -57,7 +57,7 @@ public class BftBlockCreator extends AbstractBlockCreator { * @param ethScheduler the scheduler for asynchronous block creation tasks */ public BftBlockCreator( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final ForksSchedule forksSchedule, final Address localAddress, final ExtraDataCalculator extraDataCalculator, @@ -67,7 +67,7 @@ public class BftBlockCreator extends AbstractBlockCreator { final BftExtraDataCodec bftExtraDataCodec, final EthScheduler ethScheduler) { super( - miningParameters.setCoinbase(localAddress), + miningConfiguration.setCoinbase(localAddress), miningBeneficiaryCalculator(localAddress, forksSchedule), extraDataCalculator, transactionPool, diff --git a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreatorFactory.java b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreatorFactory.java index 7c679763b6..1349bbf461 100644 --- a/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreatorFactory.java +++ b/consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreatorFactory.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.blockcreation.BlockCreator; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; import org.hyperledger.besu.ethereum.mainnet.AbstractGasLimitSpecification; @@ -54,7 +54,7 @@ public class BftBlockCreatorFactory { protected final ForksSchedule forksSchedule; /** The Mining parameters */ - protected final MiningParameters miningParameters; + protected final MiningConfiguration miningConfiguration; private final TransactionPool transactionPool; @@ -89,7 +89,7 @@ public class BftBlockCreatorFactory { final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, final ForksSchedule forksSchedule, - final MiningParameters miningParams, + final MiningConfiguration miningParams, final Address localAddress, final BftExtraDataCodec bftExtraDataCodec, final EthScheduler ethScheduler) { @@ -98,7 +98,7 @@ public class BftBlockCreatorFactory { this.protocolSchedule = protocolSchedule; this.forksSchedule = forksSchedule; this.localAddress = localAddress; - this.miningParameters = miningParams; + this.miningConfiguration = miningParams; this.bftExtraDataCodec = bftExtraDataCodec; this.ethScheduler = ethScheduler; } @@ -111,7 +111,7 @@ public class BftBlockCreatorFactory { */ public BlockCreator create(final int round) { return new BftBlockCreator( - miningParameters, + miningConfiguration, forksSchedule, localAddress, ph -> createExtraData(round, ph), @@ -128,7 +128,7 @@ public class BftBlockCreatorFactory { * @param minTransactionGasPrice the min transaction gas price */ public void setMinTransactionGasPrice(final Wei minTransactionGasPrice) { - miningParameters.setMinTransactionGasPrice(minTransactionGasPrice); + miningConfiguration.setMinTransactionGasPrice(minTransactionGasPrice); } /** @@ -137,7 +137,7 @@ public class BftBlockCreatorFactory { * @return the min transaction gas price */ public Wei getMinTransactionGasPrice() { - return miningParameters.getMinTransactionGasPrice(); + return miningConfiguration.getMinTransactionGasPrice(); } /** @@ -146,7 +146,7 @@ public class BftBlockCreatorFactory { * @return min priority fee per gas */ public Wei getMinPriorityFeePerGas() { - return miningParameters.getMinPriorityFeePerGas(); + return miningConfiguration.getMinPriorityFeePerGas(); } /** @@ -171,7 +171,7 @@ public class BftBlockCreatorFactory { final BftExtraData extraData = new BftExtraData( ConsensusHelpers.zeroLeftPad( - miningParameters.getExtraData(), BftExtraDataCodec.EXTRA_VANITY_LENGTH), + miningConfiguration.getExtraData(), BftExtraDataCodec.EXTRA_VANITY_LENGTH), Collections.emptyList(), toVote(proposal), round, @@ -187,7 +187,7 @@ public class BftBlockCreatorFactory { */ public void changeTargetGasLimit(final Long newTargetGasLimit) { if (AbstractGasLimitSpecification.isValidTargetGasLimit(newTargetGasLimit)) { - miningParameters.setTargetGasLimit(newTargetGasLimit); + miningConfiguration.setTargetGasLimit(newTargetGasLimit); } else { throw new UnsupportedOperationException("Specified target gas limit is invalid"); } diff --git a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java index 659337bdd2..02da30f507 100644 --- a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java +++ b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java @@ -21,7 +21,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.consensus.common.bft.BftProtocolSchedule; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -177,7 +177,7 @@ public class CombinedProtocolScheduleFactoryTest { new PrivacyParameters(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java index e23664fd8d..56a0e33986 100644 --- a/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java +++ b/consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule; @@ -245,7 +245,7 @@ public class BaseBftProtocolScheduleBuilderTest { false, bftExtraDataCodec, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java b/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java index 8896733548..a5d24ff4db 100644 --- a/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java +++ b/consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java @@ -78,9 +78,9 @@ import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; @@ -310,8 +310,8 @@ public class TestContextBuilder { final WorldStateArchive worldStateArchive = createInMemoryWorldStateArchive(); - final MiningParameters miningParams = - ImmutableMiningParameters.builder() + final MiningConfiguration miningParams = + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .isMiningEnabled(true) @@ -334,7 +334,7 @@ public class TestContextBuilder { forksSchedule, IBFT_EXTRA_DATA_ENCODER, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java index 3adf571895..adc4698e4d 100644 --- a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java +++ b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java @@ -21,7 +21,7 @@ import org.hyperledger.besu.consensus.common.bft.BaseBftProtocolScheduleBuilder; import org.hyperledger.besu.consensus.common.bft.BftExtraDataCodec; import org.hyperledger.besu.consensus.common.bft.BftProtocolSchedule; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; import org.hyperledger.besu.ethereum.mainnet.feemarket.BaseFeeMarket; @@ -46,7 +46,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder * @param isRevertReasonEnabled the is revert reason enabled * @param bftExtraDataCodec the bft extra data codec * @param evmConfiguration the evm configuration - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled * @param metricsSystem A metricSystem instance to be able to expose metrics in the underlying @@ -60,7 +60,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder final boolean isRevertReasonEnabled, final BftExtraDataCodec bftExtraDataCodec, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -72,7 +72,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder isRevertReasonEnabled, bftExtraDataCodec, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -85,7 +85,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder * @param forksSchedule the forks schedule * @param bftExtraDataCodec the bft extra data codec * @param evmConfiguration the evm configuration - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @param metricsSystem A metricSystem instance to be able to expose metrics in the underlying @@ -97,7 +97,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder final ForksSchedule forksSchedule, final BftExtraDataCodec bftExtraDataCodec, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -108,7 +108,7 @@ public class IbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder false, bftExtraDataCodec, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/IbftJsonRpcMethods.java b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/IbftJsonRpcMethods.java index 1afe067867..a777d7d175 100644 --- a/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/IbftJsonRpcMethods.java +++ b/consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/IbftJsonRpcMethods.java @@ -32,7 +32,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.methods.ApiGroupJsonRpcMethods; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import java.util.Map; @@ -42,22 +42,22 @@ public class IbftJsonRpcMethods extends ApiGroupJsonRpcMethods { private final ProtocolContext context; private final ProtocolSchedule protocolSchedule; - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; /** * Instantiates a new Ibft json rpc methods. * * @param context the protocol context * @param protocolSchedule the protocol schedule - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters */ public IbftJsonRpcMethods( final ProtocolContext context, final ProtocolSchedule protocolSchedule, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { this.context = context; this.protocolSchedule = protocolSchedule; - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; } @Override @@ -70,7 +70,7 @@ public class IbftJsonRpcMethods extends ApiGroupJsonRpcMethods { final MutableBlockchain blockchain = context.getBlockchain(); final BlockchainQueries blockchainQueries = new BlockchainQueries( - protocolSchedule, blockchain, context.getWorldStateArchive(), miningParameters); + protocolSchedule, blockchain, context.getWorldStateArchive(), miningConfiguration); final BftContext bftContext = context.getConsensusContext(BftContext.class); final BlockInterface blockInterface = bftContext.getBlockInterface(); final ValidatorProvider validatorProvider = diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java index a5510ea80a..9cb760551e 100644 --- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java +++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java @@ -39,7 +39,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.core.components.EthereumCoreComponent; @@ -127,7 +127,7 @@ public class IbftProtocolScheduleTest { false, bftExtraDataCodec, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -191,8 +191,8 @@ public class IbftProtocolScheduleTest { @Module static class NoMiningParamters { @Provides - MiningParameters provideMiningParameters() { - return MiningParameters.MINING_DISABLED; + MiningConfiguration provideMiningParameters() { + return MiningConfiguration.MINING_DISABLED; } } } diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java index 5469717b13..df5a313ae7 100644 --- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java +++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java @@ -42,9 +42,9 @@ import org.hyperledger.besu.ethereum.core.AddressHelpers; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; @@ -122,7 +122,7 @@ public class BftBlockCreatorTest { false, bftExtraDataEncoder, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -159,8 +159,8 @@ public class BftBlockCreatorTest { transactionPool.setEnabled(); - final MiningParameters miningParameters = - ImmutableMiningParameters.builder() + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .extraData( @@ -178,7 +178,7 @@ public class BftBlockCreatorTest { final BftBlockCreator blockCreator = new BftBlockCreator( - miningParameters, + miningConfiguration, forksSchedule, initialValidatorList.get(0), parent -> diff --git a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java index 9ca5b0b8e1..79022b7d54 100644 --- a/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java +++ b/consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java @@ -70,7 +70,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule; @@ -185,7 +185,7 @@ public class IbftBlockHeightManagerTest { new PrivacyParameters(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java index f794152a78..a8c84d5a09 100644 --- a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java +++ b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java @@ -17,7 +17,7 @@ package org.hyperledger.besu.consensus.merge; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -48,7 +48,7 @@ public class MergeProtocolSchedule { * * @param config the config * @param isRevertReasonEnabled the is revert reason enabled - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @return the protocol schedule @@ -56,7 +56,7 @@ public class MergeProtocolSchedule { public static ProtocolSchedule create( final GenesisConfigOptions config, final boolean isRevertReasonEnabled, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -64,7 +64,7 @@ public class MergeProtocolSchedule { config, PrivacyParameters.DEFAULT, isRevertReasonEnabled, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -76,7 +76,7 @@ public class MergeProtocolSchedule { * @param config the config * @param privacyParameters the privacy parameters * @param isRevertReasonEnabled the is revert reason enabled - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @return the protocol schedule @@ -85,7 +85,7 @@ public class MergeProtocolSchedule { final GenesisConfigOptions config, final PrivacyParameters privacyParameters, final boolean isRevertReasonEnabled, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -106,7 +106,7 @@ public class MergeProtocolSchedule { privacyParameters, isRevertReasonEnabled, EvmConfiguration.DEFAULT, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem) diff --git a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java index e733cc800e..44fd5f8edf 100644 --- a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java +++ b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java @@ -20,7 +20,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PermissionTransactionFilter; import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule; @@ -65,21 +65,21 @@ public class TransitionProtocolSchedule implements ProtocolSchedule { * * @param genesisConfigOptions {@link GenesisConfigOptions} containing the config options for the * milestone starting points - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @return an initialised TransitionProtocolSchedule using post-merge defaults */ public static TransitionProtocolSchedule fromConfig( final GenesisConfigOptions genesisConfigOptions, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { ProtocolSchedule preMergeProtocolSchedule = MainnetProtocolSchedule.fromConfig( genesisConfigOptions, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -87,7 +87,7 @@ public class TransitionProtocolSchedule implements ProtocolSchedule { MergeProtocolSchedule.create( genesisConfigOptions, false, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeBlockCreator.java b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeBlockCreator.java index c56c62d80d..56c78877a6 100644 --- a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeBlockCreator.java +++ b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeBlockCreator.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.ethereum.blockcreation.AbstractBlockCreator; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.SealableBlockHeader; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Withdrawal; @@ -39,7 +39,7 @@ class MergeBlockCreator extends AbstractBlockCreator { /** * Instantiates a new Merge block creator. * - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param extraDataCalculator the extra data calculator * @param transactionPool the pending transactions * @param protocolContext the protocol context @@ -47,7 +47,7 @@ class MergeBlockCreator extends AbstractBlockCreator { * @param parentHeader the parent header */ public MergeBlockCreator( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final ExtraDataCalculator extraDataCalculator, final TransactionPool transactionPool, final ProtocolContext protocolContext, @@ -55,8 +55,8 @@ class MergeBlockCreator extends AbstractBlockCreator { final BlockHeader parentHeader, final EthScheduler ethScheduler) { super( - miningParameters, - __ -> miningParameters.getCoinbase().orElseThrow(), + miningConfiguration, + __ -> miningConfiguration.getCoinbase().orElseThrow(), extraDataCalculator, transactionPool, protocolContext, diff --git a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java index 877d7fb963..7570e97d4d 100644 --- a/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java +++ b/consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java @@ -33,7 +33,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockWithReceipts; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Withdrawal; @@ -81,7 +81,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene private static final long DEFAULT_TARGET_GAS_LIMIT = 30000000L; /** The Mining parameters. */ - protected final MiningParameters miningParameters; + protected final MiningConfiguration miningConfiguration; /** The Merge block creator factory. */ protected final MergeBlockCreatorFactory mergeBlockCreatorFactory; @@ -120,7 +120,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene final ProtocolSchedule protocolSchedule, final EthScheduler ethScheduler, final TransactionPool transactionPool, - final MiningParameters miningParams, + final MiningConfiguration miningParams, final BackwardSyncContext backwardSyncContext, final Optional
depositContractAddress) { this.protocolContext = protocolContext; @@ -137,14 +137,14 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene } miningParams.setMinBlockOccupancyRatio(TRY_FILL_BLOCK); - this.miningParameters = miningParams; + this.miningConfiguration = miningParams; this.mergeBlockCreatorFactory = (parentHeader, address) -> { address.ifPresent(miningParams::setCoinbase); return new MergeBlockCreator( - miningParameters, - parent -> miningParameters.getExtraData(), + miningConfiguration, + parent -> miningConfiguration.getExtraData(), transactionPool, protocolContext, protocolSchedule, @@ -169,7 +169,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, final EthScheduler ethScheduler, - final MiningParameters miningParams, + final MiningConfiguration miningParams, final BackwardSyncContext backwardSyncContext, final MergeBlockCreatorFactory mergeBlockCreatorFactory) { @@ -182,7 +182,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene miningParams.setTargetGasLimit(DEFAULT_TARGET_GAS_LIMIT); } miningParams.setMinBlockOccupancyRatio(TRY_FILL_BLOCK); - this.miningParameters = miningParams; + this.miningConfiguration = miningParams; this.mergeBlockCreatorFactory = mergeBlockCreatorFactory; @@ -215,17 +215,17 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene @Override public Wei getMinTransactionGasPrice() { - return miningParameters.getMinTransactionGasPrice(); + return miningConfiguration.getMinTransactionGasPrice(); } @Override public Wei getMinPriorityFeePerGas() { - return miningParameters.getMinPriorityFeePerGas(); + return miningConfiguration.getMinPriorityFeePerGas(); } @Override public Optional
getCoinbase() { - return miningParameters.getCoinbase(); + return miningConfiguration.getCoinbase(); } @Override @@ -244,7 +244,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene @Override public void changeTargetGasLimit(final Long newTargetGasLimit) { if (AbstractGasLimitSpecification.isValidTargetGasLimit(newTargetGasLimit)) { - this.miningParameters.setTargetGasLimit(newTargetGasLimit); + this.miningConfiguration.setTargetGasLimit(newTargetGasLimit); } else { throw new IllegalArgumentException("Specified target gas limit is invalid"); } @@ -383,13 +383,13 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene LOG.debug( "Block creation started for payload id {}, remaining time is {}ms", payloadIdentifier, - miningParameters.getUnstable().getPosBlockCreationMaxTime()); + miningConfiguration.getUnstable().getPosBlockCreationMaxTime()); ethScheduler .scheduleBlockCreationTask( () -> retryBlockCreationUntilUseful(payloadIdentifier, blockCreator)) .orTimeout( - miningParameters.getUnstable().getPosBlockCreationMaxTime(), TimeUnit.MILLISECONDS) + miningConfiguration.getUnstable().getPosBlockCreationMaxTime(), TimeUnit.MILLISECONDS) .whenComplete( (unused, throwable) -> { if (throwable != null) { @@ -416,7 +416,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene final long waitBeforeRepetition = Math.max( 100, - miningParameters.getUnstable().getPosBlockCreationRepetitionMinDuration() + miningConfiguration.getUnstable().getPosBlockCreationRepetitionMinDuration() - lastDuration); LOG.debug("Waiting {}ms before repeating block creation", waitBeforeRepetition); Thread.sleep(waitBeforeRepetition); @@ -726,7 +726,7 @@ public class MergeCoordinator implements MergeMiningCoordinator, BadChainListene @Override public boolean isMiningBeforeMerge() { - return miningParameters.isMiningEnabled(); + return miningConfiguration.isMiningEnabled(); } private Optional findValidAncestor(final Blockchain chain, final Hash parentHash) { diff --git a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java index 0d4aede3a1..ba83f8aad9 100644 --- a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java +++ b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java @@ -22,7 +22,7 @@ import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockProcessor; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; @@ -51,7 +51,7 @@ public class MergeProtocolScheduleTest { MergeProtocolSchedule.create( config, false, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -72,7 +72,7 @@ public class MergeProtocolScheduleTest { MergeProtocolSchedule.create( config, false, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -113,7 +113,7 @@ public class MergeProtocolScheduleTest { MergeProtocolSchedule.create( config, false, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -146,7 +146,7 @@ public class MergeProtocolScheduleTest { MergeProtocolSchedule.create( config, false, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -180,7 +180,7 @@ public class MergeProtocolScheduleTest { MergeProtocolSchedule.create( GenesisConfigFile.DEFAULT.getConfigOptions(), false, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) diff --git a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java index 4efcdc1e0f..23a5ae16b1 100644 --- a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java +++ b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java @@ -55,10 +55,10 @@ import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.Unstable; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.Unstable; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.core.TransactionTestFixture; import org.hyperledger.besu.ethereum.eth.manager.EthContext; @@ -135,8 +135,8 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper { private final Address coinbase = genesisAllocations(getPosGenesisConfigFile()).findFirst().get(); - private MiningParameters miningParameters = - ImmutableMiningParameters.builder() + private MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues(MutableInitValues.builder().coinbase(coinbase).build()) .unstable( Unstable.builder() @@ -228,7 +228,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper { protocolSchedule, ethScheduler, transactionPool, - miningParameters, + miningConfiguration, backwardSyncContext, Optional.empty()); } @@ -273,7 +273,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper { MergeBlockCreator beingSpiedOn = spy( new MergeBlockCreator( - miningParameters, + miningConfiguration, parent -> Bytes.EMPTY, transactionPool, protocolContext, @@ -302,7 +302,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper { protocolContext, protocolSchedule, ethScheduler, - miningParameters, + miningConfiguration, backwardSyncContext, mergeBlockCreatorFactory)); @@ -543,9 +543,9 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper { @Test public void shouldStopRetryBlockCreationIfTimeExpired() throws InterruptedException { final AtomicLong retries = new AtomicLong(0); - miningParameters = - ImmutableMiningParameters.builder() - .from(miningParameters) + miningConfiguration = + ImmutableMiningConfiguration.builder() + .from(miningConfiguration) .unstable(Unstable.builder().posBlockCreationMaxTime(100).build()) .build(); doAnswer( @@ -737,8 +737,8 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper { public void shouldUseExtraDataFromMiningParameters() { final Bytes extraData = Bytes.fromHexString("0x1234"); - miningParameters = - ImmutableMiningParameters.builder() + miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues(MutableInitValues.builder().extraData(extraData).build()) .build(); @@ -748,7 +748,7 @@ public class MergeCoordinatorTest implements MergeGenesisConfigHelper { protocolSchedule, ethScheduler, transactionPool, - miningParameters, + miningConfiguration, backwardSyncContext, Optional.empty()); diff --git a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java index dcfe5f98e3..582c8c5dd5 100644 --- a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java +++ b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.config.GenesisConfigFile; import org.hyperledger.besu.consensus.merge.MergeProtocolSchedule; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; @@ -56,7 +56,7 @@ public interface MergeGenesisConfigHelper { return MergeProtocolSchedule.create( getPosGenesisConfigFile().getConfigOptions(), false, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java index 7b111268e0..22153eecee 100644 --- a/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java +++ b/consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java @@ -34,8 +34,8 @@ import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.sync.backwardsync.BackwardSyncContext; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; @@ -96,7 +96,7 @@ public class MergeReorgTest implements MergeGenesisConfigHelper { mockProtocolSchedule, ethScheduler, mockTransactionPool, - ImmutableMiningParameters.builder() + ImmutableMiningConfiguration.builder() .mutableInitValues(MutableInitValues.builder().coinbase(coinbase).build()) .build(), mock(BackwardSyncContext.class), diff --git a/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java b/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java index d90d5a1527..cc7066f17e 100644 --- a/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java +++ b/consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java @@ -91,9 +91,9 @@ import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.manager.EthContext; @@ -387,8 +387,8 @@ public class TestContextBuilder { final boolean useFixedBaseFee, final List qbftForks) { - final MiningParameters miningParams = - ImmutableMiningParameters.builder() + final MiningConfiguration miningParams = + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .isMiningEnabled(true) @@ -438,7 +438,7 @@ public class TestContextBuilder { forksSchedule, BFT_EXTRA_DATA_ENCODER, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java index e1cbc134b6..473b99332e 100644 --- a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java +++ b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java @@ -24,7 +24,7 @@ import org.hyperledger.besu.consensus.common.bft.BaseBftProtocolScheduleBuilder; import org.hyperledger.besu.consensus.common.bft.BftExtraDataCodec; import org.hyperledger.besu.consensus.common.bft.BftProtocolSchedule; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -50,7 +50,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder * @param isRevertReasonEnabled the is revert reason enabled * @param bftExtraDataCodec the bft extra data codec * @param evmConfiguration the evm configuration - * @param miningParameters The mining parameters + * @param miningConfiguration The mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @param metricsSystem A metricSystem instance to be able to expose metrics in the underlying @@ -64,7 +64,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder final boolean isRevertReasonEnabled, final BftExtraDataCodec bftExtraDataCodec, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -76,7 +76,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder isRevertReasonEnabled, bftExtraDataCodec, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -89,7 +89,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder * @param qbftForksSchedule the qbft forks schedule * @param bftExtraDataCodec the bft extra data codec * @param evmConfiguration the evm configuration - * @param miningParameters The mining parameters + * @param miningConfiguration The mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @param metricsSystem A metricSystem instance to be able to expose metrics in the underlying @@ -101,7 +101,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder final ForksSchedule qbftForksSchedule, final BftExtraDataCodec bftExtraDataCodec, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -112,7 +112,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder false, bftExtraDataCodec, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -125,7 +125,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder * @param qbftForksSchedule the qbft forks schedule * @param isRevertReasonEnabled the is revert reason enabled * @param bftExtraDataCodec the bft extra data codec - * @param miningParameters The mining parameters + * @param miningConfiguration The mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @param metricsSystem A metricSystem instance to be able to expose metrics in the underlying @@ -137,7 +137,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder final ForksSchedule qbftForksSchedule, final boolean isRevertReasonEnabled, final BftExtraDataCodec bftExtraDataCodec, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -148,7 +148,7 @@ public class QbftProtocolScheduleBuilder extends BaseBftProtocolScheduleBuilder isRevertReasonEnabled, bftExtraDataCodec, EvmConfiguration.DEFAULT, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/blockcreation/QbftBlockCreatorFactory.java b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/blockcreation/QbftBlockCreatorFactory.java index 10f61713d9..fc46b6c32f 100644 --- a/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/blockcreation/QbftBlockCreatorFactory.java +++ b/consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/blockcreation/QbftBlockCreatorFactory.java @@ -23,7 +23,7 @@ import org.hyperledger.besu.consensus.common.bft.blockcreation.BftBlockCreatorFa import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -52,7 +52,7 @@ public class QbftBlockCreatorFactory extends BftBlockCreatorFactory forksSchedule, - final MiningParameters miningParams, + final MiningConfiguration miningParams, final Address localAddress, final BftExtraDataCodec bftExtraDataCodec, final EthScheduler ethScheduler) { @@ -74,7 +74,7 @@ public class QbftBlockCreatorFactory extends BftBlockCreatorFactory accountWhitelistController = @@ -198,7 +198,7 @@ public class JsonRpcTestMethodsFactory { context, filterManager, transactionPool, - miningParameters, + miningConfiguration, miningCoordinator, metricsSystem, new HashSet<>(), diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java index d4de405305..b238259d66 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java @@ -45,7 +45,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.eth.manager.EthContext; @@ -130,7 +130,7 @@ public class EthGetFilterChangesIntegrationTest { executionContext.getProtocolSchedule(), blockchain, protocolContext.getWorldStateArchive(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); filterManager = new FilterManagerBuilder() .blockchainQueries(blockchainQueries) diff --git a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java index 0c194ad22f..fc5379f196 100644 --- a/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java +++ b/ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java @@ -45,7 +45,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.eth.manager.EthContext; @@ -130,7 +130,7 @@ public class EthGetFilterChangesIntegrationTest { executionContext.getProtocolSchedule(), blockchain, protocolContext.getWorldStateArchive(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); filterManager = new FilterManagerBuilder() .blockchainQueries(blockchainQueries) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraData.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraData.java index b433ed0b6a..02d7bac98c 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraData.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraData.java @@ -19,13 +19,13 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; public class MinerGetExtraData implements JsonRpcMethod { - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; - public MinerGetExtraData(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public MinerGetExtraData(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; } @Override @@ -36,6 +36,6 @@ public class MinerGetExtraData implements JsonRpcMethod { @Override public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { return new JsonRpcSuccessResponse( - requestContext.getRequest().getId(), miningParameters.getExtraData().toShortHexString()); + requestContext.getRequest().getId(), miningConfiguration.getExtraData().toShortHexString()); } } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPrice.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPrice.java index 07e8fdc9b6..353125f84c 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPrice.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPrice.java @@ -20,13 +20,13 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.Quantity; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; public class MinerGetMinGasPrice implements JsonRpcMethod { - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; - public MinerGetMinGasPrice(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public MinerGetMinGasPrice(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; } @Override @@ -38,6 +38,6 @@ public class MinerGetMinGasPrice implements JsonRpcMethod { public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { return new JsonRpcSuccessResponse( requestContext.getRequest().getId(), - Quantity.create(miningParameters.getMinTransactionGasPrice())); + Quantity.create(miningConfiguration.getMinTransactionGasPrice())); } } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFee.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFee.java index d99d13de2c..e12810b30f 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFee.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFee.java @@ -20,13 +20,13 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.JsonRpcMethod; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.Quantity; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; public class MinerGetMinPriorityFee implements JsonRpcMethod { - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; - public MinerGetMinPriorityFee(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public MinerGetMinPriorityFee(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; } @Override @@ -38,6 +38,6 @@ public class MinerGetMinPriorityFee implements JsonRpcMethod { public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { return new JsonRpcSuccessResponse( requestContext.getRequest().getId(), - Quantity.create(miningParameters.getMinPriorityFeePerGas())); + Quantity.create(miningConfiguration.getMinPriorityFeePerGas())); } } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraData.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraData.java index 51395e24f7..7d5fa5b2e0 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraData.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraData.java @@ -23,7 +23,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorR import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import java.nio.charset.StandardCharsets; @@ -35,10 +35,10 @@ import org.slf4j.LoggerFactory; public class MinerSetExtraData implements JsonRpcMethod { private static final Logger LOG = LoggerFactory.getLogger(MinerSetExtraData.class); - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; - public MinerSetExtraData(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public MinerSetExtraData(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; } @Override @@ -53,7 +53,7 @@ public class MinerSetExtraData implements JsonRpcMethod { Bytes32.fromHexStringLenient( rawParam); // done for validation, we want a hex string and max 32 bytes final var extraData = Bytes.fromHexStringLenient(rawParam); - miningParameters.setExtraData(extraData); + miningConfiguration.setExtraData(extraData); LOG.atDebug() .setMessage("set extra data, raw=[{}] parsed=[{}], UTF-8=[{}]") .addArgument(rawParam) diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPrice.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPrice.java index 733ed3a8f3..e932669b00 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPrice.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPrice.java @@ -25,7 +25,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorR import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,10 +33,10 @@ import org.slf4j.LoggerFactory; public class MinerSetMinGasPrice implements JsonRpcMethod { private static final Logger LOG = LoggerFactory.getLogger(MinerSetMinGasPrice.class); - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; - public MinerSetMinGasPrice(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public MinerSetMinGasPrice(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; } @Override @@ -49,7 +49,7 @@ public class MinerSetMinGasPrice implements JsonRpcMethod { try { final Wei minGasPrice = Wei.fromHexString(requestContext.getRequiredParameter(0, String.class)); - miningParameters.setMinTransactionGasPrice(minGasPrice); + miningConfiguration.setMinTransactionGasPrice(minGasPrice); LOG.debug("min gas price changed to {}", minGasPrice.toHumanReadableString()); return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), true); } catch (final IllegalArgumentException invalidJsonRpcParameters) { diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFee.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFee.java index b1bf4338f7..d296f28f92 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFee.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFee.java @@ -24,7 +24,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorR import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,10 +32,10 @@ import org.slf4j.LoggerFactory; public class MinerSetMinPriorityFee implements JsonRpcMethod { private static final Logger LOG = LoggerFactory.getLogger(MinerSetMinPriorityFee.class); - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; - public MinerSetMinPriorityFee(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public MinerSetMinPriorityFee(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; } @Override @@ -48,7 +48,7 @@ public class MinerSetMinPriorityFee implements JsonRpcMethod { try { final Wei minPriorityFeePerGas = Wei.fromHexString(requestContext.getRequiredParameter(0, String.class)); - miningParameters.setMinPriorityFeePerGas(minPriorityFeePerGas); + miningConfiguration.setMinPriorityFeePerGas(minPriorityFeePerGas); LOG.debug( "min priority fee per gas changed to {}", minPriorityFeePerGas.toHumanReadableString()); return new JsonRpcSuccessResponse(requestContext.getRequest().getId(), true); diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java index cdf4440bde..7be34f0229 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java @@ -25,7 +25,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.RpcModules; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration; import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.manager.EthPeers; @@ -67,7 +67,7 @@ public class JsonRpcMethodsFactory { final ProtocolContext protocolContext, final FilterManager filterManager, final TransactionPool transactionPool, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final MiningCoordinator miningCoordinator, final ObservableMetricsSystem metricsSystem, final Set supportedCapabilities, @@ -139,7 +139,7 @@ public class JsonRpcMethodsFactory { webSocketConfiguration, metricsConfiguration, graphQLConfiguration), - new MinerJsonRpcMethods(miningParameters, miningCoordinator), + new MinerJsonRpcMethods(miningConfiguration, miningCoordinator), new PermJsonRpcMethods(accountsAllowlistController, nodeAllowlistController), new PrivJsonRpcMethods( blockchainQueries, diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/MinerJsonRpcMethods.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/MinerJsonRpcMethods.java index c799c23305..14e74767ee 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/MinerJsonRpcMethods.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/MinerJsonRpcMethods.java @@ -28,18 +28,18 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.miner.MinerSet import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.miner.MinerStart; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.miner.MinerStop; import org.hyperledger.besu.ethereum.blockcreation.MiningCoordinator; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import java.util.Map; public class MinerJsonRpcMethods extends ApiGroupJsonRpcMethods { private final MiningCoordinator miningCoordinator; - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; public MinerJsonRpcMethods( - final MiningParameters miningParameters, final MiningCoordinator miningCoordinator) { - this.miningParameters = miningParameters; + final MiningConfiguration miningConfiguration, final MiningCoordinator miningCoordinator) { + this.miningConfiguration = miningConfiguration; this.miningCoordinator = miningCoordinator; } @@ -57,11 +57,11 @@ public class MinerJsonRpcMethods extends ApiGroupJsonRpcMethods { minerSetCoinbase, new MinerSetEtherbase(minerSetCoinbase), new MinerChangeTargetGasLimit(miningCoordinator), - new MinerGetMinPriorityFee(miningParameters), - new MinerSetMinPriorityFee(miningParameters), - new MinerGetMinGasPrice(miningParameters), - new MinerSetMinGasPrice(miningParameters), - new MinerGetExtraData(miningParameters), - new MinerSetExtraData(miningParameters)); + new MinerGetMinPriorityFee(miningConfiguration), + new MinerSetMinPriorityFee(miningConfiguration), + new MinerGetMinGasPrice(miningConfiguration), + new MinerSetMinGasPrice(miningConfiguration), + new MinerGetExtraData(miningConfiguration), + new MinerSetExtraData(miningConfiguration)); } } diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueries.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueries.java index c03bf124c4..7e5a7c6fe0 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueries.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueries.java @@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.LogWithMetadata; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; @@ -77,20 +77,20 @@ public class BlockchainQueries { private final Optional transactionLogBloomCacher; private final Optional ethScheduler; private final ApiConfiguration apiConfig; - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; public BlockchainQueries( final ProtocolSchedule protocolSchedule, final Blockchain blockchain, final WorldStateArchive worldStateArchive, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { this( protocolSchedule, blockchain, worldStateArchive, Optional.empty(), Optional.empty(), - miningParameters); + miningConfiguration); } public BlockchainQueries( @@ -98,14 +98,14 @@ public class BlockchainQueries { final Blockchain blockchain, final WorldStateArchive worldStateArchive, final EthScheduler scheduler, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { this( protocolSchedule, blockchain, worldStateArchive, Optional.empty(), Optional.ofNullable(scheduler), - miningParameters); + miningConfiguration); } public BlockchainQueries( @@ -114,7 +114,7 @@ public class BlockchainQueries { final WorldStateArchive worldStateArchive, final Optional cachePath, final Optional scheduler, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { this( protocolSchedule, blockchain, @@ -122,7 +122,7 @@ public class BlockchainQueries { cachePath, scheduler, ImmutableApiConfiguration.builder().build(), - miningParameters); + miningConfiguration); } public BlockchainQueries( @@ -132,7 +132,7 @@ public class BlockchainQueries { final Optional cachePath, final Optional scheduler, final ApiConfiguration apiConfig, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { this.protocolSchedule = protocolSchedule; this.blockchain = blockchain; this.worldStateArchive = worldStateArchive; @@ -144,7 +144,7 @@ public class BlockchainQueries { new TransactionLogBloomCacher(blockchain, cachePath.get(), scheduler.get())) : Optional.empty(); this.apiConfig = apiConfig; - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; } public Blockchain getBlockchain() { @@ -1034,7 +1034,7 @@ public class BlockchainQueries { private Wei gasPriceLowerBound( final BlockHeader chainHeadHeader, final FeeMarket nextBlockFeeMarket) { - final var minGasPrice = miningParameters.getMinTransactionGasPrice(); + final var minGasPrice = miningConfiguration.getMinTransactionGasPrice(); if (nextBlockFeeMarket.implementsBaseFee()) { return UInt256s.max( @@ -1070,9 +1070,9 @@ public class BlockchainQueries { .toArray(Wei[]::new); return gasCollection.length == 0 - ? miningParameters.getMinPriorityFeePerGas() + ? miningConfiguration.getMinPriorityFeePerGas() : UInt256s.max( - miningParameters.getMinPriorityFeePerGas(), + miningConfiguration.getMinPriorityFeePerGas(), gasCollection[ Math.min( gasCollection.length - 1, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java index 5a1c23d40e..2b55b42ba2 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java @@ -27,7 +27,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; import org.hyperledger.besu.ethereum.core.DefaultSyncStatus; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -119,7 +119,7 @@ public abstract class AbstractEthGraphQLHttpServiceTest { Optional.empty(), Optional.empty(), ImmutableApiConfiguration.builder().build(), - MiningParameters.newDefault().setMinTransactionGasPrice(Wei.ZERO)); + MiningConfiguration.newDefault().setMinTransactionGasPrice(Wei.ZERO)); final Set supportedCapabilities = new HashSet<>(); supportedCapabilities.add(EthProtocol.ETH62); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java index d504e3bb0d..db896a9485 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java @@ -35,7 +35,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguratio import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.core.Transaction; @@ -137,7 +137,7 @@ public abstract class AbstractJsonRpcHttpServiceTest { final Synchronizer synchronizerMock = mock(Synchronizer.class); final P2PNetwork peerDiscoveryMock = mock(P2PNetwork.class); final TransactionPool transactionPoolMock = mock(TransactionPool.class); - final MiningParameters miningParameters = mock(MiningParameters.class); + final MiningConfiguration miningConfiguration = mock(MiningConfiguration.class); final PoWMiningCoordinator miningCoordinatorMock = mock(PoWMiningCoordinator.class); when(transactionPoolMock.addTransactionViaApi(any(Transaction.class))) .thenReturn(ValidationResult.valid()); @@ -151,7 +151,7 @@ public abstract class AbstractJsonRpcHttpServiceTest { blockchainSetupUtil.getProtocolSchedule(), blockchainSetupUtil.getBlockchain(), blockchainSetupUtil.getWorldArchive(), - miningParameters); + miningConfiguration); final FilterIdGenerator filterIdGenerator = mock(FilterIdGenerator.class); final FilterRepository filterRepository = new FilterRepository(); when(filterIdGenerator.nextId()).thenReturn("0x1"); @@ -183,7 +183,7 @@ public abstract class AbstractJsonRpcHttpServiceTest { protocolContext, filterManager, transactionPoolMock, - miningParameters, + miningConfiguration, miningCoordinatorMock, new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java index 022aa24422..9113e15a12 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java @@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguratio import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -113,14 +113,14 @@ public class JsonRpcHttpServiceHostAllowlistTest { synchronizer, MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID), - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()), mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java index f9dba0bc26..aacf115796 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java @@ -37,7 +37,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguratio import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -144,14 +144,14 @@ public class JsonRpcHttpServiceLoginTest { synchronizer, MainnetProtocolSchedule.fromConfig( genesisConfigOptions, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()), mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java index 63ae1b8bfb..ae66f2ac76 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture; import org.hyperledger.besu.ethereum.core.Synchronizer; @@ -217,7 +217,7 @@ public class JsonRpcHttpServiceRpcApisTest { mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, @@ -328,7 +328,7 @@ public class JsonRpcHttpServiceRpcApisTest { mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java index 5a439fa194..ec4f6c6e2b 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java @@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.chain.ChainHead; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -122,14 +122,14 @@ public class JsonRpcHttpServiceTestBase { MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID), EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()), mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java index 28474d3c53..fa336169b9 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsClientAuthTest.java @@ -37,7 +37,7 @@ import org.hyperledger.besu.ethereum.api.tls.SelfSignedP12Certificate; import org.hyperledger.besu.ethereum.api.tls.TlsConfiguration; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -127,14 +127,14 @@ public class JsonRpcHttpServiceTlsClientAuthTest { synchronizer, MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID), - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()), mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java index 15df60230b..b675430c49 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsMisconfigurationTest.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.ethereum.api.tls.SelfSignedP12Certificate; import org.hyperledger.besu.ethereum.api.tls.TlsConfiguration; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -115,14 +115,14 @@ class JsonRpcHttpServiceTlsMisconfigurationTest { synchronizer, MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID), - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()), mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java index 6f7ce4e1d6..de5683ad5c 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTlsTest.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.ethereum.api.tls.SelfSignedP12Certificate; import org.hyperledger.besu.ethereum.api.tls.TlsConfiguration; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -116,14 +116,14 @@ public class JsonRpcHttpServiceTlsTest { synchronizer, MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions().constantinopleBlock(0).chainId(CHAIN_ID), - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()), mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java index 8c7cba99c4..c55f9b4654 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGasPriceTest.java @@ -39,7 +39,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec; @@ -77,13 +77,13 @@ public class EthGasPriceTest { @Mock private ProtocolSchedule protocolSchedule; @Mock private Blockchain blockchain; private EthGasPrice method; - private MiningParameters miningParameters; + private MiningConfiguration miningConfiguration; @BeforeEach public void setUp() { ApiConfiguration apiConfig = createDefaultApiConfiguration(); - miningParameters = - MiningParameters.newDefault().setMinTransactionGasPrice(DEFAULT_MIN_GAS_PRICE); + miningConfiguration = + MiningConfiguration.newDefault().setMinTransactionGasPrice(DEFAULT_MIN_GAS_PRICE); method = createEthGasPriceMethod(apiConfig); } @@ -96,7 +96,7 @@ public class EthGasPriceTest { public void shouldReturnMinValueWhenNoTransactionsExist() { final JsonRpcRequestContext request = requestWithParams(); final String expectedWei = "0x4d2"; // minGasPrice > nextBlockBaseFee - miningParameters.setMinTransactionGasPrice(Wei.fromHexString(expectedWei)); + miningConfiguration.setMinTransactionGasPrice(Wei.fromHexString(expectedWei)); final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(request.getRequest().getId(), expectedWei); @@ -117,7 +117,7 @@ public class EthGasPriceTest { final JsonRpcRequestContext request = requestWithParams(); final String expectedWei = DEFAULT_BASE_FEE.toShortHexString(); // nextBlockBaseFee > minGasPrice - miningParameters.setMinTransactionGasPrice(Wei.fromHexString(expectedWei)); + miningConfiguration.setMinTransactionGasPrice(Wei.fromHexString(expectedWei)); final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(request.getRequest().getId(), expectedWei); @@ -234,7 +234,7 @@ public class EthGasPriceTest { @MethodSource("ethGasPriceAtGenesis") public void ethGasPriceAtGenesis( final Wei minGasPrice, final Optional maybeGenesisBaseFee, final Wei expectedGasPrice) { - miningParameters.setMinTransactionGasPrice(minGasPrice); + miningConfiguration.setMinTransactionGasPrice(minGasPrice); if (maybeGenesisBaseFee.isPresent()) { mockBaseFeeMarket(); @@ -267,7 +267,7 @@ public class EthGasPriceTest { final Long lowerBoundCoefficient, final Long upperBoundCoefficient, final long expectedGasPrice) { - miningParameters.setMinTransactionGasPrice(Wei.of(100)); + miningConfiguration.setMinTransactionGasPrice(Wei.of(100)); mockBaseFeeMarket(); @@ -423,7 +423,7 @@ public class EthGasPriceTest { Optional.empty(), Optional.empty(), apiConfig, - miningParameters), + miningConfiguration), apiConfig); } } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java index 254d0fbe9e..fd92b55ba4 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockByNumberTest.java @@ -35,7 +35,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -93,7 +93,7 @@ public class EthGetBlockByNumberTest { blockchainQueries = spy( new BlockchainQueries( - protocolSchedule, blockchain, worldStateArchive, MiningParameters.newDefault())); + protocolSchedule, blockchain, worldStateArchive, MiningConfiguration.newDefault())); method = new EthGetBlockByNumber(blockchainQueries, blockResult, synchronizer); } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockReceiptsTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockReceiptsTest.java index 545b43a6e7..f25407c86e 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockReceiptsTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetBlockReceiptsTest.java @@ -35,7 +35,7 @@ import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -86,7 +86,7 @@ public class EthGetBlockReceiptsTest { blockchainQueries = spy( new BlockchainQueries( - protocolSchedule, blockchain, worldStateArchive, MiningParameters.newDefault())); + protocolSchedule, blockchain, worldStateArchive, MiningConfiguration.newDefault())); protocolSchedule = mock(ProtocolSchedule.class); method = new EthGetBlockReceipts(blockchainQueries, protocolSchedule); } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetProofTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetProofTest.java index 06a4b9d0e7..a346cd827b 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetProofTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetProofTest.java @@ -39,7 +39,7 @@ import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.chain.ChainHead; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.proof.WorldStateProof; import org.hyperledger.besu.ethereum.worldstate.StateTrieAccountValue; @@ -89,7 +89,7 @@ class EthGetProofTest { blockchainQueries = spy( new BlockchainQueries( - protocolSchedule, blockchain, archive, MiningParameters.newDefault())); + protocolSchedule, blockchain, archive, MiningConfiguration.newDefault())); when(blockchainQueries.getBlockchain()).thenReturn(blockchain); when(blockchainQueries.headBlockNumber()).thenReturn(14L); when(blockchain.getChainHead()).thenReturn(chainHead); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java index 884cc504d8..608577f47b 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthGetTransactionReceiptTest.java @@ -42,7 +42,7 @@ import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.mainnet.PoWHasher; @@ -195,7 +195,7 @@ public class EthGetTransactionReceiptTest { protocolSchedule, blockchain, mock(WorldStateArchive.class), - MiningParameters.newDefault())); + MiningConfiguration.newDefault())); private final EthGetTransactionReceipt ethGetTransactionReceipt = new EthGetTransactionReceipt(blockchainQueries, protocolSchedule); private final String receiptString = diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java index d29a10a114..05b5f8cb0d 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/EthMaxPriorityFeePerGasTest.java @@ -35,7 +35,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.feemarket.CancunFeeMarket; @@ -67,12 +67,12 @@ public class EthMaxPriorityFeePerGasTest { private EthMaxPriorityFeePerGas method; @Mock private ProtocolSchedule protocolSchedule; @Mock private Blockchain blockchain; - private MiningParameters miningParameters; + private MiningConfiguration miningConfiguration; @BeforeEach public void setUp() { - miningParameters = - MiningParameters.newDefault().setMinPriorityFeePerGas(DEFAULT_MIN_PRIORITY_FEE_PER_GAS); + miningConfiguration = + MiningConfiguration.newDefault().setMinPriorityFeePerGas(DEFAULT_MIN_PRIORITY_FEE_PER_GAS); method = createEthMaxPriorityFeePerGasMethod(); } @@ -85,7 +85,7 @@ public class EthMaxPriorityFeePerGasTest { public void whenNoTransactionsExistReturnMinPriorityFeePerGasPrice() { final JsonRpcRequestContext request = requestWithParams(); final Wei expectedWei = Wei.ONE; - miningParameters.setMinPriorityFeePerGas(expectedWei); + miningConfiguration.setMinPriorityFeePerGas(expectedWei); final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(request.getRequest().getId(), expectedWei.toShortHexString()); @@ -111,7 +111,7 @@ public class EthMaxPriorityFeePerGasTest { public void returnMinPriorityFeePerGasWhenMedianValueIsLower() { final JsonRpcRequestContext request = requestWithParams(); final Wei expectedWei = Wei.of(100_000); - miningParameters.setMinPriorityFeePerGas(expectedWei); + miningConfiguration.setMinPriorityFeePerGas(expectedWei); mockBlockchain(100, 1); @@ -128,7 +128,7 @@ public class EthMaxPriorityFeePerGasTest { public void atGenesisReturnMinPriorityFeePerGas() { final JsonRpcRequestContext request = requestWithParams(); final Wei expectedWei = Wei.ONE; - miningParameters.setMinPriorityFeePerGas(expectedWei); + miningConfiguration.setMinPriorityFeePerGas(expectedWei); final JsonRpcResponse expectedResponse = new JsonRpcSuccessResponse(request.getRequest().getId(), expectedWei.toShortHexString()); @@ -235,6 +235,6 @@ public class EthMaxPriorityFeePerGasTest { Optional.empty(), Optional.empty(), ImmutableApiConfiguration.builder().build(), - miningParameters)); + miningConfiguration)); } } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraDataTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraDataTest.java index ebaf817a47..882a071110 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraDataTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraDataTest.java @@ -20,8 +20,8 @@ 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.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.apache.tuweni.bytes.Bytes; import org.junit.jupiter.api.Test; @@ -30,8 +30,8 @@ public class MinerGetExtraDataTest { @Test public void shouldReturnDefaultExtraData() { - final MiningParameters miningParameters = ImmutableMiningParameters.newDefault(); - final MinerGetExtraData method = new MinerGetExtraData(miningParameters); + final MiningConfiguration miningConfiguration = ImmutableMiningConfiguration.newDefault(); + final MinerGetExtraData method = new MinerGetExtraData(miningConfiguration); final JsonRpcRequestContext request = new JsonRpcRequestContext(new JsonRpcRequest("2.0", method.getName(), new Object[] {})); @@ -43,12 +43,12 @@ public class MinerGetExtraDataTest { @Test public void shouldReturnSetAtRuntimeExtraData() { - final MiningParameters miningParameters = ImmutableMiningParameters.newDefault(); - final MinerGetExtraData method = new MinerGetExtraData(miningParameters); + final MiningConfiguration miningConfiguration = ImmutableMiningConfiguration.newDefault(); + final MinerGetExtraData method = new MinerGetExtraData(miningConfiguration); final var extraData = "0x123456"; final Bytes extraDataAtRuntime = Bytes.fromHexString(extraData); - miningParameters.setExtraData(extraDataAtRuntime); + miningConfiguration.setExtraData(extraDataAtRuntime); final JsonRpcRequestContext request = new JsonRpcRequestContext(new JsonRpcRequest("2.0", method.getName(), new Object[] {})); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPriceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPriceTest.java index f73229f0e0..8e036d822d 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPriceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPriceTest.java @@ -22,8 +22,8 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.JsonRpcRequestContext; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.Quantity; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.junit.jupiter.api.Test; @@ -31,15 +31,16 @@ public class MinerGetMinGasPriceTest { @Test public void shouldReturnDefaultMinGasPrice() { - final MiningParameters miningParameters = ImmutableMiningParameters.newDefault(); - final MinerGetMinGasPrice method = new MinerGetMinGasPrice(miningParameters); + final MiningConfiguration miningConfiguration = ImmutableMiningConfiguration.newDefault(); + final MinerGetMinGasPrice method = new MinerGetMinGasPrice(miningConfiguration); final JsonRpcRequestContext request = new JsonRpcRequestContext(new JsonRpcRequest("2.0", method.getName(), new Object[] {})); final JsonRpcResponse expected = new JsonRpcSuccessResponse( request.getRequest().getId(), - Quantity.create(MiningParameters.MutableInitValues.DEFAULT_MIN_TRANSACTION_GAS_PRICE)); + Quantity.create( + MiningConfiguration.MutableInitValues.DEFAULT_MIN_TRANSACTION_GAS_PRICE)); final JsonRpcResponse actual = method.response(request); assertThat(actual).usingRecursiveComparison().isEqualTo(expected); @@ -47,12 +48,12 @@ public class MinerGetMinGasPriceTest { @Test public void shouldReturnSetAtRuntimeMinGasPrice() { - final MiningParameters miningParameters = ImmutableMiningParameters.newDefault(); - final MinerGetMinGasPrice method = new MinerGetMinGasPrice(miningParameters); + final MiningConfiguration miningConfiguration = ImmutableMiningConfiguration.newDefault(); + final MinerGetMinGasPrice method = new MinerGetMinGasPrice(miningConfiguration); final Wei minGasPriceAtRuntime = Wei.of(2000); - miningParameters.setMinTransactionGasPrice(minGasPriceAtRuntime); + miningConfiguration.setMinTransactionGasPrice(minGasPriceAtRuntime); final JsonRpcRequestContext request = new JsonRpcRequestContext(new JsonRpcRequest("2.0", method.getName(), new Object[] {})); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFeeTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFeeTest.java index 78fb85b94b..07e3e5842f 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFeeTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFeeTest.java @@ -23,18 +23,18 @@ 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.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class MinerGetMinPriorityFeeTest { - MiningParameters miningParameters = mock(MiningParameters.class); + MiningConfiguration miningConfiguration = mock(MiningConfiguration.class); private MinerGetMinPriorityFee method; @BeforeEach public void setUp() { - method = new MinerGetMinPriorityFee(miningParameters); + method = new MinerGetMinPriorityFee(miningConfiguration); } @Test @@ -44,7 +44,8 @@ public class MinerGetMinPriorityFeeTest { final JsonRpcRequestContext request = new JsonRpcRequestContext(new JsonRpcRequest("2.0", method.getName(), new Object[] {})); - when(miningParameters.getMinPriorityFeePerGas()).thenReturn(Wei.fromHexString(minPriorityFee)); + when(miningConfiguration.getMinPriorityFeePerGas()) + .thenReturn(Wei.fromHexString(minPriorityFee)); final JsonRpcResponse expected = new JsonRpcSuccessResponse(request.getRequest().getId(), minPriorityFee); diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraDataTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraDataTest.java index b3c7b45d07..e197964081 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraDataTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraDataTest.java @@ -23,7 +23,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorR import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import java.nio.charset.StandardCharsets; @@ -32,12 +32,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class MinerSetExtraDataTest { - MiningParameters miningParameters = MiningParameters.newDefault(); + MiningConfiguration miningConfiguration = MiningConfiguration.newDefault(); private MinerSetExtraData method; @BeforeEach public void setUp() { - method = new MinerSetExtraData(miningParameters); + method = new MinerSetExtraData(miningConfiguration); } @Test @@ -49,7 +49,7 @@ public class MinerSetExtraDataTest { final JsonRpcResponse actual = method.response(request); assertThat(actual).usingRecursiveComparison().isEqualTo(expected); - final var currExtraData = miningParameters.getExtraData(); + final var currExtraData = miningConfiguration.getExtraData(); assertThat(new String(currExtraData.toArray(), StandardCharsets.UTF_8)).isEqualTo(newExtraData); } @@ -67,7 +67,7 @@ public class MinerSetExtraDataTest { final JsonRpcResponse actual = method.response(request); assertThat(actual).usingRecursiveComparison().isEqualTo(expected); - final var currExtraData = miningParameters.getExtraData(); + final var currExtraData = miningConfiguration.getExtraData(); assertThat(new String(currExtraData.toArray(), StandardCharsets.UTF_8)) .isEqualTo( new String( diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPriceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPriceTest.java index fb56b57307..860e1967d6 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPriceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPriceTest.java @@ -24,18 +24,18 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorR import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class MinerSetMinGasPriceTest { - MiningParameters miningParameters = MiningParameters.newDefault(); + MiningConfiguration miningConfiguration = MiningConfiguration.newDefault(); private MinerSetMinGasPrice method; @BeforeEach public void setUp() { - method = new MinerSetMinGasPrice(miningParameters); + method = new MinerSetMinGasPrice(miningConfiguration); } @Test @@ -64,7 +64,7 @@ public class MinerSetMinGasPriceTest { final JsonRpcResponse actual = method.response(request); assertThat(actual).usingRecursiveComparison().isEqualTo(expected); - assertThat(miningParameters.getMinTransactionGasPrice()) + assertThat(miningConfiguration.getMinTransactionGasPrice()) .isEqualTo(Wei.fromHexString(newMinGasPrice)); } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFeeTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFeeTest.java index 7e564ac425..fb75788d4b 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFeeTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFeeTest.java @@ -24,18 +24,18 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcErrorR import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.JsonRpcSuccessResponse; import org.hyperledger.besu.ethereum.api.jsonrpc.internal.response.RpcErrorType; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; public class MinerSetMinPriorityFeeTest { - MiningParameters miningParameters = MiningParameters.newDefault(); + MiningConfiguration miningConfiguration = MiningConfiguration.newDefault(); private MinerSetMinPriorityFee method; @BeforeEach public void setUp() { - method = new MinerSetMinPriorityFee(miningParameters); + method = new MinerSetMinPriorityFee(miningConfiguration); } @Test @@ -80,7 +80,7 @@ public class MinerSetMinPriorityFeeTest { final JsonRpcResponse expected = new JsonRpcSuccessResponse(request.getRequest().getId(), true); final JsonRpcResponse actual = method.response(request); assertThat(actual).usingRecursiveComparison().isEqualTo(expected); - assertThat(miningParameters.getMinPriorityFeePerGas()) + assertThat(miningConfiguration.getMinPriorityFeePerGas()) .isEqualTo(Wei.fromHexString(newMinPriorityFee)); } diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java index 47a16135ff..53785012d0 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/WebSocketServiceLoginTest.java @@ -44,7 +44,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.Subscrip import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.blockcreation.PoWMiningCoordinator; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -180,14 +180,14 @@ public class WebSocketServiceLoginTest { synchronizer, MainnetProtocolSchedule.fromConfig( genesisConfigOptions, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()), mock(ProtocolContext.class), mock(FilterManager.class), mock(TransactionPool.class), - mock(MiningParameters.class), + mock(MiningConfiguration.class), mock(PoWMiningCoordinator.class), new NoOpMetricsSystem(), supportedCapabilities, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionServiceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionServiceTest.java index 8cb33fa714..aa69a239cc 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionServiceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionServiceTest.java @@ -32,7 +32,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockDataGenerator.BlockOptions; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -85,7 +85,7 @@ public class NewBlockHeadersSubscriptionServiceTest { protocolSchedule, blockchain, createInMemoryWorldStateArchive(), - MiningParameters.newDefault())); + MiningConfiguration.newDefault())); @BeforeEach public void before() { diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java index 4b96317329..7b3d50b2d0 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesLogCacheTest.java @@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -136,7 +136,7 @@ public class BlockchainQueriesLogCacheTest { worldStateArchive, Optional.of(cacheDir), Optional.of(scheduler), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); } /** diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesTest.java index a49b290e4d..a0213a41a8 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueriesTest.java @@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockDataGenerator.BlockOptions; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.LogWithMetadata; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; @@ -599,7 +599,7 @@ public class BlockchainQueriesTest { blockchain, worldStateArchive, scheduler, - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); } } diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreator.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreator.java index ad9489daf8..51cde269e0 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreator.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreator.java @@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; import org.hyperledger.besu.ethereum.core.Request; @@ -84,7 +84,7 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { private final MiningBeneficiaryCalculator miningBeneficiaryCalculator; private final ExtraDataCalculator extraDataCalculator; private final TransactionPool transactionPool; - protected final MiningParameters miningParameters; + protected final MiningConfiguration miningConfiguration; protected final ProtocolContext protocolContext; protected final ProtocolSchedule protocolSchedule; protected final BlockHeaderFunctions blockHeaderFunctions; @@ -92,14 +92,14 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { private final AtomicBoolean isCancelled = new AtomicBoolean(false); protected AbstractBlockCreator( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final MiningBeneficiaryCalculator miningBeneficiaryCalculator, final ExtraDataCalculator extraDataCalculator, final TransactionPool transactionPool, final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, final EthScheduler ethScheduler) { - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; this.miningBeneficiaryCalculator = miningBeneficiaryCalculator; this.extraDataCalculator = extraDataCalculator; this.transactionPool = transactionPool; @@ -219,7 +219,7 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { throwIfStopped(); final PluginTransactionSelector pluginTransactionSelector = - miningParameters.getTransactionSelectionService().createPluginTransactionSelector(); + miningConfiguration.getTransactionSelectionService().createPluginTransactionSelector(); final BlockAwareOperationTracer operationTracer = pluginTransactionSelector.getOperationTracer(); @@ -377,7 +377,7 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { final BlockTransactionSelector selector = new BlockTransactionSelector( - miningParameters, + miningConfiguration, transactionProcessor, protocolContext.getBlockchain(), disposableWorldState, @@ -433,7 +433,7 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { .getGasLimitCalculator() .nextGasLimit( parentHeader.getGasLimit(), - miningParameters.getTargetGasLimit().orElse(parentHeader.getGasLimit()), + miningConfiguration.getTargetGasLimit().orElse(parentHeader.getGasLimit()), newBlockNumber); final DifficultyCalculator difficultyCalculator = protocolSpec.getDifficultyCalculator(); @@ -457,7 +457,7 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { final Bytes32 parentBeaconBlockRoot = maybeParentBeaconBlockRoot.orElse(null); return BlockHeaderBuilder.create() .parentHash(parentHeader.getHash()) - .coinbase(miningParameters.getCoinbase().orElseThrow()) + .coinbase(miningConfiguration.getCoinbase().orElseThrow()) .difficulty(Difficulty.of(difficulty)) .number(newBlockNumber) .gasLimit(gasLimit) diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractMinerExecutor.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractMinerExecutor.java index af71938d1d..4d2b1274c6 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractMinerExecutor.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/AbstractMinerExecutor.java @@ -20,7 +20,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.chain.MinedBlockObserver; import org.hyperledger.besu.ethereum.chain.PoWObserver; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; import org.hyperledger.besu.ethereum.mainnet.AbstractGasLimitSpecification; @@ -47,7 +47,7 @@ public abstract class AbstractMinerExecutor getCoinbase(); diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/NoopMiningCoordinator.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/NoopMiningCoordinator.java index 6eb4927226..8b5624f847 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/NoopMiningCoordinator.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/NoopMiningCoordinator.java @@ -18,7 +18,7 @@ import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import java.util.List; @@ -26,10 +26,10 @@ import java.util.Optional; public class NoopMiningCoordinator implements MiningCoordinator { - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; - public NoopMiningCoordinator(final MiningParameters miningParameters) { - this.miningParameters = miningParameters; + public NoopMiningCoordinator(final MiningConfiguration miningConfiguration) { + this.miningConfiguration = miningConfiguration; } @Override @@ -58,17 +58,17 @@ public class NoopMiningCoordinator implements MiningCoordinator { @Override public Wei getMinTransactionGasPrice() { - return miningParameters.getMinTransactionGasPrice(); + return miningConfiguration.getMinTransactionGasPrice(); } @Override public Wei getMinPriorityFeePerGas() { - return miningParameters.getMinPriorityFeePerGas(); + return miningConfiguration.getMinPriorityFeePerGas(); } @Override public Optional
getCoinbase() { - return miningParameters.getCoinbase(); + return miningConfiguration.getCoinbase(); } @Override diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreator.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreator.java index d0042a5ad9..173330568f 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreator.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreator.java @@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.blockcreation; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.SealableBlockHeader; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; @@ -39,7 +39,7 @@ public class PoWBlockCreator extends AbstractBlockCreator { private final PoWSolver nonceSolver; public PoWBlockCreator( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final ExtraDataCalculator extraDataCalculator, final TransactionPool transactionPool, final ProtocolContext protocolContext, @@ -47,8 +47,8 @@ public class PoWBlockCreator extends AbstractBlockCreator { final PoWSolver nonceSolver, final EthScheduler ethScheduler) { super( - miningParameters, - __ -> miningParameters.getCoinbase().orElseThrow(), + miningConfiguration, + __ -> miningConfiguration.getCoinbase().orElseThrow(), extraDataCalculator, transactionPool, protocolContext, diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutor.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutor.java index b14eb19340..f17b7989d2 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutor.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutor.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.chain.MinedBlockObserver; import org.hyperledger.besu.ethereum.chain.PoWObserver; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; import org.hyperledger.besu.ethereum.mainnet.EpochCalculator; @@ -40,7 +40,7 @@ public class PoWMinerExecutor extends AbstractMinerExecutor { final ProtocolContext protocolContext, final ProtocolSchedule protocolSchedule, final TransactionPool transactionPool, - final MiningParameters miningParams, + final MiningConfiguration miningParams, final AbstractBlockScheduler blockScheduler, final EpochCalculator epochCalculator, final EthScheduler ethScheduler) { @@ -62,7 +62,7 @@ public class PoWMinerExecutor extends AbstractMinerExecutor { final Subscribers observers, final Subscribers ethHashObservers, final BlockHeader parentHeader) { - if (miningParameters.getCoinbase().isEmpty()) { + if (miningConfiguration.getCoinbase().isEmpty()) { throw new CoinbaseNotSetException("Unable to start mining without a coinbase."); } return super.startAsyncMining(observers, ethHashObservers, parentHeader); @@ -79,7 +79,7 @@ public class PoWMinerExecutor extends AbstractMinerExecutor { protocolSchedule.getForNextBlockHeader(parentHeader, 0); final PoWSolver solver = new PoWSolver( - miningParameters, + miningConfiguration, nextBlockProtocolSpec.getPoWHasher().get(), stratumMiningEnabled, ethHashObservers, @@ -87,8 +87,8 @@ public class PoWMinerExecutor extends AbstractMinerExecutor { final Function blockCreator = (header) -> new PoWBlockCreator( - miningParameters, - parent -> miningParameters.getExtraData(), + miningConfiguration, + parent -> miningConfiguration.getExtraData(), transactionPool, protocolContext, protocolSchedule, @@ -103,7 +103,7 @@ public class PoWMinerExecutor extends AbstractMinerExecutor { if (coinbase == null) { throw new IllegalArgumentException("Coinbase cannot be unset."); } else { - miningParameters.setCoinbase(Address.wrap(coinbase.copy())); + miningConfiguration.setCoinbase(Address.wrap(coinbase.copy())); } } @@ -113,7 +113,7 @@ public class PoWMinerExecutor extends AbstractMinerExecutor { @Override public Optional
getCoinbase() { - return miningParameters.getCoinbase(); + return miningConfiguration.getCoinbase(); } public EpochCalculator getEpochCalculator() { diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockSelectionContext.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockSelectionContext.java index f8bf6d50c5..99da62ca06 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockSelectionContext.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockSelectionContext.java @@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.blockcreation.txselection; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.GasLimitCalculator; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; import org.hyperledger.besu.ethereum.mainnet.blockhash.BlockHashProcessor; @@ -25,7 +25,7 @@ import org.hyperledger.besu.ethereum.mainnet.feemarket.FeeMarket; import org.hyperledger.besu.evm.gascalculator.GasCalculator; public record BlockSelectionContext( - MiningParameters miningParameters, + MiningConfiguration miningConfiguration, GasCalculator gasCalculator, GasLimitCalculator gasLimitCalculator, BlockHashProcessor blockHashProcessor, diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java index 5370d2ec46..a9b57a697a 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/BlockTransactionSelector.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.blockcreation.txselection.selectors.MinPrio import org.hyperledger.besu.ethereum.blockcreation.txselection.selectors.PriceTransactionSelector; import org.hyperledger.besu.ethereum.blockcreation.txselection.selectors.ProcessingResultTransactionSelector; import org.hyperledger.besu.ethereum.chain.Blockchain; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; import org.hyperledger.besu.ethereum.core.Transaction; @@ -108,7 +108,7 @@ public class BlockTransactionSelector { private volatile TransactionEvaluationContext currTxEvaluationContext; public BlockTransactionSelector( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final MainnetTransactionProcessor transactionProcessor, final Blockchain blockchain, final MutableWorldState worldState, @@ -132,7 +132,7 @@ public class BlockTransactionSelector { this.ethScheduler = ethScheduler; this.blockSelectionContext = new BlockSelectionContext( - miningParameters, + miningConfiguration, gasCalculator, gasLimitCalculator, blockHashProcessor, @@ -146,7 +146,7 @@ public class BlockTransactionSelector { this.operationTracer = new InterruptibleOperationTracer(pluginTransactionSelector.getOperationTracer()); blockWorldStateUpdater = worldState.updater(); - blockTxsSelectionMaxTime = miningParameters.getBlockTxsSelectionMaxTime(); + blockTxsSelectionMaxTime = miningConfiguration.getBlockTxsSelectionMaxTime(); } private List createTransactionSelectors( @@ -315,7 +315,7 @@ public class BlockTransactionSelector { pendingTransaction, Stopwatch.createStarted(), transactionGasPriceInBlock, - blockSelectionContext.miningParameters().getMinTransactionGasPrice()); + blockSelectionContext.miningConfiguration().getMinTransactionGasPrice()); } /** diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/BlockSizeTransactionSelector.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/BlockSizeTransactionSelector.java index 2877c4ce13..0da2b1386d 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/BlockSizeTransactionSelector.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/BlockSizeTransactionSelector.java @@ -112,13 +112,13 @@ public class BlockSizeTransactionSelector extends AbstractTransactionSelector { LOG.trace( "Min block occupancy ratio {}, gas used {}, available {}, remaining {}, used/available {}", - context.miningParameters().getMinBlockOccupancyRatio(), + context.miningConfiguration().getMinBlockOccupancyRatio(), gasUsed, gasAvailable, gasRemaining, occupancyRatio); - return occupancyRatio >= context.miningParameters().getMinBlockOccupancyRatio(); + return occupancyRatio >= context.miningConfiguration().getMinBlockOccupancyRatio(); } /** diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/MinPriorityFeePerGasTransactionSelector.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/MinPriorityFeePerGasTransactionSelector.java index 5783c7e500..c6dae8a144 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/MinPriorityFeePerGasTransactionSelector.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/MinPriorityFeePerGasTransactionSelector.java @@ -69,7 +69,7 @@ public class MinPriorityFeePerGasTransactionSelector extends AbstractTransaction pendingTransaction .getTransaction() .getEffectivePriorityFeePerGas(context.pendingBlockHeader().getBaseFee()); - return priorityFeePerGas.lessThan(context.miningParameters().getMinPriorityFeePerGas()); + return priorityFeePerGas.lessThan(context.miningConfiguration().getMinPriorityFeePerGas()); } /** diff --git a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/PriceTransactionSelector.java b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/PriceTransactionSelector.java index 707b1c4863..d3c3047f68 100644 --- a/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/PriceTransactionSelector.java +++ b/ethereum/blockcreation/src/main/java/org/hyperledger/besu/ethereum/blockcreation/txselection/selectors/PriceTransactionSelector.java @@ -76,7 +76,7 @@ public class PriceTransactionSelector extends AbstractTransactionSelector { if (!pendingTransaction.hasPriority()) { if (context - .miningParameters() + .miningConfiguration() .getMinTransactionGasPrice() .compareTo(evaluationContext.getTransactionGasPrice()) > 0) { @@ -86,7 +86,7 @@ public class PriceTransactionSelector extends AbstractTransactionSelector { .addArgument(pendingTransaction::toTraceLog) .addArgument(evaluationContext.getTransactionGasPrice()::toHumanReadableString) .addArgument( - context.miningParameters().getMinTransactionGasPrice()::toHumanReadableString) + context.miningConfiguration().getMinTransactionGasPrice()::toHumanReadableString) .log(); return true; } diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java index 727cfd440f..b70c48ad02 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/AbstractBlockCreatorTest.java @@ -47,9 +47,9 @@ import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Request; import org.hyperledger.besu.ethereum.core.SealableBlockHeader; @@ -309,7 +309,7 @@ abstract class AbstractBlockCreatorTest { PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) @@ -342,8 +342,8 @@ abstract class AbstractBlockCreatorTest { new BlobCache()); transactionPool.setEnabled(); - final MiningParameters miningParameters = - ImmutableMiningParameters.builder() + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .extraData(Bytes.fromHexString("deadbeef")) @@ -355,7 +355,7 @@ abstract class AbstractBlockCreatorTest { return new CreateOn( new TestBlockCreator( - miningParameters, + miningConfiguration, __ -> Address.ZERO, __ -> Bytes.fromHexString("deadbeef"), transactionPool, @@ -368,7 +368,7 @@ abstract class AbstractBlockCreatorTest { static class TestBlockCreator extends AbstractBlockCreator { protected TestBlockCreator( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final MiningBeneficiaryCalculator miningBeneficiaryCalculator, final ExtraDataCalculator extraDataCalculator, final TransactionPool transactionPool, @@ -376,7 +376,7 @@ abstract class AbstractBlockCreatorTest { final ProtocolSchedule protocolSchedule, final EthScheduler ethScheduler) { super( - miningParameters, + miningConfiguration, miningBeneficiaryCalculator, extraDataCalculator, transactionPool, 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 6eb03ece94..2787189ece 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 @@ -18,7 +18,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; import static org.awaitility.Awaitility.await; -import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME; import static org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason.EXECUTION_INTERRUPTED; import static org.hyperledger.besu.ethereum.transaction.TransactionInvalidReason.NONCE_TOO_LOW; import static org.hyperledger.besu.plugin.data.TransactionSelectionResult.BLOCK_SELECTION_TIMEOUT; @@ -55,10 +55,10 @@ import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; import org.hyperledger.besu.ethereum.core.Transaction; @@ -138,7 +138,7 @@ public abstract class AbstractBlockTransactionSelectorTest { protected MutableWorldState worldState; protected ProtocolSchedule protocolSchedule; protected TransactionSelectionService transactionSelectionService; - protected MiningParameters defaultTestMiningParameters; + protected MiningConfiguration defaultTestMiningConfiguration; @Mock protected EthScheduler ethScheduler; @@ -155,7 +155,7 @@ public abstract class AbstractBlockTransactionSelectorTest { genesisConfigFile = getGenesisConfigFile(); protocolSchedule = createProtocolSchedule(); transactionSelectionService = new TransactionSelectionServiceImpl(); - defaultTestMiningParameters = + defaultTestMiningConfiguration = createMiningParameters( transactionSelectionService, Wei.ZERO, @@ -234,7 +234,7 @@ public abstract class AbstractBlockTransactionSelectorTest { FixedDifficultyProtocolSchedule.create( GenesisConfigFile.fromResource("/dev.json").getConfigOptions(), EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -248,7 +248,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, mainnetTransactionProcessor, blockHeader, miningBeneficiary, @@ -269,7 +269,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -296,7 +296,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -336,7 +336,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -377,7 +377,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -412,7 +412,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -568,7 +568,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -643,7 +643,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -757,7 +757,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, createBlock(300_000), AddressHelpers.ofValue(1), @@ -793,7 +793,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -824,12 +824,12 @@ public abstract class AbstractBlockTransactionSelectorTest { final Address miningBeneficiary = AddressHelpers.ofValue(1); - final MiningParameters miningParameters = - ImmutableMiningParameters.builder().from(defaultTestMiningParameters).build(); + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder().from(defaultTestMiningConfiguration).build(); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - miningParameters, + miningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -841,7 +841,7 @@ public abstract class AbstractBlockTransactionSelectorTest { ensureTransactionIsValid(transaction, 0, 5); // raise the minGasPrice at runtime from 1 wei to 10 wei - miningParameters.setMinTransactionGasPrice(Wei.of(10)); + miningConfiguration.setMinTransactionGasPrice(Wei.of(10)); final TransactionSelectionResults results = selector.buildTransactionListForBlock(); @@ -857,15 +857,15 @@ public abstract class AbstractBlockTransactionSelectorTest { @Test public void decreaseOfMinGasPriceAtRuntimeIncludeTxThatWasPreviouslyNotSelected() { final Transaction transaction = createTransaction(0, Wei.of(7L), 100_000); - final MiningParameters miningParameters = - ImmutableMiningParameters.builder().from(defaultTestMiningParameters).build(); + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder().from(defaultTestMiningConfiguration).build(); final ProcessableBlockHeader blockHeader = createBlock(500_000); final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector1 = createBlockSelectorAndSetupTxPool( - miningParameters, + miningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -876,7 +876,7 @@ public abstract class AbstractBlockTransactionSelectorTest { ensureTransactionIsValid(transaction, 0, 5); // raise the minGasPrice at runtime from 1 wei to 10 wei - miningParameters.setMinTransactionGasPrice(Wei.of(10)); + miningConfiguration.setMinTransactionGasPrice(Wei.of(10)); final TransactionSelectionResults results1 = selector1.buildTransactionListForBlock(); @@ -889,11 +889,11 @@ public abstract class AbstractBlockTransactionSelectorTest { .containsOnly(transaction); // decrease the minGasPrice at runtime from 10 wei to 5 wei - miningParameters.setMinTransactionGasPrice(Wei.of(5)); + miningConfiguration.setMinTransactionGasPrice(Wei.of(5)); final BlockTransactionSelector selector2 = createBlockSelector( - miningParameters, + miningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -910,9 +910,9 @@ public abstract class AbstractBlockTransactionSelectorTest { @Test public void shouldNotSelectTransactionsWithPriorityFeeLessThanConfig() { ProcessableBlockHeader blockHeader = createBlock(5_000_000, Wei.ONE); - final MiningParameters miningParameters = - ImmutableMiningParameters.builder().from(defaultTestMiningParameters).build(); - miningParameters.setMinPriorityFeePerGas(Wei.of(7)); + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder().from(defaultTestMiningConfiguration).build(); + miningConfiguration.setMinPriorityFeePerGas(Wei.of(7)); final Transaction txSelected = createTransaction(1, Wei.of(8), 100_000); ensureTransactionIsValid(txSelected); // transaction txNotSelected should not be selected @@ -921,7 +921,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - miningParameters, + miningConfiguration, transactionProcessor, blockHeader, AddressHelpers.ofValue(1), @@ -1259,7 +1259,7 @@ public abstract class AbstractBlockTransactionSelectorTest { } protected BlockTransactionSelector createBlockSelectorAndSetupTxPool( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final MainnetTransactionProcessor transactionProcessor, final ProcessableBlockHeader blockHeader, final Address miningBeneficiary, @@ -1269,7 +1269,7 @@ public abstract class AbstractBlockTransactionSelectorTest { transactionPool = createTransactionPool(); return createBlockSelector( - miningParameters, + miningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -1278,7 +1278,7 @@ public abstract class AbstractBlockTransactionSelectorTest { } protected BlockTransactionSelector createBlockSelector( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final MainnetTransactionProcessor transactionProcessor, final ProcessableBlockHeader blockHeader, final Address miningBeneficiary, @@ -1287,7 +1287,7 @@ public abstract class AbstractBlockTransactionSelectorTest { final BlockTransactionSelector selector = new BlockTransactionSelector( - miningParameters, + miningConfiguration, transactionProcessor, blockchain, worldState, @@ -1423,12 +1423,12 @@ public abstract class AbstractBlockTransactionSelectorTest { return new BlockHeaderTestFixture().number(number).buildHeader(); } - protected MiningParameters createMiningParameters( + protected MiningConfiguration createMiningParameters( final TransactionSelectionService transactionSelectionService, final Wei minGasPrice, final double minBlockOccupancyRatio, final PositiveNumber txsSelectionMaxTime) { - return ImmutableMiningParameters.builder() + return ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .minTransactionGasPrice(minGasPrice) @@ -1439,13 +1439,13 @@ public abstract class AbstractBlockTransactionSelectorTest { .build(); } - protected MiningParameters createMiningParameters( + protected MiningConfiguration createMiningParameters( final TransactionSelectionService transactionSelectionService, final Wei minGasPrice, final double minBlockOccupancyRatio, final int genesisBlockPeriodSeconds, final PositiveNumber minBlockTimePercentage) { - return ImmutableMiningParameters.builder() + return ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .minTransactionGasPrice(minGasPrice) diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LegacyFeeMarketBlockTransactionSelectorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LegacyFeeMarketBlockTransactionSelectorTest.java index 731b8b3854..327d4bd37d 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LegacyFeeMarketBlockTransactionSelectorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/LegacyFeeMarketBlockTransactionSelectorTest.java @@ -22,7 +22,7 @@ import static org.mockito.Mockito.when; import org.hyperledger.besu.config.GenesisConfigFile; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; @@ -62,7 +62,7 @@ public class LegacyFeeMarketBlockTransactionSelectorTest new PrivacyParameters(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) 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 3bb559550b..62eaf713c5 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 @@ -16,7 +16,7 @@ package org.hyperledger.besu.ethereum.blockcreation; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.entry; -import static org.hyperledger.besu.ethereum.core.MiningParameters.DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME; import static org.mockito.Mockito.mock; import org.hyperledger.besu.config.GenesisConfigFile; @@ -26,8 +26,8 @@ import org.hyperledger.besu.ethereum.blockcreation.txselection.BlockTransactionS import org.hyperledger.besu.ethereum.blockcreation.txselection.TransactionSelectionResults; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.AddressHelpers; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; import org.hyperledger.besu.ethereum.core.Transaction; @@ -73,7 +73,7 @@ public class LondonFeeMarketBlockTransactionSelectorTest new PrivacyParameters(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) @@ -222,7 +222,7 @@ public class LondonFeeMarketBlockTransactionSelectorTest final Address miningBeneficiary = AddressHelpers.ofValue(1); final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - defaultTestMiningParameters, + defaultTestMiningConfiguration, transactionProcessor, blockHeader, miningBeneficiary, @@ -242,9 +242,9 @@ public class LondonFeeMarketBlockTransactionSelectorTest @Override public void shouldNotSelectTransactionsWithPriorityFeeLessThanConfig() { ProcessableBlockHeader blockHeader = createBlock(5_000_000, Wei.ONE); - final MiningParameters miningParameters = - ImmutableMiningParameters.builder().from(defaultTestMiningParameters).build(); - miningParameters.setMinPriorityFeePerGas(Wei.of(7)); + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder().from(defaultTestMiningConfiguration).build(); + miningConfiguration.setMinPriorityFeePerGas(Wei.of(7)); final Transaction txSelected1 = createEIP1559Transaction(1, Wei.of(8), Wei.of(8), 100_000); ensureTransactionIsValid(txSelected1); @@ -263,7 +263,7 @@ public class LondonFeeMarketBlockTransactionSelectorTest final BlockTransactionSelector selector = createBlockSelectorAndSetupTxPool( - miningParameters, + miningConfiguration, transactionProcessor, blockHeader, AddressHelpers.ofValue(1), 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 6f81f4df2c..29cea9d089 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 @@ -24,7 +24,7 @@ import org.hyperledger.besu.ethereum.blockcreation.txselection.BlockSelectionCon import org.hyperledger.besu.ethereum.blockcreation.txselection.TransactionEvaluationContext; import org.hyperledger.besu.ethereum.blockcreation.txselection.selectors.AbstractTransactionSelector; import org.hyperledger.besu.ethereum.blockcreation.txselection.selectors.MinPriorityFeePerGasTransactionSelector; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction; @@ -46,11 +46,11 @@ public class MinPriorityFeePerGasTransactionSelectorTest { @BeforeEach public void initialize() { - MiningParameters miningParameters = - MiningParameters.newDefault().setMinPriorityFeePerGas(Wei.of(minPriorityFeeParameter)); + MiningConfiguration miningConfiguration = + MiningConfiguration.newDefault().setMinPriorityFeePerGas(Wei.of(minPriorityFeeParameter)); BlockSelectionContext context = new BlockSelectionContext( - miningParameters, null, null, null, pendingBlockHeader, null, null, null, null); + miningConfiguration, null, null, null, pendingBlockHeader, null, null, null, null); transactionSelector = new MinPriorityFeePerGasTransactionSelector(context); } diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreatorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreatorTest.java index 8e7f992ad5..e8b9baa0a7 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreatorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWBlockCreatorTest.java @@ -31,9 +31,9 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.ProcessableBlockHeader; @@ -87,7 +87,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { void createMainnetBlock1() throws IOException { final var genesisConfigFile = GenesisConfigFile.mainnet(); - final MiningParameters miningParameters = createMiningParameters(BLOCK_1_NONCE); + final MiningConfiguration miningConfiguration = createMiningParameters(BLOCK_1_NONCE); final ExecutionContextTestFixture executionContextTestFixture = ExecutionContextTestFixture.builder(genesisConfigFile) @@ -99,7 +99,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) @@ -108,7 +108,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final PoWSolver solver = new PoWSolver( - miningParameters, + miningConfiguration, PoWHasher.ETHASH_LIGHT, false, Subscribers.none(), @@ -118,7 +118,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final PoWBlockCreator blockCreator = new PoWBlockCreator( - miningParameters, + miningConfiguration, parent -> BLOCK_1_EXTRA_DATA, transactionPool, executionContextTestFixture.getProtocolContext(), @@ -146,7 +146,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final var genesisConfigFile = GenesisConfigFile.fromResource("/block-creation-fixed-difficulty-genesis.json"); - final MiningParameters miningParameters = createMiningParameters(FIXED_DIFFICULTY_NONCE); + final MiningConfiguration miningConfiguration = createMiningParameters(FIXED_DIFFICULTY_NONCE); final ExecutionContextTestFixture executionContextTestFixture = ExecutionContextTestFixture.builder(genesisConfigFile) @@ -163,7 +163,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) @@ -172,7 +172,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final PoWSolver solver = new PoWSolver( - miningParameters, + miningConfiguration, PoWHasher.ETHASH_LIGHT, false, Subscribers.none(), @@ -182,7 +182,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final PoWBlockCreator blockCreator = new PoWBlockCreator( - miningParameters, + miningConfiguration, parent -> BLOCK_1_EXTRA_DATA, transactionPool, executionContextTestFixture.getProtocolContext(), @@ -204,7 +204,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final var genesisConfigFile = GenesisConfigFile.fromResource("/block-creation-fixed-difficulty-genesis.json"); - final MiningParameters miningParameters = createMiningParameters(FIXED_DIFFICULTY_NONCE); + final MiningConfiguration miningConfiguration = createMiningParameters(FIXED_DIFFICULTY_NONCE); ProtocolSchedule protocolSchedule = new ProtocolScheduleBuilder( @@ -219,7 +219,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) @@ -231,7 +231,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final PoWSolver solver = new PoWSolver( - miningParameters, + miningConfiguration, PoWHasher.ETHASH_LIGHT, false, Subscribers.none(), @@ -241,7 +241,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final PoWBlockCreator blockCreator = new PoWBlockCreator( - miningParameters, + miningConfiguration, parent -> BLOCK_1_EXTRA_DATA, transactionPool, executionContextTestFixture.getProtocolContext(), @@ -281,7 +281,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final var genesisConfigFile = GenesisConfigFile.fromResource("/block-creation-fixed-difficulty-genesis.json"); - final MiningParameters miningParameters = createMiningParameters(FIXED_DIFFICULTY_NONCE); + final MiningConfiguration miningConfiguration = createMiningParameters(FIXED_DIFFICULTY_NONCE); ProtocolSchedule protocolSchedule = new ProtocolScheduleBuilder( @@ -296,7 +296,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) @@ -308,7 +308,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final PoWSolver solver = new PoWSolver( - miningParameters, + miningConfiguration, PoWHasher.ETHASH_LIGHT, false, Subscribers.none(), @@ -318,7 +318,7 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { final PoWBlockCreator blockCreator = new PoWBlockCreator( - miningParameters, + miningConfiguration, parent -> BLOCK_1_EXTRA_DATA, transactionPool, executionContextTestFixture.getProtocolContext(), @@ -382,8 +382,8 @@ class PoWBlockCreatorTest extends AbstractBlockCreatorTest { return transactionPool; } - private MiningParameters createMiningParameters(final long nonce) { - return ImmutableMiningParameters.builder() + private MiningConfiguration createMiningParameters(final long nonce) { + return ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .nonceGenerator(Lists.newArrayList(nonce)) diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutorTest.java index 8c1e217d75..14e6b54374 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWMinerExecutorTest.java @@ -22,7 +22,7 @@ import static org.mockito.Mockito.when; import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; @@ -51,7 +51,7 @@ public class PoWMinerExecutorTest { @Test public void startingMiningWithoutCoinbaseThrowsException() { - final MiningParameters miningParameters = MiningParameters.newDefault(); + final MiningConfiguration miningConfiguration = MiningConfiguration.newDefault(); final TransactionPool transactionPool = createTransactionPool(); @@ -60,7 +60,7 @@ public class PoWMinerExecutorTest { null, null, transactionPool, - miningParameters, + miningConfiguration, new DefaultBlockScheduler(1L, 10, TestClock.fixed()), new EpochCalculator.DefaultEpochCalculator(), ethScheduler); @@ -72,7 +72,7 @@ public class PoWMinerExecutorTest { @Test public void settingCoinbaseToNullThrowsException() { - final MiningParameters miningParameters = MiningParameters.newDefault(); + final MiningConfiguration miningConfiguration = MiningConfiguration.newDefault(); final TransactionPool transactionPool = createTransactionPool(); @@ -81,7 +81,7 @@ public class PoWMinerExecutorTest { null, null, transactionPool, - miningParameters, + miningConfiguration, new DefaultBlockScheduler(1, 10, TestClock.fixed()), new EpochCalculator.DefaultEpochCalculator(), ethScheduler); diff --git a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWMiningCoordinatorTest.java b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWMiningCoordinatorTest.java index 6efd63fbae..6dd272473f 100644 --- a/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWMiningCoordinatorTest.java +++ b/ethereum/blockcreation/src/test/java/org/hyperledger/besu/ethereum/blockcreation/PoWMiningCoordinatorTest.java @@ -15,8 +15,8 @@ package org.hyperledger.besu.ethereum.blockcreation; import static org.assertj.core.api.Assertions.assertThat; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_REMOTE_SEALERS_LIMIT; -import static org.hyperledger.besu.ethereum.core.MiningParameters.Unstable.DEFAULT_REMOTE_SEALERS_TTL; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_REMOTE_SEALERS_LIMIT; +import static org.hyperledger.besu.ethereum.core.MiningConfiguration.Unstable.DEFAULT_REMOTE_SEALERS_TTL; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/components/ProtocolScheduleModule.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/components/ProtocolScheduleModule.java index 039747db0b..98575272c7 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/components/ProtocolScheduleModule.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/components/ProtocolScheduleModule.java @@ -16,7 +16,7 @@ package org.hyperledger.besu.ethereum.components; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; @@ -50,7 +50,7 @@ public class ProtocolScheduleModule { * @param badBlockManager the bad block manager * @param isParallelTxProcessingEnabled whether parallel tx processing is enabled * @param metricsSystem the metrics system - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @return the protocol schedule builder */ @Singleton @@ -64,7 +64,7 @@ public class ProtocolScheduleModule { final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { ProtocolScheduleBuilder builder = new ProtocolScheduleBuilder( @@ -74,7 +74,7 @@ public class ProtocolScheduleModule { privacyParameters, isRevertReasonEnabled, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningParameters.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningConfiguration.java similarity index 88% rename from ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningParameters.java rename to ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningConfiguration.java index 1921b3568b..fb39d164b7 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningParameters.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningConfiguration.java @@ -34,27 +34,29 @@ import org.immutables.value.Value; @Value.Immutable @Value.Enclosing -public abstract class MiningParameters { +public abstract class MiningConfiguration { public static final PositiveNumber DEFAULT_NON_POA_BLOCK_TXS_SELECTION_MAX_TIME = PositiveNumber.fromInt((int) Duration.ofSeconds(5).toMillis()); public static final PositiveNumber DEFAULT_POA_BLOCK_TXS_SELECTION_MAX_TIME = PositiveNumber.fromInt(75); - public static final MiningParameters MINING_DISABLED = - ImmutableMiningParameters.builder() + public static final MiningConfiguration MINING_DISABLED = + ImmutableMiningConfiguration.builder() .mutableInitValues( - ImmutableMiningParameters.MutableInitValues.builder().isMiningEnabled(false).build()) + ImmutableMiningConfiguration.MutableInitValues.builder() + .isMiningEnabled(false) + .build()) .build(); @VisibleForTesting - public static final MiningParameters newDefault() { - return ImmutableMiningParameters.builder().build(); + public static final MiningConfiguration newDefault() { + return ImmutableMiningConfiguration.builder().build(); } public boolean isMiningEnabled() { return getMutableRuntimeValues().miningEnabled; } - public MiningParameters setMiningEnabled(final boolean miningEnabled) { + public MiningConfiguration setMiningEnabled(final boolean miningEnabled) { getMutableRuntimeValues().miningEnabled = miningEnabled; return this; } @@ -63,7 +65,7 @@ public abstract class MiningParameters { return getMutableRuntimeValues().extraData; } - public MiningParameters setExtraData(final Bytes extraData) { + public MiningConfiguration setExtraData(final Bytes extraData) { getMutableRuntimeValues().extraData = extraData; return this; } @@ -72,7 +74,7 @@ public abstract class MiningParameters { return getMutableRuntimeValues().minTransactionGasPrice; } - public MiningParameters setMinTransactionGasPrice(final Wei minTransactionGasPrice) { + public MiningConfiguration setMinTransactionGasPrice(final Wei minTransactionGasPrice) { getMutableRuntimeValues().minTransactionGasPrice = minTransactionGasPrice; return this; } @@ -81,7 +83,7 @@ public abstract class MiningParameters { return getMutableRuntimeValues().minPriorityFeePerGas; } - public MiningParameters setMinPriorityFeePerGas(final Wei minPriorityFeePerGas) { + public MiningConfiguration setMinPriorityFeePerGas(final Wei minPriorityFeePerGas) { getMutableRuntimeValues().minPriorityFeePerGas = minPriorityFeePerGas; return this; } @@ -90,7 +92,7 @@ public abstract class MiningParameters { return getMutableRuntimeValues().coinbase; } - public MiningParameters setCoinbase(final Address coinbase) { + public MiningConfiguration setCoinbase(final Address coinbase) { getMutableRuntimeValues().coinbase = Optional.of(coinbase); return this; } @@ -99,7 +101,7 @@ public abstract class MiningParameters { return getMutableRuntimeValues().targetGasLimit; } - public MiningParameters setTargetGasLimit(final long targetGasLimit) { + public MiningConfiguration setTargetGasLimit(final long targetGasLimit) { getMutableRuntimeValues().targetGasLimit = OptionalLong.of(targetGasLimit); return this; } @@ -108,7 +110,7 @@ public abstract class MiningParameters { return getMutableRuntimeValues().minBlockOccupancyRatio; } - public MiningParameters setMinBlockOccupancyRatio(final double minBlockOccupancyRatio) { + public MiningConfiguration setMinBlockOccupancyRatio(final double minBlockOccupancyRatio) { getMutableRuntimeValues().minBlockOccupancyRatio = minBlockOccupancyRatio; return this; } @@ -117,7 +119,7 @@ public abstract class MiningParameters { return getMutableRuntimeValues().nonceGenerator; } - public MiningParameters setNonceGenerator(final Iterable nonceGenerator) { + public MiningConfiguration setNonceGenerator(final Iterable nonceGenerator) { getMutableRuntimeValues().nonceGenerator = Optional.of(nonceGenerator); return this; } @@ -126,12 +128,12 @@ public abstract class MiningParameters { return getMutableRuntimeValues().blockPeriodSeconds; } - public MiningParameters setBlockPeriodSeconds(final int blockPeriodSeconds) { + public MiningConfiguration setBlockPeriodSeconds(final int blockPeriodSeconds) { getMutableRuntimeValues().blockPeriodSeconds = OptionalInt.of(blockPeriodSeconds); return this; } - public MiningParameters setEmptyBlockPeriodSeconds(final int emptyBlockPeriodSeconds) { + public MiningConfiguration setEmptyBlockPeriodSeconds(final int emptyBlockPeriodSeconds) { getMutableRuntimeValues().emptyBlockPeriodSeconds = OptionalInt.of(emptyBlockPeriodSeconds); return this; } @@ -207,7 +209,7 @@ public abstract class MiningParameters { Wei DEFAULT_MIN_PRIORITY_FEE_PER_GAS = Wei.ZERO; double DEFAULT_MIN_BLOCK_OCCUPANCY_RATIO = 0.8; - MutableInitValues DEFAULT = ImmutableMiningParameters.MutableInitValues.builder().build(); + MutableInitValues DEFAULT = ImmutableMiningConfiguration.MutableInitValues.builder().build(); @Value.Default default boolean isMiningEnabled() { @@ -335,7 +337,7 @@ public abstract class MiningParameters { long DEFAULT_POS_BLOCK_CREATION_MAX_TIME = Duration.ofSeconds(12).toMillis(); long DEFAULT_POS_BLOCK_CREATION_REPETITION_MIN_DURATION = Duration.ofMillis(500).toMillis(); - MiningParameters.Unstable DEFAULT = ImmutableMiningParameters.Unstable.builder().build(); + MiningConfiguration.Unstable DEFAULT = ImmutableMiningConfiguration.Unstable.builder().build(); @Value.Default default int getRemoteSealersLimit() { diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningParametersMetrics.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningParametersMetrics.java index 3b3e3a28dc..8be0b621a3 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningParametersMetrics.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/MiningParametersMetrics.java @@ -22,18 +22,18 @@ public class MiningParametersMetrics { public static final String MIN_PRIORITY_FEE_GAUGE = "min_priority_fee"; public MiningParametersMetrics( - final MetricsSystem metricsSystem, final MiningParameters miningParameters) { + final MetricsSystem metricsSystem, final MiningConfiguration miningConfiguration) { metricsSystem.createGauge( BesuMetricCategory.ETHEREUM, MIN_GAS_PRICE_GAUGE, "Gauge to measure the runtime value of min-gas-price", - () -> miningParameters.getMinTransactionGasPrice().toBigInteger().doubleValue()); + () -> miningConfiguration.getMinTransactionGasPrice().toBigInteger().doubleValue()); metricsSystem.createGauge( BesuMetricCategory.ETHEREUM, MIN_PRIORITY_FEE_GAUGE, "Gauge to measure the runtime value of min-priority-fee", - () -> miningParameters.getMinPriorityFeePerGas().toBigInteger().doubleValue()); + () -> miningConfiguration.getMinPriorityFeePerGas().toBigInteger().doubleValue()); } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/components/EthereumCoreComponent.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/components/EthereumCoreComponent.java index 2b081399a9..84de2cef5d 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/components/EthereumCoreComponent.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/components/EthereumCoreComponent.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.ethereum.core.components; import org.hyperledger.besu.ethereum.components.ProtocolScheduleModule; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import javax.inject.Singleton; @@ -28,5 +28,5 @@ import dagger.Subcomponent; ProtocolScheduleModule.class, }) public interface EthereumCoreComponent { - MiningParameters getMiningParameters(); + MiningConfiguration getMiningParameters(); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/components/MiningParametersModule.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/components/MiningParametersModule.java index 8551d0e946..7a36e4d81a 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/components/MiningParametersModule.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/core/components/MiningParametersModule.java @@ -16,8 +16,8 @@ package org.hyperledger.besu.ethereum.core.components; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.Wei; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import javax.inject.Named; @@ -29,36 +29,36 @@ public class MiningParametersModule { @Provides @Named("defaultMiningParameters") - protected MiningParameters createImmutableMiningParams() { - return ImmutableMiningParameters.builder().build(); + protected MiningConfiguration createImmutableMiningParams() { + return ImmutableMiningConfiguration.builder().build(); } @Provides @Named("noMining") - protected MiningParameters createNoMining() { - return ImmutableMiningParameters.builder() + protected MiningConfiguration createNoMining() { + return ImmutableMiningConfiguration.builder() .mutableInitValues( - ImmutableMiningParameters.MutableInitValues.builder().isMiningEnabled(false).build()) + ImmutableMiningConfiguration.MutableInitValues.builder().isMiningEnabled(false).build()) .build(); } @Provides @Named("zeroGas") - MiningParameters createZeroGasMining(final @Named("emptyCoinbase") Address coinbase) { - final MiningParameters miningParameters = - ImmutableMiningParameters.builder() + MiningConfiguration createZeroGasMining(final @Named("emptyCoinbase") Address coinbase) { + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues( - ImmutableMiningParameters.MutableInitValues.builder() + ImmutableMiningConfiguration.MutableInitValues.builder() .isMiningEnabled(true) .minTransactionGasPrice(Wei.ZERO) .coinbase(coinbase) .build()) .build(); - return miningParameters; + return miningConfiguration; } @Provides - MiningParameters provideMiningParameters() { + MiningConfiguration provideMiningParameters() { throw new IllegalStateException("unimplemented"); } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedDifficultyProtocolSchedule.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedDifficultyProtocolSchedule.java index 4290679bae..09ca09ff6a 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedDifficultyProtocolSchedule.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedDifficultyProtocolSchedule.java @@ -16,7 +16,7 @@ package org.hyperledger.besu.ethereum.difficulty.fixed; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolScheduleBuilder; @@ -37,7 +37,7 @@ public class FixedDifficultyProtocolSchedule { final PrivacyParameters privacyParameters, final boolean isRevertReasonEnabled, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -51,7 +51,7 @@ public class FixedDifficultyProtocolSchedule { privacyParameters, isRevertReasonEnabled, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem) @@ -62,7 +62,7 @@ public class FixedDifficultyProtocolSchedule { final GenesisConfigOptions config, final boolean isRevertReasonEnabled, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -71,7 +71,7 @@ public class FixedDifficultyProtocolSchedule { PrivacyParameters.DEFAULT, isRevertReasonEnabled, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -80,7 +80,7 @@ public class FixedDifficultyProtocolSchedule { public static ProtocolSchedule create( final GenesisConfigOptions config, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -89,7 +89,7 @@ public class FixedDifficultyProtocolSchedule { PrivacyParameters.DEFAULT, false, evmConfiguration, - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java index e6c372a682..9528e2dfb8 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSchedule.java @@ -16,7 +16,7 @@ package org.hyperledger.besu.ethereum.mainnet; import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyCalculators; import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule; @@ -40,7 +40,7 @@ public class MainnetProtocolSchedule { * @param privacyParameters the parameters set for private transactions * @param isRevertReasonEnabled whether storing the revert reason is for failed transactions * @param evmConfiguration how to configure the EVMs jumpdest cache - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled * @param metricsSystem A metricSystem instance to expose metrics in the underlying calls @@ -51,7 +51,7 @@ public class MainnetProtocolSchedule { final Optional privacyParameters, final Optional isRevertReasonEnabled, final Optional evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -61,7 +61,7 @@ public class MainnetProtocolSchedule { privacyParameters.orElse(PrivacyParameters.DEFAULT), isRevertReasonEnabled.orElse(false), evmConfiguration.orElse(EvmConfiguration.DEFAULT), - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -73,7 +73,7 @@ public class MainnetProtocolSchedule { privacyParameters.orElse(PrivacyParameters.DEFAULT), isRevertReasonEnabled.orElse(false), evmConfiguration.orElse(EvmConfiguration.DEFAULT), - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem) @@ -87,7 +87,7 @@ public class MainnetProtocolSchedule { * starting points * @param isRevertReasonEnabled whether storing the revert reason is for failed transactions * @param evmConfiguration how to configure the EVMs jumpdest cache - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @return A configured mainnet protocol schedule @@ -96,7 +96,7 @@ public class MainnetProtocolSchedule { final GenesisConfigOptions config, final boolean isRevertReasonEnabled, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -105,7 +105,7 @@ public class MainnetProtocolSchedule { Optional.empty(), Optional.of(isRevertReasonEnabled), Optional.of(evmConfiguration), - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -117,7 +117,7 @@ public class MainnetProtocolSchedule { * @param config {@link GenesisConfigOptions} containing the config options for the milestone * starting points * @param evmConfiguration size of - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @return A configured mainnet protocol schedule @@ -125,7 +125,7 @@ public class MainnetProtocolSchedule { public static ProtocolSchedule fromConfig( final GenesisConfigOptions config, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -134,7 +134,7 @@ public class MainnetProtocolSchedule { Optional.empty(), Optional.empty(), Optional.of(evmConfiguration), - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); @@ -145,14 +145,14 @@ public class MainnetProtocolSchedule { * * @param config {@link GenesisConfigOptions} containing the config options for the milestone * starting points - * @param miningParameters the mining parameters + * @param miningConfiguration the mining parameters * @param badBlockManager the cache to use to keep invalid blocks * @param isParallelTxProcessingEnabled indicates whether parallel transaction is enabled. * @return A configured mainnet protocol schedule */ public static ProtocolSchedule fromConfig( final GenesisConfigOptions config, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -161,7 +161,7 @@ public class MainnetProtocolSchedule { Optional.empty(), Optional.empty(), Optional.empty(), - miningParameters, + miningConfiguration, badBlockManager, isParallelTxProcessingEnabled, metricsSystem); diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java index 615a476251..770175e646 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecFactory.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.ethereum.mainnet; import org.hyperledger.besu.config.GenesisConfigOptions; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.plugin.services.MetricsSystem; @@ -29,7 +29,7 @@ public class MainnetProtocolSpecFactory { private final boolean isRevertReasonEnabled; private final OptionalLong ecip1017EraRounds; private final EvmConfiguration evmConfiguration; - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; private final boolean isParallelTxProcessingEnabled; private final MetricsSystem metricsSystem; @@ -38,14 +38,14 @@ public class MainnetProtocolSpecFactory { final boolean isRevertReasonEnabled, final OptionalLong ecip1017EraRounds, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { this.chainId = chainId; this.isRevertReasonEnabled = isRevertReasonEnabled; this.ecip1017EraRounds = ecip1017EraRounds; this.evmConfiguration = evmConfiguration; - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; this.isParallelTxProcessingEnabled = isParallelTxProcessingEnabled; this.metricsSystem = metricsSystem; } @@ -140,7 +140,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -152,7 +152,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -164,7 +164,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -175,7 +175,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -186,7 +186,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -197,7 +197,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -208,7 +208,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -219,7 +219,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -230,7 +230,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -252,7 +252,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } @@ -274,7 +274,7 @@ public class MainnetProtocolSpecFactory { isRevertReasonEnabled, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java index 23908664f8..87396bff3e 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolSpecs.java @@ -25,7 +25,7 @@ import org.hyperledger.besu.ethereum.BlockProcessingResult; import org.hyperledger.besu.ethereum.MainnetBlockValidator; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; @@ -447,7 +447,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { final long londonForkBlockNumber = @@ -458,7 +458,7 @@ public abstract class MainnetProtocolSpecs { } else if (genesisConfigOptions.isFixedBaseFee()) { londonFeeMarket = FeeMarket.fixedBaseFee( - londonForkBlockNumber, miningParameters.getMinTransactionGasPrice()); + londonForkBlockNumber, miningConfiguration.getMinTransactionGasPrice()); } else { londonFeeMarket = FeeMarket.london(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas()); @@ -533,7 +533,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { return londonDefinition( @@ -541,7 +541,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem) .difficultyCalculator(MainnetDifficultyCalculators.ARROW_GLACIER) @@ -553,7 +553,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { return arrowGlacierDefinition( @@ -561,7 +561,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem) .difficultyCalculator(MainnetDifficultyCalculators.GRAY_GLACIER) @@ -573,7 +573,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -582,7 +582,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem) .evmBuilder( @@ -601,7 +601,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { return parisDefinition( @@ -609,7 +609,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem) // gas calculator has new code to support EIP-3860 limit and meter initcode @@ -660,7 +660,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { final long londonForkBlockNumber = genesisConfigOptions.getLondonBlockNumber().orElse(0L); @@ -670,7 +670,7 @@ public abstract class MainnetProtocolSpecs { } else if (genesisConfigOptions.isFixedBaseFee()) { cancunFeeMarket = FeeMarket.fixedBaseFee( - londonForkBlockNumber, miningParameters.getMinTransactionGasPrice()); + londonForkBlockNumber, miningConfiguration.getMinTransactionGasPrice()); } else { cancunFeeMarket = FeeMarket.cancun(londonForkBlockNumber, genesisConfigOptions.getBaseFeePerGas()); @@ -681,7 +681,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem) .feeMarket(cancunFeeMarket) @@ -741,7 +741,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -751,7 +751,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); return addEOF(chainId, evmConfiguration, protocolSpecBuilder).name("CancunEOF"); @@ -762,7 +762,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -774,7 +774,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem) // EIP-3074 AUTH and AUTCALL gas @@ -820,7 +820,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -830,7 +830,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); return addEOF(chainId, evmConfiguration, protocolSpecBuilder).name("Osaka"); @@ -863,7 +863,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { return osakaDefinition( @@ -871,7 +871,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem) // Use Future EIP configured EVM @@ -898,7 +898,7 @@ public abstract class MainnetProtocolSpecs { final boolean enableRevertReason, final GenesisConfigOptions genesisConfigOptions, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -907,7 +907,7 @@ public abstract class MainnetProtocolSpecs { enableRevertReason, genesisConfigOptions, evmConfiguration, - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem) .evmBuilder( diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PoWSolver.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PoWSolver.java index 3161490478..aafc61e71d 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PoWSolver.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/PoWSolver.java @@ -15,7 +15,7 @@ package org.hyperledger.besu.ethereum.mainnet; import org.hyperledger.besu.ethereum.chain.PoWObserver; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.util.Subscribers; import java.util.Optional; @@ -34,7 +34,7 @@ public class PoWSolver { private static final Logger LOG = LoggerFactory.getLogger(PoWSolver.class); - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; public static class PoWSolverJob { @@ -86,12 +86,12 @@ public class PoWSolver { private final ExpiringMap currentJobs = new ExpiringMap<>(); public PoWSolver( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final PoWHasher poWHasher, final Boolean stratumMiningEnabled, final Subscribers ethHashObservers, final EpochCalculator epochCalculator) { - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; this.poWHasher = poWHasher; this.stratumMiningEnabled = stratumMiningEnabled; this.ethHashObservers = ethHashObservers; @@ -105,7 +105,7 @@ public class PoWSolver { currentJobs.put( job.getInputs().getPrePowHash(), job, - System.currentTimeMillis() + miningParameters.getUnstable().getPowJobTimeToLive()); + System.currentTimeMillis() + miningConfiguration.getUnstable().getPowJobTimeToLive()); if (stratumMiningEnabled) { LOG.debug( "solving with stratum miner for {} observers", ethHashObservers.getSubscriberCount()); @@ -121,7 +121,7 @@ public class PoWSolver { final Stopwatch operationTimer = Stopwatch.createStarted(); final PoWSolverJob job = currentJob.get(); long hashesExecuted = 0; - for (final Long n : miningParameters.getNonceGenerator().get()) { + for (final Long n : miningConfiguration.getNonceGenerator().get()) { if (job.isDone()) { return; @@ -181,7 +181,7 @@ public class PoWSolver { solution.getPowHash(), ommerCandidate.getInputs().getBlockNumber(), distanceToHead); - if (distanceToHead <= miningParameters.getUnstable().getMaxOmmerDepth()) { + if (distanceToHead <= miningConfiguration.getUnstable().getMaxOmmerDepth()) { jobToTestWith = ommerCandidate; } else { LOG.debug("Discarded ommer solution as too far from head {}", distanceToHead); @@ -211,6 +211,6 @@ public class PoWSolver { } public Iterable getNonceGenerator() { - return miningParameters.getNonceGenerator().get(); + return miningConfiguration.getNonceGenerator().get(); } } diff --git a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java index fd27ca0574..e957394d85 100644 --- a/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java +++ b/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilder.java @@ -18,7 +18,7 @@ import org.hyperledger.besu.config.GenesisConfigOptions; import org.hyperledger.besu.datatypes.HardforkId; import org.hyperledger.besu.datatypes.HardforkId.MainnetHardforkId; import org.hyperledger.besu.ethereum.chain.BadBlockManager; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.privacy.PrivateTransactionValidator; import org.hyperledger.besu.evm.internal.EvmConfiguration; @@ -51,7 +51,7 @@ public class ProtocolScheduleBuilder { private final BadBlockManager badBlockManager; private final boolean isParallelTxProcessingEnabled; private final MetricsSystem metricsSystem; - private final MiningParameters miningParameters; + private final MiningConfiguration miningConfiguration; public ProtocolScheduleBuilder( final GenesisConfigOptions config, @@ -60,7 +60,7 @@ public class ProtocolScheduleBuilder { final PrivacyParameters privacyParameters, final boolean isRevertReasonEnabled, final EvmConfiguration evmConfiguration, - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final BadBlockManager badBlockManager, final boolean isParallelTxProcessingEnabled, final MetricsSystem metricsSystem) { @@ -73,7 +73,7 @@ public class ProtocolScheduleBuilder { this.badBlockManager = badBlockManager; this.isParallelTxProcessingEnabled = isParallelTxProcessingEnabled; this.metricsSystem = metricsSystem; - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; } public ProtocolSchedule createProtocolSchedule() { @@ -93,7 +93,7 @@ public class ProtocolScheduleBuilder { config.getEcip1017EraRounds(), evmConfiguration.overrides( config.getContractSizeLimit(), OptionalInt.empty(), config.getEvmStackSize()), - miningParameters, + miningConfiguration, isParallelTxProcessingEnabled, metricsSystem); diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java index 7be6ad12c4..57f1158585 100644 --- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java +++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/BlockchainSetupUtil.java @@ -152,7 +152,7 @@ public class BlockchainSetupUtil { return MainnetProtocolSchedule.fromConfig( genesisConfigFile.getConfigOptions(), EvmConfiguration.DEFAULT, - MiningParameters.newDefault(), + MiningConfiguration.newDefault(), new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java index e05ba21268..b2b979e283 100644 --- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java +++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ExecutionContextTestFixture.java @@ -157,7 +157,7 @@ public class ExecutionContextTestFixture { new PrivacyParameters(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) diff --git a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java index 5eec6d61e5..db1114e832 100644 --- a/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java +++ b/ethereum/core/src/test-support/java/org/hyperledger/besu/ethereum/core/ProtocolScheduleFixture.java @@ -39,7 +39,7 @@ public class ProtocolScheduleFixture { Optional.empty(), Optional.empty(), Optional.empty(), - MiningParameters.newDefault(), + MiningConfiguration.newDefault(), new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedProtocolScheduleTest.java index 7969ab6824..02bb41feb9 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedProtocolScheduleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/difficulty/fixed/FixedProtocolScheduleTest.java @@ -20,7 +20,7 @@ import org.hyperledger.besu.config.GenesisConfigFile; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; @@ -36,7 +36,7 @@ public class FixedProtocolScheduleTest { FixedDifficultyProtocolSchedule.create( GenesisConfigFile.fromResource("/dev.json").getConfigOptions(), EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DefaultProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DefaultProtocolScheduleTest.java index e48cd67302..92818e31e7 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DefaultProtocolScheduleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/DefaultProtocolScheduleTest.java @@ -22,7 +22,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; @@ -61,7 +61,7 @@ public class DefaultProtocolScheduleTest { privacyParameters, isRevertReasonEnabled, evmConfiguration, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java index c63a9b5ccb..9ce20cb626 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/MainnetProtocolScheduleTest.java @@ -18,7 +18,7 @@ import org.hyperledger.besu.config.GenesisConfigFile; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; @@ -73,7 +73,7 @@ public class MainnetProtocolScheduleTest { MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromConfig("{}").getConfigOptions(), EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -90,7 +90,7 @@ public class MainnetProtocolScheduleTest { MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromConfig(json).getConfigOptions(), EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -124,7 +124,7 @@ public class MainnetProtocolScheduleTest { MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromConfig(json).getConfigOptions(), EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem())); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PoWSolverTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PoWSolverTest.java index 91553afed3..1f0b782825 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PoWSolverTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/PoWSolverTest.java @@ -21,9 +21,9 @@ import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import org.hyperledger.besu.datatypes.Hash; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.util.Subscribers; import java.util.Arrays; @@ -530,12 +530,12 @@ public class PoWSolverTest { powThread1.interrupt(); } - private MiningParameters createMiningParameters( + private MiningConfiguration createMiningParameters( final List nonceToTry, final int powJobTimeToLive, final int maxOmmerDepth) { - return ImmutableMiningParameters.builder() + return ImmutableMiningConfiguration.builder() .mutableInitValues(MutableInitValues.builder().nonceGenerator(nonceToTry).build()) .unstable( - ImmutableMiningParameters.Unstable.builder() + ImmutableMiningConfiguration.Unstable.builder() .maxOmmerDepth(maxOmmerDepth) .powJobTimeToLive(powJobTimeToLive) .build()) diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilderTest.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilderTest.java index cade5bd601..8046d7e839 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilderTest.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/mainnet/ProtocolScheduleBuilderTest.java @@ -31,7 +31,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem; @@ -67,7 +67,7 @@ class ProtocolScheduleBuilderTest { new PrivacyParameters(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -262,7 +262,7 @@ class ProtocolScheduleBuilderTest { new PrivacyParameters(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/AbstractIsolationTests.java b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/AbstractIsolationTests.java index dd9257441e..999d33a5c5 100644 --- a/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/AbstractIsolationTests.java +++ b/ethereum/core/src/test/java/org/hyperledger/besu/ethereum/trie/diffbased/bonsai/AbstractIsolationTests.java @@ -39,9 +39,9 @@ import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters; -import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters.MutableInitValues; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration; +import org.hyperledger.besu.ethereum.core.ImmutableMiningConfiguration.MutableInitValues; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.MutableWorldState; import org.hyperledger.besu.ethereum.core.SealableBlockHeader; import org.hyperledger.besu.ethereum.core.Transaction; @@ -104,7 +104,7 @@ public abstract class AbstractIsolationTests { protected final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.fromConfig( GenesisConfigFile.fromResource("/dev.json").getConfigOptions(), - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -138,7 +138,7 @@ public abstract class AbstractIsolationTests { txPoolMetrics, transactionReplacementTester, new BlobCache(), - MiningParameters.newDefault()), + MiningConfiguration.newDefault()), ethScheduler); protected final List accounts = @@ -229,7 +229,7 @@ public abstract class AbstractIsolationTests { @Override public Wei getMinGasPrice() { - return MiningParameters.newDefault().getMinTransactionGasPrice(); + return MiningConfiguration.newDefault().getMinTransactionGasPrice(); } @Override @@ -254,7 +254,7 @@ public abstract class AbstractIsolationTests { static class TestBlockCreator extends AbstractBlockCreator { private TestBlockCreator( - final MiningParameters miningParameters, + final MiningConfiguration miningConfiguration, final MiningBeneficiaryCalculator miningBeneficiaryCalculator, final ExtraDataCalculator extraDataCalculator, final TransactionPool transactionPool, @@ -262,7 +262,7 @@ public abstract class AbstractIsolationTests { final ProtocolSchedule protocolSchedule, final EthScheduler ethScheduler) { super( - miningParameters, + miningConfiguration, miningBeneficiaryCalculator, extraDataCalculator, transactionPool, @@ -277,8 +277,8 @@ public abstract class AbstractIsolationTests { final TransactionPool transactionPool, final EthScheduler ethScheduler) { - final MiningParameters miningParameters = - ImmutableMiningParameters.builder() + final MiningConfiguration miningConfiguration = + ImmutableMiningConfiguration.builder() .mutableInitValues( MutableInitValues.builder() .extraData(Bytes.fromHexString("deadbeef")) @@ -290,7 +290,7 @@ public abstract class AbstractIsolationTests { .build(); return new TestBlockCreator( - miningParameters, + miningConfiguration, __ -> Address.ZERO, __ -> Bytes.fromHexString("deadbeef"), transactionPool, diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactory.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactory.java index 79b1298d27..9f13323630 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactory.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactory.java @@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.eth.transactions; import static org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration.Implementation.LAYERED; import org.hyperledger.besu.ethereum.ProtocolContext; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.messages.EthPV62; @@ -56,7 +56,7 @@ public class TransactionPoolFactory { final SyncState syncState, final TransactionPoolConfiguration transactionPoolConfiguration, final BlobCache blobCache, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { final TransactionPoolMetrics metrics = new TransactionPoolMetrics(metricsSystem); @@ -80,7 +80,7 @@ public class TransactionPoolFactory { transactionsMessageSender, newPooledTransactionHashesMessageSender, blobCache, - miningParameters); + miningConfiguration); } static TransactionPool createTransactionPool( @@ -95,7 +95,7 @@ public class TransactionPoolFactory { final TransactionsMessageSender transactionsMessageSender, final NewPooledTransactionHashesMessageSender newPooledTransactionHashesMessageSender, final BlobCache blobCache, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { final TransactionPool transactionPool = new TransactionPool( @@ -108,7 +108,7 @@ public class TransactionPoolFactory { metrics, transactionPoolConfiguration, blobCache, - miningParameters), + miningConfiguration), protocolSchedule, protocolContext, new TransactionBroadcaster( @@ -241,7 +241,7 @@ public class TransactionPoolFactory { final TransactionPoolMetrics metrics, final TransactionPoolConfiguration transactionPoolConfiguration, final BlobCache blobCache, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { boolean isFeeMarketImplementBaseFee = protocolSchedule.anyMatch( @@ -256,7 +256,7 @@ public class TransactionPoolFactory { transactionPoolConfiguration, isFeeMarketImplementBaseFee, blobCache, - miningParameters); + miningConfiguration); } else { return createPendingTransactionSorter( protocolContext, @@ -296,7 +296,7 @@ public class TransactionPoolFactory { final TransactionPoolConfiguration transactionPoolConfiguration, final boolean isFeeMarketImplementBaseFee, final BlobCache blobCache, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { final TransactionPoolReplacementHandler transactionReplacementHandler = new TransactionPoolReplacementHandler( @@ -345,7 +345,7 @@ public class TransactionPoolFactory { transactionReplacementTester, feeMarket, blobCache, - miningParameters); + miningConfiguration); } else { pendingTransactionsSorter = new GasPricePrioritizedTransactions( @@ -355,7 +355,7 @@ public class TransactionPoolFactory { metrics, transactionReplacementTester, blobCache, - miningParameters); + miningConfiguration); } return new LayeredPendingTransactions( diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/AbstractPrioritizedTransactions.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/AbstractPrioritizedTransactions.java index fce565a807..06db1b1edc 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/AbstractPrioritizedTransactions.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/AbstractPrioritizedTransactions.java @@ -16,7 +16,7 @@ package org.hyperledger.besu.ethereum.eth.transactions.layered; import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.TransactionType; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction; @@ -42,7 +42,7 @@ import java.util.stream.Collectors; */ public abstract class AbstractPrioritizedTransactions extends AbstractSequentialTransactionsLayer { protected final TreeSet orderByFee; - protected final MiningParameters miningParameters; + protected final MiningConfiguration miningConfiguration; public AbstractPrioritizedTransactions( final TransactionPoolConfiguration poolConfig, @@ -52,7 +52,7 @@ public abstract class AbstractPrioritizedTransactions extends AbstractSequential final BiFunction transactionReplacementTester, final BlobCache blobCache, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { super( poolConfig, ethScheduler, @@ -61,7 +61,7 @@ public abstract class AbstractPrioritizedTransactions extends AbstractSequential metrics, blobCache); this.orderByFee = new TreeSet<>(this::compareByFee); - this.miningParameters = miningParameters; + this.miningConfiguration = miningConfiguration; } @Override diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/BaseFeePrioritizedTransactions.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/BaseFeePrioritizedTransactions.java index df9b1537a3..b168babe63 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/BaseFeePrioritizedTransactions.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/BaseFeePrioritizedTransactions.java @@ -19,7 +19,7 @@ import static org.hyperledger.besu.ethereum.eth.transactions.layered.LayeredRemo import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction; @@ -51,7 +51,7 @@ public class BaseFeePrioritizedTransactions extends AbstractPrioritizedTransacti transactionReplacementTester, final FeeMarket feeMarket, final BlobCache blobCache, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { super( poolConfig, ethScheduler, @@ -59,7 +59,7 @@ public class BaseFeePrioritizedTransactions extends AbstractPrioritizedTransacti metrics, transactionReplacementTester, blobCache, - miningParameters); + miningConfiguration); this.nextBlockBaseFee = Optional.of(calculateNextBlockBaseFee(feeMarket, chainHeadHeaderSupplier.get())); } @@ -174,15 +174,15 @@ public class BaseFeePrioritizedTransactions extends AbstractPrioritizedTransacti if (pendingTransaction .getTransaction() .getEffectiveGasPrice(nextBlockBaseFee) - .lessThan(miningParameters.getMinTransactionGasPrice())) { + .lessThan(miningConfiguration.getMinTransactionGasPrice())) { return false; } // check if enough priority fee is paid - if (!miningParameters.getMinPriorityFeePerGas().equals(Wei.ZERO)) { + if (!miningConfiguration.getMinPriorityFeePerGas().equals(Wei.ZERO)) { final Wei priorityFeePerGas = pendingTransaction.getTransaction().getEffectivePriorityFeePerGas(nextBlockBaseFee); - if (priorityFeePerGas.lessThan(miningParameters.getMinPriorityFeePerGas())) { + if (priorityFeePerGas.lessThan(miningConfiguration.getMinPriorityFeePerGas())) { return false; } } diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/GasPricePrioritizedTransactions.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/GasPricePrioritizedTransactions.java index 504a453fa8..205c02f543 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/GasPricePrioritizedTransactions.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/layered/GasPricePrioritizedTransactions.java @@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.eth.transactions.layered; import static java.util.Comparator.comparing; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction; @@ -43,7 +43,7 @@ public class GasPricePrioritizedTransactions extends AbstractPrioritizedTransact final BiFunction transactionReplacementTester, final BlobCache blobCache, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { super( poolConfig, ethScheduler, @@ -51,7 +51,7 @@ public class GasPricePrioritizedTransactions extends AbstractPrioritizedTransact metrics, transactionReplacementTester, blobCache, - miningParameters); + miningConfiguration); } @Override @@ -74,7 +74,7 @@ public class GasPricePrioritizedTransactions extends AbstractPrioritizedTransact || pendingTransaction .getTransaction() .getGasPrice() - .map(miningParameters.getMinTransactionGasPrice()::lessThan) + .map(miningConfiguration.getMinTransactionGasPrice()::lessThan) .orElse(false); } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java index 3a3331b568..b7c346af69 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/EthProtocolManagerTest.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.ProtocolScheduleFixture; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; @@ -1123,7 +1123,7 @@ public final class EthProtocolManagerTest { new SyncState(blockchain, ethManager.ethContext().getEthPeers()), TransactionPoolConfiguration.DEFAULT, new BlobCache(), - MiningParameters.newDefault()) + MiningConfiguration.newDefault()) .setEnabled(); // Send just a transaction message. diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/ethtaskutils/AbstractMessageTaskTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/ethtaskutils/AbstractMessageTaskTest.java index 6dbea259cc..b1691d0af5 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/ethtaskutils/AbstractMessageTaskTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/ethtaskutils/AbstractMessageTaskTest.java @@ -26,7 +26,7 @@ import org.hyperledger.besu.ethereum.ProtocolContext; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.chain.Blockchain; import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.eth.EthProtocol; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; import org.hyperledger.besu.ethereum.eth.manager.EthContext; @@ -144,7 +144,7 @@ public abstract class AbstractMessageTaskTest { syncState, TransactionPoolConfiguration.DEFAULT, new BlobCache(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); transactionPool.setEnabled(); ethProtocolManager = diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java index b11afeb4c5..2bb1394a1d 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockBodiesMessageTest.java @@ -21,7 +21,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockBody; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; @@ -60,7 +60,7 @@ public final class BlockBodiesMessageTest { GenesisConfigFile.fromResource("/dev.json").getConfigOptions(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockHeadersMessageTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockHeadersMessageTest.java index 72f089a53e..9173a7af48 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockHeadersMessageTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/messages/BlockHeadersMessageTest.java @@ -17,7 +17,7 @@ package org.hyperledger.besu.ethereum.eth.messages; import org.hyperledger.besu.config.GenesisConfigFile; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData; @@ -67,7 +67,7 @@ public final class BlockHeadersMessageTest { GenesisConfigFile.fromResource("/dev.json").getConfigOptions(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem())); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java index 5f7baaff41..f97fe91c6f 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/ChainHeadTrackerTest.java @@ -23,7 +23,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockchainSetupUtil; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule; import org.hyperledger.besu.ethereum.eth.manager.ChainState; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; @@ -58,7 +58,7 @@ public class ChainHeadTrackerTest { GenesisConfigFile.fromResource("/dev.json").getConfigOptions(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java index cfc9f9dc12..4cd4d1c674 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncContextTest.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; @@ -95,7 +95,7 @@ public class BackwardSyncContextTest { private ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions(), - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStepTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStepTest.java index 6dc69ea274..696856c076 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStepTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/BackwardSyncStepTest.java @@ -29,7 +29,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; @@ -72,7 +72,7 @@ public class BackwardSyncStepTest { private final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions(), - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStepTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStepTest.java index a5d2cf6104..34479bf11f 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStepTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/backwardsync/ForwardSyncStepTest.java @@ -28,7 +28,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockDataGenerator; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.TransactionReceipt; import org.hyperledger.besu.ethereum.eth.manager.EthContext; import org.hyperledger.besu.ethereum.eth.manager.EthProtocolManager; @@ -75,7 +75,7 @@ public class ForwardSyncStepTest { private final ProtocolSchedule protocolSchedule = MainnetProtocolSchedule.fromConfig( new StubGenesisConfigOptions(), - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTestBase.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTestBase.java index 07d4e6ab4b..e3e8046ba8 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTestBase.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/AbstractTransactionPoolTestBase.java @@ -49,7 +49,7 @@ import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionReceipt; @@ -183,7 +183,7 @@ public abstract class AbstractTransactionPoolTestBase { new PrivacyParameters(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java index c679183b0f..0081dc7d94 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TestNode.java @@ -34,7 +34,7 @@ import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions; import org.hyperledger.besu.ethereum.core.InMemoryKeyValueStorageProvider; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.difficulty.fixed.FixedDifficultyProtocolSchedule; import org.hyperledger.besu.ethereum.eth.EthProtocol; @@ -122,7 +122,7 @@ public class TestNode implements Closeable { GenesisConfigFile.fromResource("/dev.json").getConfigOptions(), false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -181,7 +181,7 @@ public class TestNode implements Closeable { syncState, TransactionPoolConfiguration.DEFAULT, new BlobCache(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); final EthProtocolManager ethProtocolManager = new EthProtocolManager( diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java index d1bafc3969..612a1de9df 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/TransactionPoolFactoryTest.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.ethereum.chain.BlockAddedObserver; import org.hyperledger.besu.ethereum.chain.MutableBlockchain; import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.Synchronizer; import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration; @@ -378,7 +378,7 @@ public class TransactionPoolFactoryTest { PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) @@ -413,7 +413,7 @@ public class TransactionPoolFactoryTest { transactionsMessageSender, newPooledTransactionHashesMessageSender, new BlobCache(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); } private TransactionPool createAndEnableTransactionPool( diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/AbstractPrioritizedTransactionsTestBase.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/AbstractPrioritizedTransactionsTestBase.java index 6a0005eec6..69db327013 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/AbstractPrioritizedTransactionsTestBase.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/AbstractPrioritizedTransactionsTestBase.java @@ -22,7 +22,7 @@ import static org.hyperledger.besu.ethereum.eth.transactions.layered.AddReason.N import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration; import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction; @@ -47,8 +47,8 @@ public abstract class AbstractPrioritizedTransactionsTestBase extends BaseTransa new EnumMap<>(Map.of(TransactionType.BLOB, 2)); protected final TransactionPoolMetrics txPoolMetrics = new TransactionPoolMetrics(metricsSystem); protected final EvictCollectorLayer evictCollector = new EvictCollectorLayer(txPoolMetrics); - protected final MiningParameters miningParameters = - MiningParameters.newDefault() + protected final MiningConfiguration miningConfiguration = + MiningConfiguration.newDefault() .setMinTransactionGasPrice(DEFAULT_MIN_GAS_PRICE) .setMinPriorityFeePerGas(DEFAULT_MIN_PRIORITY_FEE); protected AbstractPrioritizedTransactions transactions = @@ -58,16 +58,17 @@ public abstract class AbstractPrioritizedTransactionsTestBase extends BaseTransa .maxPrioritizedTransactionsByType(MAX_TRANSACTIONS_BY_TYPE) .maxFutureBySender(MAX_TRANSACTIONS) .build(), - miningParameters); + miningConfiguration); private AbstractPrioritizedTransactions getSorter( - final TransactionPoolConfiguration poolConfig, final MiningParameters miningParameters) { + final TransactionPoolConfiguration poolConfig, + final MiningConfiguration miningConfiguration) { return getSorter( poolConfig, evictCollector, txPoolMetrics, (pt1, pt2) -> transactionReplacementTester(poolConfig, pt1, pt2), - miningParameters); + miningConfiguration); } abstract AbstractPrioritizedTransactions getSorter( @@ -76,7 +77,7 @@ public abstract class AbstractPrioritizedTransactionsTestBase extends BaseTransa final TransactionPoolMetrics txPoolMetrics, final BiFunction transactionReplacementTester, - final MiningParameters miningParameters); + final MiningConfiguration miningConfiguration); abstract BlockHeader mockBlockHeader(); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/BaseFeePrioritizedTransactionsTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/BaseFeePrioritizedTransactionsTest.java index b9a675287f..8d01bd7397 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/BaseFeePrioritizedTransactionsTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/BaseFeePrioritizedTransactionsTest.java @@ -26,7 +26,7 @@ import org.hyperledger.besu.crypto.KeyPair; import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionTestFixture; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; @@ -60,7 +60,7 @@ public class BaseFeePrioritizedTransactionsTest extends AbstractPrioritizedTrans final TransactionPoolMetrics txPoolMetrics, final BiFunction transactionReplacementTester, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { return new BaseFeePrioritizedTransactions( poolConfig, @@ -71,7 +71,7 @@ public class BaseFeePrioritizedTransactionsTest extends AbstractPrioritizedTrans transactionReplacementTester, EIP1559_FEE_MARKET, new BlobCache(), - miningParameters); + miningConfiguration); } @Override @@ -164,7 +164,7 @@ public class BaseFeePrioritizedTransactionsTest extends AbstractPrioritizedTrans @Test public void txBelowCurrentMineableMinPriorityFeeIsNotPrioritized() { - miningParameters.setMinPriorityFeePerGas(Wei.of(5)); + miningConfiguration.setMinPriorityFeePerGas(Wei.of(5)); final PendingTransaction lowPriorityFeeTx = createRemotePendingTransaction( createTransaction(0, DEFAULT_MIN_GAS_PRICE.subtract(1), KEYS1)); @@ -175,7 +175,7 @@ public class BaseFeePrioritizedTransactionsTest extends AbstractPrioritizedTrans @Test public void txWithPriorityBelowCurrentMineableMinPriorityFeeIsPrioritized() { - miningParameters.setMinPriorityFeePerGas(Wei.of(5)); + miningConfiguration.setMinPriorityFeePerGas(Wei.of(5)); final PendingTransaction lowGasPriceTx = createRemotePendingTransaction( createTransaction(0, DEFAULT_MIN_GAS_PRICE.subtract(1), KEYS1), true); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/GasPricePrioritizedTransactionsTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/GasPricePrioritizedTransactionsTest.java index 66dcd3c721..a300ec23b4 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/GasPricePrioritizedTransactionsTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/GasPricePrioritizedTransactionsTest.java @@ -20,7 +20,7 @@ import static org.mockito.Mockito.when; import org.hyperledger.besu.crypto.KeyPair; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionTestFixture; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; @@ -44,7 +44,7 @@ public class GasPricePrioritizedTransactionsTest extends AbstractPrioritizedTran final TransactionPoolMetrics txPoolMetrics, final BiFunction transactionReplacementTester, - final MiningParameters miningParameters) { + final MiningConfiguration miningConfiguration) { return new GasPricePrioritizedTransactions( poolConfig, @@ -53,7 +53,7 @@ public class GasPricePrioritizedTransactionsTest extends AbstractPrioritizedTran txPoolMetrics, transactionReplacementTester, new BlobCache(), - miningParameters); + miningConfiguration); } @Override diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactionsTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactionsTest.java index 5f6126326d..28814790a0 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactionsTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredPendingTransactionsTest.java @@ -42,7 +42,7 @@ import org.hyperledger.besu.crypto.KeyPair; import org.hyperledger.besu.datatypes.Hash; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration; @@ -158,7 +158,7 @@ public class LayeredPendingTransactionsTest extends BaseTransactionPoolTest { transactionReplacementTester, FeeMarket.london(0L), new BlobCache(), - MiningParameters.newDefault().setMinTransactionGasPrice(DEFAULT_MIN_GAS_PRICE)); + MiningConfiguration.newDefault().setMinTransactionGasPrice(DEFAULT_MIN_GAS_PRICE)); return new CreatedLayers( prioritizedTransactions, readyTransactions, sparseTransactions, evictCollector); } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredTransactionPoolBaseFeeTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredTransactionPoolBaseFeeTest.java index b3a840e706..c485ea7878 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredTransactionPoolBaseFeeTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredTransactionPoolBaseFeeTest.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionTestFixture; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; @@ -49,7 +49,7 @@ public class LayeredTransactionPoolBaseFeeTest extends AbstractLayeredTransactio transactionReplacementTester, FeeMarket.london(0L), new BlobCache(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); } @Override diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredTransactionPoolGasPriceTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredTransactionPoolGasPriceTest.java index 0c6f5f0bd2..305bd9959a 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredTransactionPoolGasPriceTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayeredTransactionPoolGasPriceTest.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.ethereum.core.Block; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.Difficulty; import org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.TransactionTestFixture; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; @@ -46,7 +46,7 @@ public class LayeredTransactionPoolGasPriceTest extends AbstractLayeredTransacti txPoolMetrics, transactionReplacementTester, new BlobCache(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); } @Override diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayersTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayersTest.java index 0decabaaaf..ee900e3dc4 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayersTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/LayersTest.java @@ -36,7 +36,7 @@ import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.core.Util; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; @@ -1404,7 +1404,7 @@ public class LayersTest extends BaseTransactionPoolTest { (pt1, pt2) -> transactionReplacementTester(poolConfig, pt1, pt2), FeeMarket.london(0L), new BlobCache(), - MiningParameters.newDefault().setMinTransactionGasPrice(MIN_GAS_PRICE)); + MiningConfiguration.newDefault().setMinTransactionGasPrice(MIN_GAS_PRICE)); this.pending = new LayeredPendingTransactions(poolConfig, this.prio, ethScheduler); diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/ReplayTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/ReplayTest.java index 847f5f2b91..760591a87c 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/ReplayTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/transactions/layered/ReplayTest.java @@ -25,7 +25,7 @@ import org.hyperledger.besu.datatypes.Address; import org.hyperledger.besu.datatypes.TransactionType; import org.hyperledger.besu.datatypes.Wei; import org.hyperledger.besu.ethereum.core.BlockHeader; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.Transaction; import org.hyperledger.besu.ethereum.eth.manager.EthScheduler; import org.hyperledger.besu.ethereum.eth.transactions.BlobCache; @@ -232,7 +232,7 @@ public class ReplayTest { txReplacementTester, baseFeeMarket, new BlobCache(), - MiningParameters.newDefault()); + MiningConfiguration.newDefault()); } // ToDo: commented since not always working, needs fix diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java index 8490312d81..1addf8032e 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/MainnetGenesisFileModule.java @@ -20,7 +20,7 @@ import org.hyperledger.besu.crypto.SignatureAlgorithmFactory; import org.hyperledger.besu.crypto.SignatureAlgorithmType; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeaderFunctions; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.MainnetBlockHeaderFunctions; import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule; @@ -81,7 +81,7 @@ class MainnetGenesisFileModule extends GenesisFileModule { return MainnetProtocolSchedule.fromConfig( configOptions, evmConfiguration, - MiningParameters.newDefault(), + MiningConfiguration.newDefault(), new BadBlockManager(), false, new NoOpMetricsSystem()); @@ -192,7 +192,7 @@ class MainnetGenesisFileModule extends GenesisFileModule { PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) diff --git a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java index b9af680fe3..153f56d636 100644 --- a/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java +++ b/ethereum/referencetests/src/main/java/org/hyperledger/besu/ethereum/referencetests/ReferenceTestProtocolSchedules.java @@ -19,7 +19,7 @@ import org.hyperledger.besu.config.StubGenesisConfigOptions; import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule; import org.hyperledger.besu.ethereum.mainnet.ProtocolScheduleBuilder; @@ -157,7 +157,7 @@ public class ReferenceTestProtocolSchedules { PrivacyParameters.DEFAULT, false, EvmConfiguration.DEFAULT, - MiningParameters.MINING_DISABLED, + MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) diff --git a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java index 3a61967044..3333f02e58 100644 --- a/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java +++ b/ethereum/referencetests/src/reference-test/java/org/hyperledger/besu/ethereum/mainnet/DifficultyCalculatorTests.java @@ -18,7 +18,6 @@ package org.hyperledger.besu.ethereum.mainnet; import static org.assertj.core.api.Assertions.assertThat; -import org.checkerframework.checker.units.qual.N; import org.hyperledger.besu.config.GenesisConfigFile; import org.hyperledger.besu.config.JsonUtil; import org.hyperledger.besu.config.StubGenesisConfigOptions; @@ -28,13 +27,12 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager; import org.hyperledger.besu.ethereum.core.BlockHeader; import org.hyperledger.besu.ethereum.core.BlockHeaderBuilder; import org.hyperledger.besu.ethereum.core.Difficulty; -import org.hyperledger.besu.ethereum.core.MiningParameters; +import org.hyperledger.besu.ethereum.core.MiningConfiguration; import org.hyperledger.besu.evm.internal.EvmConfiguration; import org.hyperledger.besu.evm.log.LogsBloomFilter; import java.io.IOException; import java.nio.charset.StandardCharsets; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.stream.Stream; @@ -61,64 +59,64 @@ public class DifficultyCalculatorTests { MainnetProtocolSchedule.fromConfig( GenesisConfigFile.mainnet() .withOverrides(postMergeOverrides).getConfigOptions(), - EvmConfiguration.DEFAULT, MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem())), + EvmConfiguration.DEFAULT, MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem())), Arguments.of( "/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierForkBlock.json", MainnetProtocolSchedule.fromConfig( - new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierTimeDiff1.json", MainnetProtocolSchedule.fromConfig( - new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfGrayGlacier/difficultyGrayGlacierTimeDiff2.json", MainnetProtocolSchedule.fromConfig( - new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + new StubGenesisConfigOptions().grayGlacierBlock(15050000), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfArrowGlacier/difficultyArrowGlacierForkBlock.json", MainnetProtocolSchedule.fromConfig( - new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfArrowGlacier/difficultyArrowGlacierTimeDiff1.json", MainnetProtocolSchedule.fromConfig( - new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfArrowGlacier/difficultyArrowGlacierTimeDiff2.json", MainnetProtocolSchedule.fromConfig( - new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + new StubGenesisConfigOptions().arrowGlacierBlock(13773000), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfByzantium/difficultyByzantium.json", - MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().byzantiumBlock(0), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().byzantiumBlock(0), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfConstantinople/difficultyConstantinople.json", - MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().constantinopleBlock(0), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().constantinopleBlock(0), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfEIP2384/difficultyEIP2384.json", - MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfEIP2384/difficultyEIP2384_random.json", - MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfEIP2384/difficultyEIP2384_random_to20M.json", - MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().muirGlacierBlock(0), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfFrontier/difficultyFrontier.json", - MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions(), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions(), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) ), Arguments.of( "/DifficultyTests/dfHomestead/difficultyHomestead.json", - MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().homesteadBlock(0), MiningParameters.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) + MainnetProtocolSchedule.fromConfig(new StubGenesisConfigOptions().homesteadBlock(0), MiningConfiguration.MINING_DISABLED, new BadBlockManager(), false, new NoOpMetricsSystem()) )); }