Skip to content

Commit

Permalink
IntelliJ do not fail me (#7846)
Browse files Browse the repository at this point in the history
Signed-off-by: jflo <[email protected]>
  • Loading branch information
jflo authored Nov 3, 2024
1 parent 7eb7b87 commit 8fce5aa
Show file tree
Hide file tree
Showing 175 changed files with 1,016 additions and 1,008 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
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;
Expand Down Expand Up @@ -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<String> runCommand;
private PrivacyParameters privacyParameters = PrivacyParameters.DEFAULT;
Expand Down Expand Up @@ -139,7 +139,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable
public BesuNode(
final String name,
final Optional<Path> dataPath,
final MiningParameters miningParameters,
final MiningConfiguration miningConfiguration,
final TransactionPoolConfiguration txPoolConfiguration,
final JsonRpcConfiguration jsonRpcConfiguration,
final Optional<JsonRpcConfiguration> engineRpcConfiguration,
Expand Down Expand Up @@ -191,7 +191,7 @@ public BesuNode(
},
() -> this.keyPair = KeyPairUtil.loadKeyPair(homeDirectory));
this.name = name;
this.miningParameters = miningParameters;
this.miningConfiguration = miningConfiguration;
this.txPoolConfiguration = txPoolConfiguration;
this.jsonRpcConfiguration = jsonRpcConfiguration;
this.engineRpcConfiguration = engineRpcConfiguration;
Expand Down Expand Up @@ -678,12 +678,12 @@ public void setBootnodes(final List<URI> bootnodes) {
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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
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;
Expand Down Expand Up @@ -448,7 +448,7 @@ public BesuController provideBesuController(
final BesuControllerBuilder builder,
final MetricsSystem metricsSystem,
final KeyValueStorageProvider storageProvider,
final MiningParameters miningParameters) {
final MiningConfiguration miningConfiguration) {

builder
.synchronizerConfiguration(synchronizerConfiguration)
Expand All @@ -461,7 +461,7 @@ public BesuController provideBesuController(
.evmConfiguration(EvmConfiguration.DEFAULT)
.maxPeers(25)
.maxRemotelyInitiatedPeers(15)
.miningParameters(miningParameters)
.miningParameters(miningConfiguration)
.randomPeerPriority(false)
.besuComponent(null);
return builder.build();
Expand Down Expand Up @@ -564,11 +564,11 @@ public KeyValueStorageProvider provideKeyValueStorageProvider(
}

@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();
Expand All @@ -579,11 +579,11 @@ public MiningParameters provideMiningParameters(
@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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
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;
Expand All @@ -40,7 +40,7 @@ public class BesuNodeConfiguration {

private final String name;
private final Optional<Path> dataPath;
private final MiningParameters miningParameters;
private final MiningConfiguration miningConfiguration;
private final TransactionPoolConfiguration transactionPoolConfiguration;
private final JsonRpcConfiguration jsonRpcConfiguration;
private final Optional<JsonRpcConfiguration> engineRpcConfiguration;
Expand Down Expand Up @@ -78,7 +78,7 @@ public class BesuNodeConfiguration {
BesuNodeConfiguration(
final String name,
final Optional<Path> dataPath,
final MiningParameters miningParameters,
final MiningConfiguration miningConfiguration,
final TransactionPoolConfiguration transactionPoolConfiguration,
final JsonRpcConfiguration jsonRpcConfiguration,
final Optional<JsonRpcConfiguration> engineRpcConfiguration,
Expand Down Expand Up @@ -113,7 +113,7 @@ public class BesuNodeConfiguration {
final boolean strictTxReplayProtectionEnabled,
final Map<String, String> environment) {
this.name = name;
this.miningParameters = miningParameters;
this.miningConfiguration = miningConfiguration;
this.transactionPoolConfiguration = transactionPoolConfiguration;
this.jsonRpcConfiguration = jsonRpcConfiguration;
this.engineRpcConfiguration = engineRpcConfiguration;
Expand Down Expand Up @@ -154,8 +154,8 @@ public String getName() {
return name;
}

public MiningParameters getMiningParameters() {
return miningParameters;
public MiningConfiguration getMiningParameters() {
return miningConfiguration;
}

public TransactionPoolConfiguration getTransactionPoolConfiguration() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
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;
Expand All @@ -61,8 +61,8 @@ public class BesuNodeConfigurationBuilder {

private String name;
private Optional<Path> dataPath = Optional.empty();
private MiningParameters miningParameters =
ImmutableMiningParameters.builder()
private MiningConfiguration miningConfiguration =
ImmutableMiningConfiguration.builder()
.mutableInitValues(
MutableInitValues.builder().coinbase(AddressHelpers.ofValue(1)).build())
.build();
Expand Down Expand Up @@ -125,13 +125,14 @@ public BesuNodeConfigurationBuilder miningEnabled() {
}

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;
}
Expand Down Expand Up @@ -527,7 +528,7 @@ public BesuNodeConfiguration build() {
return new BesuNodeConfiguration(
name,
dataPath,
miningParameters,
miningConfiguration,
transactionPoolConfiguration,
jsonRpcConfiguration,
Optional.of(engineRpcConfiguration),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
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;
Expand Down Expand Up @@ -62,8 +62,8 @@ public void shouldMineOnSingleNodeWithFreeGas_Berlin(
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)
Expand Down
28 changes: 14 additions & 14 deletions besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
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;
Expand Down Expand Up @@ -773,7 +773,7 @@ public Runner build() {

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(
Expand All @@ -783,7 +783,7 @@ public Runner build() {
Optional.of(dataDir.resolve(CACHE_PATH)),
Optional.of(besuController.getProtocolManager().ethContext().getScheduler()),
apiConfiguration,
miningParameters);
miningConfiguration);

final PrivacyParameters privacyParameters = besuController.getPrivacyParameters();

Expand All @@ -802,7 +802,7 @@ public Runner build() {

Optional<StratumServer> 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 "
Expand All @@ -813,9 +813,9 @@ public Runner build() {
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());
Expand Down Expand Up @@ -849,7 +849,7 @@ public Runner build() {
blockchainQueries,
synchronizer,
transactionPool,
miningParameters,
miningConfiguration,
miningCoordinator,
metricsSystem,
supportedCapabilities,
Expand Down Expand Up @@ -896,7 +896,7 @@ public Runner build() {
blockchainQueries,
synchronizer,
transactionPool,
miningParameters,
miningConfiguration,
miningCoordinator,
metricsSystem,
supportedCapabilities,
Expand Down Expand Up @@ -989,7 +989,7 @@ public Runner build() {
blockchainQueries,
synchronizer,
transactionPool,
miningParameters,
miningConfiguration,
miningCoordinator,
metricsSystem,
supportedCapabilities,
Expand Down Expand Up @@ -1070,7 +1070,7 @@ public Runner build() {
blockchainQueries,
synchronizer,
transactionPool,
miningParameters,
miningConfiguration,
miningCoordinator,
metricsSystem,
supportedCapabilities,
Expand Down Expand Up @@ -1111,7 +1111,7 @@ public Runner build() {
blockchainQueries,
synchronizer,
transactionPool,
miningParameters,
miningConfiguration,
miningCoordinator,
metricsSystem,
supportedCapabilities,
Expand Down Expand Up @@ -1273,7 +1273,7 @@ private Map<String, JsonRpcMethod> jsonRpcMethods(
final BlockchainQueries blockchainQueries,
final Synchronizer synchronizer,
final TransactionPool transactionPool,
final MiningParameters miningParameters,
final MiningConfiguration miningConfiguration,
final MiningCoordinator miningCoordinator,
final ObservableMetricsSystem metricsSystem,
final Set<Capability> supportedCapabilities,
Expand Down Expand Up @@ -1308,7 +1308,7 @@ private Map<String, JsonRpcMethod> jsonRpcMethods(
protocolContext,
filterManager,
transactionPool,
miningParameters,
miningConfiguration,
miningCoordinator,
metricsSystem,
supportedCapabilities,
Expand Down
10 changes: 5 additions & 5 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
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;
Expand Down Expand Up @@ -338,7 +338,7 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
Suppliers.memoize(this::readGenesisConfigFile);
private final Supplier<GenesisConfigOptions> genesisConfigOptionsSupplier =
Suppliers.memoize(this::readGenesisConfigOptions);
private final Supplier<MiningParameters> miningParametersSupplier =
private final Supplier<MiningConfiguration> miningParametersSupplier =
Suppliers.memoize(this::getMiningParameters);

private RocksDBPlugin rocksDBPlugin;
Expand Down Expand Up @@ -2117,7 +2117,7 @@ private TransactionPoolConfiguration buildTransactionPoolConfiguration() {
return txPoolConfBuilder.build();
}

private MiningParameters getMiningParameters() {
private MiningConfiguration getMiningParameters() {
miningOptions.setTransactionSelectionService(transactionSelectionServiceImpl);
final var miningParameters = miningOptions.toDomainObject();
getGenesisBlockPeriodSeconds(genesisConfigOptionsSupplier.get())
Expand Down Expand Up @@ -2169,8 +2169,8 @@ public DataStorageConfiguration getDataStorageConfiguration() {
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(
Expand Down
Loading

0 comments on commit 8fce5aa

Please sign in to comment.