Merge branch 'main' into bonsai-account-equals

pull/7845/head
Matt Whitehead 3 weeks ago committed by GitHub
commit b38f72691d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 50
      .github/ISSUE_TEMPLATE/bug-report.md
  2. 45
      .github/ISSUE_TEMPLATE/feature-request.md
  3. 22
      .github/issue_template.md
  4. 1
      CHANGELOG.md
  5. 16
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java
  6. 45
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java
  7. 12
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java
  8. 19
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java
  9. 4
      acceptance-tests/tests/build.gradle
  10. 10
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bft/BftMiningAcceptanceTest.java
  11. 28
      besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
  12. 12
      besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
  13. 82
      besu/src/main/java/org/hyperledger/besu/cli/options/MiningOptions.java
  14. 149
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/RetestethSubCommand.java
  15. 12
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommand.java
  16. 14
      besu/src/main/java/org/hyperledger/besu/controller/BesuController.java
  17. 29
      besu/src/main/java/org/hyperledger/besu/controller/BesuControllerBuilder.java
  18. 17
      besu/src/main/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilder.java
  19. 17
      besu/src/main/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilder.java
  20. 14
      besu/src/main/java/org/hyperledger/besu/controller/IbftBesuControllerBuilder.java
  21. 24
      besu/src/main/java/org/hyperledger/besu/controller/MainnetBesuControllerBuilder.java
  22. 14
      besu/src/main/java/org/hyperledger/besu/controller/MergeBesuControllerBuilder.java
  23. 4
      besu/src/main/java/org/hyperledger/besu/controller/MiningParameterOverrides.java
  24. 16
      besu/src/main/java/org/hyperledger/besu/controller/QbftBesuControllerBuilder.java
  25. 24
      besu/src/main/java/org/hyperledger/besu/controller/TransitionBesuControllerBuilder.java
  26. 12
      besu/src/main/java/org/hyperledger/besu/services/BesuConfigurationImpl.java
  27. 4
      besu/src/test/java/org/hyperledger/besu/FlexGroupPrivacyTest.java
  28. 6
      besu/src/test/java/org/hyperledger/besu/ForkIdsNetworkConfigTest.java
  29. 4
      besu/src/test/java/org/hyperledger/besu/PrivacyReorgTest.java
  30. 4
      besu/src/test/java/org/hyperledger/besu/PrivacyTest.java
  31. 4
      besu/src/test/java/org/hyperledger/besu/RunnerBuilderTest.java
  32. 12
      besu/src/test/java/org/hyperledger/besu/RunnerTest.java
  33. 4
      besu/src/test/java/org/hyperledger/besu/chainexport/RlpBlockExporterTest.java
  34. 40
      besu/src/test/java/org/hyperledger/besu/chainimport/JsonBlockImporterTest.java
  35. 8
      besu/src/test/java/org/hyperledger/besu/chainimport/RlpBlockImporterTest.java
  36. 6
      besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
  37. 6
      besu/src/test/java/org/hyperledger/besu/cli/CascadingDefaultProviderTest.java
  38. 34
      besu/src/test/java/org/hyperledger/besu/cli/options/MiningOptionsTest.java
  39. 10
      besu/src/test/java/org/hyperledger/besu/controller/AbstractBftBesuControllerBuilderTest.java
  40. 10
      besu/src/test/java/org/hyperledger/besu/controller/CliqueBesuControllerBuilderTest.java
  41. 4
      besu/src/test/java/org/hyperledger/besu/controller/ConsensusScheduleBesuControllerBuilderTest.java
  42. 8
      besu/src/test/java/org/hyperledger/besu/controller/MergeBesuControllerBuilderTest.java
  43. 4
      besu/src/test/java/org/hyperledger/besu/controller/QbftBesuControllerBuilderTest.java
  44. 20
      besu/src/test/java/org/hyperledger/besu/controller/TransitionControllerBuilderTest.java
  45. 4
      besu/src/test/java/org/hyperledger/besu/services/BesuEventsImplTest.java
  46. 4
      besu/src/test/java/org/hyperledger/besu/services/TraceServiceImplTest.java
  47. 2
      config/build.gradle
  48. 16
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/CliqueProtocolSchedule.java
  49. 8
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreator.java
  50. 10
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutor.java
  51. 12
      consensus/clique/src/main/java/org/hyperledger/besu/consensus/clique/jsonrpc/CliqueJsonRpcMethods.java
  52. 12
      consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/CliqueProtocolScheduleTest.java
  53. 28
      consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueBlockCreatorTest.java
  54. 26
      consensus/clique/src/test/java/org/hyperledger/besu/consensus/clique/blockcreation/CliqueMinerExecutorTest.java
  55. 11
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilder.java
  56. 8
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreator.java
  57. 20
      consensus/common/src/main/java/org/hyperledger/besu/consensus/common/bft/blockcreation/BftBlockCreatorFactory.java
  58. 6
      consensus/common/src/test/java/org/hyperledger/besu/consensus/common/CombinedProtocolScheduleFactoryTest.java
  59. 4
      consensus/common/src/test/java/org/hyperledger/besu/consensus/common/bft/BaseBftProtocolScheduleBuilderTest.java
  60. 2
      consensus/ibft/build.gradle
  61. 12
      consensus/ibft/src/integration-test/java/org/hyperledger/besu/consensus/ibft/support/TestContextBuilder.java
  62. 14
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleBuilder.java
  63. 12
      consensus/ibft/src/main/java/org/hyperledger/besu/consensus/ibft/jsonrpc/IbftJsonRpcMethods.java
  64. 144
      consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/IbftProtocolScheduleTest.java
  65. 14
      consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/blockcreation/BftBlockCreatorTest.java
  66. 6
      consensus/ibft/src/test/java/org/hyperledger/besu/consensus/ibft/statemachine/IbftBlockHeightManagerTest.java
  67. 16
      consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/MergeProtocolSchedule.java
  68. 10
      consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/TransitionProtocolSchedule.java
  69. 10
      consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeBlockCreator.java
  70. 32
      consensus/merge/src/main/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinator.java
  71. 12
      consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/MergeProtocolScheduleTest.java
  72. 30
      consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeCoordinatorTest.java
  73. 4
      consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeGenesisConfigHelper.java
  74. 6
      consensus/merge/src/test/java/org/hyperledger/besu/consensus/merge/blockcreation/MergeReorgTest.java
  75. 12
      consensus/qbft/src/integration-test/java/org/hyperledger/besu/consensus/qbft/support/TestContextBuilder.java
  76. 20
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleBuilder.java
  77. 6
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/blockcreation/QbftBlockCreatorFactory.java
  78. 12
      consensus/qbft/src/main/java/org/hyperledger/besu/consensus/qbft/jsonrpc/QbftJsonRpcMethods.java
  79. 4
      consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/QbftProtocolScheduleTest.java
  80. 10
      consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/blockcreation/QbftBlockCreatorFactoryTest.java
  81. 6
      consensus/qbft/src/test/java/org/hyperledger/besu/consensus/qbft/statemachine/QbftBlockHeightManagerTest.java
  82. 4
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/BlockchainImporter.java
  83. 12
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcTestMethodsFactory.java
  84. 4
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/frontier/EthGetFilterChangesIntegrationTest.java
  85. 4
      ethereum/api/src/integration-test/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/fork/london/EthGetFilterChangesIntegrationTest.java
  86. 10
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetExtraData.java
  87. 10
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinGasPrice.java
  88. 10
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerGetMinPriorityFee.java
  89. 10
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetExtraData.java
  90. 10
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinGasPrice.java
  91. 10
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/miner/MinerSetMinPriorityFee.java
  92. 6
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/JsonRpcMethodsFactory.java
  93. 20
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/methods/MinerJsonRpcMethods.java
  94. 26
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/query/BlockchainQueries.java
  95. 4
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/AbstractEthGraphQLHttpServiceTest.java
  96. 8
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/AbstractJsonRpcHttpServiceTest.java
  97. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceHostAllowlistTest.java
  98. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceLoginTest.java
  99. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceRpcApisTest.java
  100. 6
      ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcHttpServiceTestBase.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,50 @@
---
name: Bug Report
about: necessary information to help us resolve the issue
title: ''
labels: 'bug'
assignees: ''
---
<!-- Have you done the following? -->
<!-- * read the Code of Conduct? By filing an Issue, you are expected to -->
<!-- comply with it, including treating everyone with respect: -->
<!-- https://github.com/hyperledger/besu/blob/main/CODE_OF_CONDUCT.md -->
<!-- * Reproduced the issue in the latest version of the software -->
<!-- * Read the debugging docs: https://besu.hyperledger.org/private-networks/how-to -->
<!-- * Duplicate Issue check: https://github.com/search?q=+is%3Aissue+repo%3Ahyperledger/Besu -->
### Steps to Reproduce
1. [Step 1]
2. [Step 2]
3. [Step ...]
**Expected behavior:** [What you expect to happen]
**Actual behavior:** [What actually happens]
**Frequency:** [What percentage of the time does it occur?]
### Logs
Please post relevant logs from Besu (and the consensus client, if running proof of stake) from before and after the issue.
### Versions (Add all that apply)
* Software version: [`besu --version`]
* Java version: [`java -version`]
* OS Name & Version: [`cat /etc/*release`]
* Kernel Version: [`uname -a`]
* Virtual Machine software & version: [`vmware -v`]
* Docker Version: [`docker version`]
* Cloud VM, type, size: [Amazon Web Services I3-large]
* Consensus Client & Version if using Proof of Stake: [e.g. Teku, Lighthouse, Prysm, Nimbus, Lodestar]
### Smart contract information (If you're reporting an issue arising from deploying or calling a smart contract, please supply related information)
* Solidity version [`solc --version`]
* Repo with minimal set of deployable/reproducible contract code - please provide a link
* Please include specifics on how you are deploying/calling the contract
* Have you reproduced the issue on other eth clients
### Additional Information (Add any of the following or anything else that may be relevant)
* Besu setup info - genesis file, config options
* System info - memory, CPU

@ -0,0 +1,45 @@
---
name: Feature Request
about: suggesting new or altered functionality
title: ''
labels: ''
assignees: ''
---
<!-- Have you done the following? -->
<!-- * read the Code of Conduct? By filing an Issue, you are expected to -->
<!-- comply with it, including treating everyone with respect: -->
<!-- https://github.com/hyperledger/besu/blob/main/CODE_OF_CONDUCT.md -->
<!-- * Duplicate Issue check: https://github.com/search?q=+is%3Aissue+repo%3Ahyperledger/Besu -->
### Description
As an [Actor], I want [feature] so that [why].
### Acceptance Criteria
* [Criteria 1]
* [Criteria 2]
* [Criteria 3...]
### Logs (if a change in behavior)
Please post relevant logs from Besu (and the consensus client, if running proof of stake) illustrating behavior to be altered
### Versions (Add all that apply)
* Software version: [`besu --version`]
* Java version: [`java -version`]
* OS Name & Version: [`cat /etc/*release`]
* Kernel Version: [`uname -a`]
* Virtual Machine software & version: [`vmware -v`]
* Docker Version: [`docker version`]
* Cloud VM, type, size: [Amazon Web Services I3-large]
* Consensus Client & Version if using Proof of Stake: [e.g. Teku, Lighthouse, Prysm, Nimbus, Lodestar]
### Smart contract information (If you're reporting an issue arising from deploying or calling a smart contract, please supply related information)
* Solidity version [`solc --version`]
* Repo with minimal set of deployable/reproducible contract code - please provide a link
* Please include specifics on how you are deploying/calling the contract
* Have you reproduced the issue on other eth clients
### Additional Information (Add any of the following or anything else that may be relevant)
* Besu setup info - genesis file, config options
* System info - memory, CPU

@ -2,30 +2,10 @@
<!-- * read the Code of Conduct? By filing an Issue, you are expected to -->
<!-- comply with it, including treating everyone with respect: -->
<!-- https://github.com/hyperledger/besu/blob/main/CODE_OF_CONDUCT.md -->
<!-- * Reproduced the issue in the latest version of the software -->
<!-- * Read the debugging docs: https://besu.hyperledger.org/private-networks/how-to -->
<!-- * Duplicate Issue check: https://github.com/search?q=+is%3Aissue+repo%3Ahyperledger/Besu -->
<!-- Note: Not all sections will apply to all issue types. -->
<!-- * Considered using a specific template for submitting a Bug or Feature Request? -->
### Description
As an [Actor], I want [feature] so that [why].
### Acceptance Criteria
* [Criteria 1]
### Steps to Reproduce (Bug)
1. [Step 1]
2. [Step 2]
3. [Step ...]
**Expected behavior:** [What you expect to happen]
**Actual behavior:** [What actually happens]
**Frequency:** [What percentage of the time does it occur?]
### Logs (if a bug)
Please post relevant logs from Besu (and the consensus client, if running proof of stake) from before and after the issue.
### Versions (Add all that apply)
* Software version: [`besu --version`]

@ -4,6 +4,7 @@
- Added isLabelsObserved to LabelledGauge in plugin-api. Default implementation returns false.
### Breaking Changes
- Removed Retesteth rpc service and commands [#7833](https://github.com/hyperledger/besu/pull/7783)
### Upcoming Breaking Changes

@ -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<String> runCommand;
private PrivacyParameters privacyParameters = PrivacyParameters.DEFAULT;
@ -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,
@ -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() {

@ -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;
@ -57,6 +57,7 @@ import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.metrics.MetricCategoryRegistryImpl;
import org.hyperledger.besu.metrics.MetricsSystemModule;
import org.hyperledger.besu.metrics.ObservableMetricsSystem;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
import org.hyperledger.besu.plugin.data.EnodeURL;
import org.hyperledger.besu.plugin.services.BesuConfiguration;
@ -406,9 +407,18 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
}
}
@Module
public static class ThreadBesuNodeRunnerModule {
@Provides
@Singleton
public ThreadBesuNodeRunner provideThreadBesuNodeRunner() {
return new ThreadBesuNodeRunner();
}
}
@Module
@SuppressWarnings("CloseableProvides")
static class BesuControllerModule {
public static class BesuControllerModule {
@Provides
@Singleton
public SynchronizerConfiguration provideSynchronizationConfiguration() {
@ -438,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)
@ -451,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();
@ -554,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();
@ -569,17 +579,26 @@ 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;
}
}
@Module
static class MockBesuCommandModule {
public static class ObservableMetricsSystemModule {
@Provides
@Singleton
public ObservableMetricsSystem provideObservableMetricsSystem() {
return new NoOpMetricsSystem();
}
}
@Module
public static class MockBesuCommandModule {
@Provides
BesuCommand provideBesuCommand(final BesuPluginContextImpl pluginContext) {
@ -610,6 +629,8 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
modules = {
ThreadBesuNodeRunner.BesuControllerModule.class,
ThreadBesuNodeRunner.MockBesuCommandModule.class,
ThreadBesuNodeRunner.ObservableMetricsSystemModule.class,
ThreadBesuNodeRunnerModule.class,
BonsaiCachedMerkleTrieLoaderModule.class,
MetricsSystemModule.class,
ThreadBesuNodeRunner.BesuNodeProviderModule.class,
@ -625,5 +646,9 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
RpcEndpointServiceImpl rpcEndpointService();
BlockchainServiceImpl blockchainService();
ObservableMetricsSystem getObservableMetricsSystem();
ThreadBesuNodeRunner getThreadBesuNodeRunner();
}
}

@ -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<Path> dataPath;
private final MiningParameters miningParameters;
private final MiningConfiguration miningConfiguration;
private final TransactionPoolConfiguration transactionPoolConfiguration;
private final JsonRpcConfiguration jsonRpcConfiguration;
private final Optional<JsonRpcConfiguration> engineRpcConfiguration;
@ -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,
@ -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;
@ -154,8 +154,8 @@ public class BesuNodeConfiguration {
return name;
}
public MiningParameters getMiningParameters() {
return miningParameters;
public MiningConfiguration getMiningParameters() {
return miningConfiguration;
}
public TransactionPoolConfiguration getTransactionPoolConfiguration() {

@ -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<Path> 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),

@ -31,6 +31,7 @@ dependencies {
api 'org.slf4j:slf4j-api'
implementation project(':crypto:algorithms')
implementation project(':ethereum:eth')
testImplementation project(':acceptance-tests:dsl')
testImplementation project(':acceptance-tests:test-plugins')
@ -42,6 +43,7 @@ dependencies {
testImplementation project(':ethereum:api')
testImplementation project(':ethereum:core')
testImplementation project(path: ':ethereum:core', configuration: 'testSupportArtifacts')
testImplementation project(':ethereum:eth')
testImplementation project(':ethereum:p2p')
testImplementation project(':ethereum:permissioning')
testImplementation project(':ethereum:rlp')
@ -78,6 +80,8 @@ dependencies {
testImplementation 'org.web3j:besu'
testImplementation 'org.web3j:core'
testImplementation 'org.wiremock:wiremock'
testImplementation 'com.google.dagger:dagger'
testAnnotationProcessor 'com.google.dagger:dagger-compiler'
testImplementation project(path: ':acceptance-tests:tests:shanghai')
}

@ -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)

@ -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> 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<Capability> supportedCapabilities,
@ -1308,7 +1308,7 @@ public class RunnerBuilder {
protocolContext,
filterManager,
transactionPool,
miningParameters,
miningConfiguration,
miningCoordinator,
metricsSystem,
supportedCapabilities,

@ -74,7 +74,6 @@ import org.hyperledger.besu.cli.presynctasks.PreSynchronizationTaskRunner;
import org.hyperledger.besu.cli.presynctasks.PrivateDatabaseMigrationPreSyncTask;
import org.hyperledger.besu.cli.subcommands.PasswordSubCommand;
import org.hyperledger.besu.cli.subcommands.PublicKeySubCommand;
import org.hyperledger.besu.cli.subcommands.RetestethSubCommand;
import org.hyperledger.besu.cli.subcommands.TxParseSubCommand;
import org.hyperledger.besu.cli.subcommands.ValidateConfigSubCommand;
import org.hyperledger.besu.cli.subcommands.blocks.BlocksSubCommand;
@ -114,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;
@ -339,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;
@ -1105,7 +1104,6 @@ public class BesuCommand implements DefaultCommandValues, Runnable {
PublicKeySubCommand.COMMAND_NAME, new PublicKeySubCommand(commandLine.getOut()));
commandLine.addSubcommand(
PasswordSubCommand.COMMAND_NAME, new PasswordSubCommand(commandLine.getOut()));
commandLine.addSubcommand(RetestethSubCommand.COMMAND_NAME, new RetestethSubCommand());
commandLine.addSubcommand(
RLPSubCommand.COMMAND_NAME, new RLPSubCommand(commandLine.getOut(), in));
commandLine.addSubcommand(
@ -2119,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())
@ -2171,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(

@ -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<MiningParameters> {
public class MiningOptions implements CLIOptions<MiningConfiguration> {
@Option(
names = {"--miner-enabled"},
@ -300,43 +300,45 @@ public class MiningOptions implements CLIOptions<MiningParameters> {
}
}
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<MiningParameters> {
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<MiningParameters> {
.nonPoaBlockTxsSelectionMaxTime(nonPoaBlockTxsSelectionMaxTime)
.poaBlockTxsSelectionMaxTime(poaBlockTxsSelectionMaxTime)
.unstable(
ImmutableMiningParameters.Unstable.builder()
ImmutableMiningConfiguration.Unstable.builder()
.remoteSealersLimit(unstableOptions.remoteSealersLimit)
.remoteSealersTimeToLive(unstableOptions.remoteSealersTimeToLive)
.powJobTimeToLive(unstableOptions.powJobTimeToLive)

@ -1,149 +0,0 @@
/*
* Copyright ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.hyperledger.besu.cli.subcommands;
import static org.hyperledger.besu.cli.subcommands.RetestethSubCommand.COMMAND_NAME;
import org.hyperledger.besu.BesuInfo;
import org.hyperledger.besu.cli.DefaultCommandValues;
import org.hyperledger.besu.cli.custom.JsonRPCAllowlistHostsProperty;
import org.hyperledger.besu.cli.options.stable.LoggingLevelOption;
import org.hyperledger.besu.cli.util.VersionProvider;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
import org.hyperledger.besu.ethereum.retesteth.RetestethConfiguration;
import org.hyperledger.besu.ethereum.retesteth.RetestethService;
import org.hyperledger.besu.util.LogConfigurator;
import java.net.InetAddress;
import java.nio.file.Path;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import picocli.CommandLine.Command;
import picocli.CommandLine.Mixin;
import picocli.CommandLine.Option;
/** Subcommand to run a Retesteth compatible server for reference tests. */
@Command(
name = COMMAND_NAME,
description = "Run a Retesteth compatible server for reference tests.",
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class)
@SuppressWarnings("unused")
public class RetestethSubCommand implements Runnable {
private static final Logger LOG = LoggerFactory.getLogger(RetestethSubCommand.class);
/** The constant COMMAND_NAME. */
public static final String COMMAND_NAME = "retesteth";
/**
* Using a distinct port for retesteth will result in less testing collisions and accidental RPC
* calls. This is <code>0xba5e</code> in hex, a hex speak play on the english translation of
* "Besu."
*/
public static final int RETESTETH_PORT = 47710;
@Option(
names = {"--data-path"},
paramLabel = DefaultCommandValues.MANDATORY_PATH_FORMAT_HELP,
description = "The path to Besu data directory (default: ${DEFAULT-VALUE})")
private final Path dataPath = DefaultCommandValues.getDefaultBesuDataPath(this);
@Mixin private LoggingLevelOption loggingLevelOption;
@SuppressWarnings({"FieldCanBeFinal", "FieldMayBeFinal"}) // PicoCLI requires non-final Strings.
@Option(
names = {"--rpc-http-host"},
paramLabel = DefaultCommandValues.MANDATORY_HOST_FORMAT_HELP,
description = "Host for Retesteth JSON-RPC HTTP to listen on (default: ${DEFAULT-VALUE})",
arity = "1")
private String rpcHttpHost = autoDiscoverDefaultIP().getHostAddress();
@Option(
names = {"--rpc-http-port"},
paramLabel = DefaultCommandValues.MANDATORY_PORT_FORMAT_HELP,
description = "Port for Retesteth JSON-RPC HTTP to listen on (default: ${DEFAULT-VALUE})",
arity = "1")
private final Integer rpcHttpPort = RETESTETH_PORT;
@Option(
names = {"--host-allowlist", "--host-whitelist"},
paramLabel = "<hostname>[,<hostname>...]... or * or all",
description =
"Comma separated list of hostnames to allow for RPC access, or * to accept any host (default: ${DEFAULT-VALUE})",
defaultValue = "localhost,127.0.0.1")
private final JsonRPCAllowlistHostsProperty hostsAllowlist = new JsonRPCAllowlistHostsProperty();
private InetAddress autoDiscoveredDefaultIP;
/** Default Constructor. */
public RetestethSubCommand() {}
// Used to discover the default IP of the client.
// Loopback IP is used by default as this is how smokeTests require it to be
// and it's probably a good security behaviour to default only on the localhost.
private InetAddress autoDiscoverDefaultIP() {
if (autoDiscoveredDefaultIP != null) {
return autoDiscoveredDefaultIP;
}
autoDiscoveredDefaultIP = InetAddress.getLoopbackAddress();
return autoDiscoveredDefaultIP;
}
private void prepareLogging() {
// set log level per CLI flags
final String logLevel = loggingLevelOption.getLogLevel();
if (logLevel != null) {
System.out.println("Setting logging level to " + logLevel);
LogConfigurator.setLevel("", logLevel);
}
}
@Override
public void run() {
prepareLogging();
final RetestethConfiguration retestethConfiguration = new RetestethConfiguration(dataPath);
final JsonRpcConfiguration jsonRpcConfiguration = JsonRpcConfiguration.createDefault();
jsonRpcConfiguration.setHost(rpcHttpHost);
jsonRpcConfiguration.setPort(rpcHttpPort);
jsonRpcConfiguration.setHostsAllowlist(hostsAllowlist);
final RetestethService retestethService =
new RetestethService(BesuInfo.version(), retestethConfiguration, jsonRpcConfiguration);
Runtime.getRuntime()
.addShutdownHook(
new Thread(
() -> {
try {
retestethService.close();
LogConfigurator.shutdown();
} catch (final Exception e) {
LOG.error("Failed to stop Besu Retesteth");
}
}));
retestethService.start();
try {
Thread.sleep(Long.MAX_VALUE); // Is there a better way?
} catch (final InterruptedException e) {
// e.printStackTrace();
}
}
}

@ -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();
}

@ -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<Closeable> 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<Closeable> 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;
}
/**

@ -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<PeerValidator> 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);

@ -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()
@ -132,10 +132,9 @@ public class CliqueBesuControllerBuilder extends BesuControllerBuilder {
genesisConfigOptions,
forksSchedule,
nodeKey,
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
miningParameters,
miningConfiguration,
badBlockManager,
isParallelTxProcessingEnabled,
metricsSystem);
@ -172,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);
}

@ -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

@ -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);

@ -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;
@ -31,6 +31,8 @@ import org.hyperledger.besu.ethereum.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.worldstate.WorldStateArchive;
import java.util.Optional;
/** The Mainnet besu controller builder. */
public class MainnetBesuControllerBuilder extends BesuControllerBuilder {
@ -44,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) {
@ -53,7 +55,7 @@ public class MainnetBesuControllerBuilder extends BesuControllerBuilder {
protocolContext,
protocolSchedule,
transactionPool,
miningParameters,
miningConfiguration,
new DefaultBlockScheduler(
MainnetBlockHeaderValidator.MINIMUM_SECONDS_SINCE_PARENT,
MainnetBlockHeaderValidator.TIMESTAMP_TOLERANCE_S,
@ -66,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();
}
@ -95,10 +97,10 @@ public class MainnetBesuControllerBuilder extends BesuControllerBuilder {
protected ProtocolSchedule createProtocolSchedule() {
return MainnetProtocolSchedule.fromConfig(
genesisConfigOptions,
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
miningParameters,
Optional.of(privacyParameters),
Optional.of(isRevertReasonEnabled),
Optional.of(evmConfiguration),
super.miningConfiguration,
badBlockManager,
isParallelTxProcessingEnabled,
metricsSystem);

@ -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);

@ -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;
}
}

@ -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);

@ -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

@ -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 = MiningParameters.newDefault();
private MiningConfiguration miningConfiguration;
private Optional<String> rpcHttpHost = Optional.of("http://localhost");
private Optional<Integer> 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

@ -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())

@ -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()));

@ -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)

@ -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())

@ -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));

@ -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)

@ -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)

@ -17,9 +17,10 @@ package org.hyperledger.besu.chainimport;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
import org.hyperledger.besu.components.BesuCommandModule;
import org.hyperledger.besu.components.BesuComponent;
import org.hyperledger.besu.components.BesuPluginContextModule;
import org.hyperledger.besu.config.GenesisConfigFile;
import org.hyperledger.besu.config.JsonUtil;
import org.hyperledger.besu.controller.BesuController;
@ -31,17 +32,21 @@ 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;
import org.hyperledger.besu.ethereum.core.components.MiningParametersModule;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.SyncMode;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.BlobCacheModule;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.trie.diffbased.bonsai.cache.BonsaiCachedMerkleTrieLoader;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.metrics.MetricsSystemModule;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import org.hyperledger.besu.testutil.TestClock;
@ -52,9 +57,13 @@ import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Stream;
import javax.inject.Singleton;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.io.Resources;
import dagger.Component;
import dagger.Module;
import dagger.Provides;
import org.apache.tuweni.bytes.Bytes;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@ -449,7 +458,7 @@ public abstract class JsonBlockImporterTest {
.storageProvider(new InMemoryKeyValueStorageProvider())
.networkId(BigInteger.valueOf(10))
.miningParameters(
ImmutableMiningParameters.builder()
ImmutableMiningConfiguration.builder()
.mutableInitValues(
MutableInitValues.builder()
.isMiningEnabled(true)
@ -465,7 +474,28 @@ public abstract class JsonBlockImporterTest {
.gasLimitCalculator(GasLimitCalculator.constant())
.evmConfiguration(EvmConfiguration.DEFAULT)
.networkConfiguration(NetworkingConfiguration.create())
.besuComponent(mock(BesuComponent.class))
.besuComponent(DaggerJsonBlockImporterTest_JsonBlockImportComponent.builder().build())
.build();
}
@Module
public static class JsonBlockImporterModule {
@Provides
BonsaiCachedMerkleTrieLoader provideCachedMerkleTrieLoaderModule() {
return new BonsaiCachedMerkleTrieLoader(new NoOpMetricsSystem());
}
}
@Singleton
@Component(
modules = {
BesuCommandModule.class,
MiningParametersModule.class,
MetricsSystemModule.class,
JsonBlockImporterModule.class,
BesuPluginContextModule.class,
BlobCacheModule.class
})
interface JsonBlockImportComponent extends BesuComponent {}
}

@ -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)

@ -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<MiningParameters> miningArg =
ArgumentCaptor.forClass(MiningParameters.class);
final ArgumentCaptor<MiningConfiguration> miningArg =
ArgumentCaptor.forClass(MiningConfiguration.class);
verify(mockControllerBuilder).synchronizerConfiguration(syncConfigurationCaptor.capture());
verify(mockControllerBuilder).dataDirectory(isNotNull());
verify(mockControllerBuilder).miningParameters(miningArg.capture());

@ -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())

@ -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<MiningParameters, MiningOptions> {
public class MiningOptionsTest extends AbstractCLIOptionsTest<MiningConfiguration, MiningOptions> {
@Test
public void besuDoesNotStartInMiningModeIfCoinbaseNotSet() {
@ -390,13 +390,13 @@ public class MiningOptionsTest extends AbstractCLIOptionsTest<MiningParameters,
}
@Override
protected MiningParameters createDefaultDomainObject() {
return MiningParameters.newDefault();
protected MiningConfiguration createDefaultDomainObject() {
return MiningConfiguration.newDefault();
}
@Override
protected MiningParameters createCustomizedDomainObject() {
return ImmutableMiningParameters.builder()
protected MiningConfiguration createCustomizedDomainObject() {
return ImmutableMiningConfiguration.builder()
.mutableInitValues(
MutableInitValues.builder()
.isMiningEnabled(true)
@ -410,7 +410,7 @@ public class MiningOptionsTest extends AbstractCLIOptionsTest<MiningParameters,
}
@Override
protected MiningOptions optionsFromDomainObject(final MiningParameters domainObject) {
protected MiningOptions optionsFromDomainObject(final MiningConfiguration domainObject) {
return MiningOptions.fromConfig(domainObject);
}
@ -424,11 +424,11 @@ public class MiningOptionsTest extends AbstractCLIOptionsTest<MiningParameters,
return new String[] {"transactionSelectionService"};
}
private MiningParameters runtimeConfiguration(
final TestBesuCommand besuCommand, final MiningParameters miningParameters) {
private MiningConfiguration runtimeConfiguration(
final TestBesuCommand besuCommand, final MiningConfiguration miningConfiguration) {
if (besuCommand.getGenesisConfigOptions().isPoa()) {
miningParameters.setBlockPeriodSeconds(POA_BLOCK_PERIOD_SECONDS);
miningConfiguration.setBlockPeriodSeconds(POA_BLOCK_PERIOD_SECONDS);
}
return miningParameters;
return miningConfiguration;
}
}

@ -34,7 +34,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.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.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
@ -90,7 +90,7 @@ public abstract class AbstractBftBesuControllerBuilderTest {
TransactionPoolConfiguration.DEFAULT;
private final ObservableMetricsSystem observableMetricsSystem = new NoOpMetricsSystem();
protected final ObjectMapper objectMapper = new ObjectMapper();
private final MiningParameters miningParameters = MiningParameters.newDefault();
private final MiningConfiguration miningConfiguration = MiningConfiguration.newDefault();
@TempDir Path tempDir;
@BeforeEach
@ -146,7 +146,7 @@ public abstract class AbstractBftBesuControllerBuilderTest {
.synchronizerConfiguration(synchronizerConfiguration)
.ethProtocolConfiguration(ethProtocolConfiguration)
.networkId(networkId)
.miningParameters(miningParameters)
.miningParameters(miningConfiguration)
.metricsSystem(observableMetricsSystem)
.privacyParameters(privacyParameters)
.dataDirectory(tempDir)
@ -199,8 +199,8 @@ public abstract class AbstractBftBesuControllerBuilderTest {
protocolContext.getBlockchain().appendBlock(block1, List.of());
assertThat(miningParameters.getBlockPeriodSeconds()).isNotEmpty().hasValue(2);
assertThat(miningParameters.getBlockTxsSelectionMaxTime()).isEqualTo(2000 * 75 / 100);
assertThat(miningConfiguration.getBlockPeriodSeconds()).isNotEmpty().hasValue(2);
assertThat(miningConfiguration.getBlockTxsSelectionMaxTime()).isEqualTo(2000 * 75 / 100);
}
protected abstract BlockHeaderFunctions getBlockHeaderFunctions();

@ -37,7 +37,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.PrivacyParameters;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
@ -95,7 +95,7 @@ public class CliqueBesuControllerBuilderTest {
TransactionPoolConfiguration.DEFAULT;
private final ObservableMetricsSystem observableMetricsSystem = new NoOpMetricsSystem();
private final ObjectMapper objectMapper = new ObjectMapper();
private final MiningParameters miningParameters = MiningParameters.newDefault();
private final MiningConfiguration miningConfiguration = MiningConfiguration.newDefault();
@TempDir Path tempDir;
@ -179,7 +179,7 @@ public class CliqueBesuControllerBuilderTest {
.synchronizerConfiguration(synchronizerConfiguration)
.ethProtocolConfiguration(ethProtocolConfiguration)
.networkId(networkId)
.miningParameters(miningParameters)
.miningParameters(miningConfiguration)
.metricsSystem(observableMetricsSystem)
.privacyParameters(privacyParameters)
.dataDirectory(tempDir)
@ -228,7 +228,7 @@ public class CliqueBesuControllerBuilderTest {
protocolContext.getBlockchain().appendBlock(block1, List.of());
assertThat(miningParameters.getBlockPeriodSeconds()).isNotEmpty().hasValue(2);
assertThat(miningParameters.getBlockTxsSelectionMaxTime()).isEqualTo(2000 * 75 / 100);
assertThat(miningConfiguration.getBlockPeriodSeconds()).isNotEmpty().hasValue(2);
assertThat(miningConfiguration.getBlockTxsSelectionMaxTime()).isEqualTo(2000 * 75 / 100);
}
}

@ -32,7 +32,7 @@ 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.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;
@ -135,7 +135,7 @@ public class ConsensusScheduleBesuControllerBuilderTest {
protocolSchedule1,
mockProtocolContext,
mock(TransactionPool.class),
mock(MiningParameters.class),
mock(MiningConfiguration.class),
mock(SyncState.class),
mock(EthProtocolManager.class));

@ -41,7 +41,7 @@ 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.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.SynchronizerConfiguration;
@ -95,7 +95,7 @@ public class MergeBesuControllerBuilderTest {
@Mock CheckpointConfigOptions checkpointConfigOptions;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
MiningParameters miningParameters;
MiningConfiguration miningConfiguration;
@Mock PrivacyParameters privacyParameters;
@Mock Clock clock;
@ -167,7 +167,7 @@ public class MergeBesuControllerBuilderTest {
lenient()
.when(worldStateKeyValueStorage.updater())
.thenReturn(mock(ForestWorldStateKeyValueStorage.Updater.class));
lenient().when(miningParameters.getTargetGasLimit()).thenReturn(OptionalLong.empty());
lenient().when(miningConfiguration.getTargetGasLimit()).thenReturn(OptionalLong.empty());
besuControllerBuilder = visitWithMockConfigs(new MergeBesuControllerBuilder());
}
@ -179,7 +179,7 @@ public class MergeBesuControllerBuilderTest {
.genesisConfigFile(genesisConfigFile)
.synchronizerConfiguration(synchronizerConfiguration)
.ethProtocolConfiguration(ethProtocolConfiguration)
.miningParameters(miningParameters)
.miningParameters(miningConfiguration)
.metricsSystem(observableMetricsSystem)
.privacyParameters(privacyParameters)
.dataDirectory(tempDir)

@ -32,7 +32,7 @@ import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.ethereum.ProtocolContext;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
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.mainnet.ProtocolSchedule;
import java.util.List;
@ -107,7 +107,7 @@ public class QbftBesuControllerBuilderTest extends AbstractBftBesuControllerBuil
assertThatThrownBy(
() ->
bftBesuControllerBuilder.createAdditionalJsonRpcMethodFactory(
protocolContext, protocolSchedule, MiningParameters.newDefault()))
protocolContext, protocolSchedule, MiningConfiguration.newDefault()))
.isInstanceOf(NullPointerException.class)
.hasMessage("transactionValidatorProvider should have been initialised");
}

@ -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);

@ -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(

@ -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());
}

@ -36,11 +36,13 @@ dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'com.google.guava:guava'
implementation 'com.google.dagger:dagger'
implementation 'info.picocli:picocli'
implementation 'io.tmio:tuweni-bytes'
implementation 'io.tmio:tuweni-units'
implementation "org.immutables:value-annotations"
annotationProcessor "org.immutables:value"
annotationProcessor 'com.google.dagger:dagger-compiler'
testImplementation project(':testutil')

@ -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) {
@ -110,12 +110,12 @@ public class CliqueProtocolSchedule {
return new ProtocolScheduleBuilder(
config,
DEFAULT_CHAIN_ID,
Optional.of(DEFAULT_CHAIN_ID),
specAdapters,
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);

@ -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,

@ -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<CliqueBlockMiner>
final ProtocolSchedule protocolSchedule,
final TransactionPool transactionPool,
final NodeKey nodeKey,
final MiningParameters miningParams,
final MiningConfiguration miningParams,
final AbstractBlockScheduler blockScheduler,
final EpochManager epochManager,
final ForksSchedule<CliqueConfigOptions> forksSchedule,
@ -97,7 +97,7 @@ public class CliqueMinerExecutor extends AbstractMinerExecutor<CliqueBlockMiner>
final Function<BlockHeader, CliqueBlockCreator> blockCreator =
(header) ->
new CliqueBlockCreator(
miningParameters,
miningConfiguration,
this::calculateExtraData,
transactionPool,
protocolContext,
@ -119,7 +119,7 @@ public class CliqueMinerExecutor extends AbstractMinerExecutor<CliqueBlockMiner>
@Override
public Optional<Address> getCoinbase() {
return miningParameters.getCoinbase();
return miningConfiguration.getCoinbase();
}
/**
@ -134,7 +134,7 @@ public class CliqueMinerExecutor extends AbstractMinerExecutor<CliqueBlockMiner>
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)) {

@ -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();

@ -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());

@ -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;
}
}

@ -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)

@ -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;
@ -38,6 +38,7 @@ import org.hyperledger.besu.plugin.services.MetricsSystem;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
/** Defines the protocol behaviours for a blockchain using a BFT consensus mechanism. */
@ -57,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
@ -71,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) {
@ -90,12 +91,12 @@ public abstract class BaseBftProtocolScheduleBuilder {
final ProtocolSchedule protocolSchedule =
new ProtocolScheduleBuilder(
config,
DEFAULT_CHAIN_ID,
Optional.of(DEFAULT_CHAIN_ID),
specAdapters,
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
miningParameters,
miningConfiguration,
badBlockManager,
isParallelTxProcessingEnabled,
metricsSystem)

@ -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<? extends BftConfigOptions> 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,

@ -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<T extends BftConfigOptions> {
protected final ForksSchedule<T> forksSchedule;
/** The Mining parameters */
protected final MiningParameters miningParameters;
protected final MiningConfiguration miningConfiguration;
private final TransactionPool transactionPool;
@ -89,7 +89,7 @@ public class BftBlockCreatorFactory<T extends BftConfigOptions> {
final ProtocolContext protocolContext,
final ProtocolSchedule protocolSchedule,
final ForksSchedule<T> forksSchedule,
final MiningParameters miningParams,
final MiningConfiguration miningParams,
final Address localAddress,
final BftExtraDataCodec bftExtraDataCodec,
final EthScheduler ethScheduler) {
@ -98,7 +98,7 @@ public class BftBlockCreatorFactory<T extends BftConfigOptions> {
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<T extends BftConfigOptions> {
*/
public BlockCreator create(final int round) {
return new BftBlockCreator(
miningParameters,
miningConfiguration,
forksSchedule,
localAddress,
ph -> createExtraData(round, ph),
@ -128,7 +128,7 @@ public class BftBlockCreatorFactory<T extends BftConfigOptions> {
* @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<T extends BftConfigOptions> {
* @return the min transaction gas price
*/
public Wei getMinTransactionGasPrice() {
return miningParameters.getMinTransactionGasPrice();
return miningConfiguration.getMinTransactionGasPrice();
}
/**
@ -146,7 +146,7 @@ public class BftBlockCreatorFactory<T extends BftConfigOptions> {
* @return min priority fee per gas
*/
public Wei getMinPriorityFeePerGas() {
return miningParameters.getMinPriorityFeePerGas();
return miningConfiguration.getMinPriorityFeePerGas();
}
/**
@ -171,7 +171,7 @@ public class BftBlockCreatorFactory<T extends BftConfigOptions> {
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<T extends BftConfigOptions> {
*/
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");
}

@ -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;
@ -172,12 +172,12 @@ public class CombinedProtocolScheduleFactoryTest {
final ProtocolScheduleBuilder protocolScheduleBuilder =
new ProtocolScheduleBuilder(
genesisConfigOptions,
BigInteger.ONE,
Optional.of(BigInteger.ONE),
ProtocolSpecAdapters.create(0, Function.identity()),
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
MiningConfiguration.MINING_DISABLED,
new BadBlockManager(),
false,
new NoOpMetricsSystem());

@ -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());

@ -76,4 +76,6 @@ dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.mockito:mockito-junit-jupiter'
testImplementation 'com.google.dagger:dagger'
testAnnotationProcessor 'com.google.dagger:dagger-compiler'
}

@ -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());

@ -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<BftConfigOptions> 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);

@ -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 =

@ -22,7 +22,6 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.hyperledger.besu.config.BftConfigOptions;
import org.hyperledger.besu.config.GenesisConfigOptions;
import org.hyperledger.besu.config.JsonGenesisConfigOptions;
import org.hyperledger.besu.config.JsonQbftConfigOptions;
import org.hyperledger.besu.config.JsonUtil;
@ -40,31 +39,39 @@ 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;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import org.hyperledger.besu.evm.internal.EvmConfiguration;
import org.hyperledger.besu.metrics.noop.NoOpMetricsSystem;
import java.math.BigInteger;
import java.util.Collection;
import java.util.List;
import javax.inject.Singleton;
import dagger.Component;
import dagger.Module;
import dagger.Provides;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class IbftProtocolScheduleTest {
private final BftExtraDataCodec bftExtraDataCodec = mock(BftExtraDataCodec.class);
private final BftExtraData bftExtraData = mock(BftExtraData.class);
private final NodeKey proposerNodeKey = NodeKeyUtils.generate();
private final Address proposerAddress = Util.publicKeyToAddress(proposerNodeKey.getPublicKey());
private final List<Address> validators = singletonList(proposerAddress);
private ProtocolContext protocolContext;
private List<Address> validators;
private NodeKey proposerNodeKey;
private TestEthCoreComponent component;
@BeforeEach
public void setup() {
when(bftExtraDataCodec.decode(any())).thenReturn(bftExtraData);
when(bftExtraData.getValidators()).thenReturn(validators);
TestEthCoreComponent component =
DaggerIbftProtocolScheduleTest_TestEthCoreComponent.builder().build();
this.component = component;
this.protocolContext = component.protocolContext();
this.validators = component.validators();
this.proposerNodeKey = component.nodeKey();
}
@Test
@ -81,52 +88,111 @@ public class IbftProtocolScheduleTest {
.buildHeader();
final BftProtocolSchedule schedule =
createProtocolSchedule(
JsonGenesisConfigOptions.fromJsonObject(JsonUtil.createEmptyObjectNode()),
List.of(
new ForkSpec<>(0, JsonQbftConfigOptions.DEFAULT),
new ForkSpec<>(1, arbitraryTransition),
new ForkSpec<>(2, JsonQbftConfigOptions.DEFAULT)));
createProtocolSchedule(component.bftExtraDataCodec(), arbitraryTransition);
assertThat(new MilestoneStreamingProtocolSchedule(schedule).streamMilestoneBlocks().count())
.isEqualTo(3);
assertThat(validateHeader(schedule, validators, parentHeader, blockHeader, 0)).isTrue();
assertThat(validateHeader(schedule, validators, parentHeader, blockHeader, 1)).isTrue();
assertThat(validateHeader(schedule, validators, parentHeader, blockHeader, 2)).isTrue();
assertThat(validateHeader(schedule, parentHeader, blockHeader, 0)).isTrue();
assertThat(validateHeader(schedule, parentHeader, blockHeader, 1)).isTrue();
assertThat(validateHeader(schedule, parentHeader, blockHeader, 2)).isTrue();
}
private boolean validateHeader(
final BftProtocolSchedule schedule,
final BlockHeader parentHeader,
final BlockHeader blockHeader,
final int block) {
return schedule
.getByBlockNumberOrTimestamp(block, blockHeader.getTimestamp())
.getBlockHeaderValidator()
.validateHeader(
blockHeader, parentHeader, this.protocolContext, HeaderValidationMode.LIGHT);
}
private BftProtocolSchedule createProtocolSchedule(
final GenesisConfigOptions genesisConfig, final List<ForkSpec<BftConfigOptions>> forks) {
final BftExtraDataCodec bftExtraDataCodec,
final MutableBftConfigOptions arbitraryTransition) {
var genesisConfig = JsonGenesisConfigOptions.fromJsonObject(JsonUtil.createEmptyObjectNode());
ForksSchedule<BftConfigOptions> forkSched =
new ForksSchedule<>(
List.of(
new ForkSpec<>(0, JsonQbftConfigOptions.DEFAULT),
new ForkSpec<>(1, arbitraryTransition),
new ForkSpec<>(2, JsonQbftConfigOptions.DEFAULT)));
return IbftProtocolScheduleBuilder.create(
genesisConfig,
new ForksSchedule<>(forks),
forkSched,
PrivacyParameters.DEFAULT,
false,
bftExtraDataCodec,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
MiningConfiguration.MINING_DISABLED,
new BadBlockManager(),
false,
new NoOpMetricsSystem());
}
private boolean validateHeader(
final BftProtocolSchedule schedule,
final List<Address> validators,
final BlockHeader parentHeader,
final BlockHeader blockHeader,
final int block) {
return schedule
.getByBlockNumberOrTimestamp(block, blockHeader.getTimestamp())
.getBlockHeaderValidator()
.validateHeader(
blockHeader, parentHeader, protocolContext(validators), HeaderValidationMode.LIGHT);
@Module
static class IbftProtocolScheduleModule {
@Provides
@Singleton
NodeKey nodeKey() {
return NodeKeyUtils.generate();
}
@Provides
Address provideProposerAddress(final NodeKey proposerNodeKey) {
return Util.publicKeyToAddress(proposerNodeKey.getPublicKey());
}
@Provides
List<Address> provideValidators(final Address proposerAddress) {
return singletonList(proposerAddress);
}
@Provides
public BftExtraData mockBftExtraData(final List<Address> validators) {
BftExtraData bftExtraData = mock(BftExtraData.class);
when(bftExtraData.getValidators()).thenReturn(validators);
return bftExtraData;
}
@Provides
public BftExtraDataCodec mockBftExtraDataCodec(final BftExtraData bftExtraData) {
BftExtraDataCodec bftExtraDataCodec = mock(BftExtraDataCodec.class);
when(bftExtraDataCodec.decode(any())).thenReturn(bftExtraData);
return bftExtraDataCodec;
}
@Provides
ProtocolContext protocolContext(
final List<Address> validators, final BftExtraDataCodec bftExtraDataCodec) {
return new ProtocolContext(
null,
null,
setupContextWithBftExtraDataEncoder(BftContext.class, validators, bftExtraDataCodec),
new BadBlockManager());
}
}
@Singleton
@Component(modules = {NoMiningParamters.class, IbftProtocolScheduleModule.class})
interface TestEthCoreComponent extends EthereumCoreComponent {
ProtocolContext protocolContext();
List<Address> validators();
NodeKey nodeKey();
BftExtraDataCodec bftExtraDataCodec();
}
private ProtocolContext protocolContext(final Collection<Address> validators) {
return new ProtocolContext(
null,
null,
setupContextWithBftExtraDataEncoder(BftContext.class, validators, bftExtraDataCodec),
new BadBlockManager());
@Module
static class NoMiningParamters {
@Provides
MiningConfiguration provideMiningParameters() {
return MiningConfiguration.MINING_DISABLED;
}
}
}

@ -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 ->

@ -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;
@ -180,12 +180,12 @@ public class IbftBlockHeightManagerTest {
final ProtocolScheduleBuilder protocolScheduleBuilder =
new ProtocolScheduleBuilder(
new StubGenesisConfigOptions(),
BigInteger.ONE,
Optional.empty(),
ProtocolSpecAdapters.create(0, Function.identity()),
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
MiningConfiguration.MINING_DISABLED,
new BadBlockManager(),
false,
new NoOpMetricsSystem());

@ -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) {
@ -101,12 +101,12 @@ public class MergeProtocolSchedule {
return new ProtocolScheduleBuilder(
config,
DEFAULT_CHAIN_ID,
Optional.of(DEFAULT_CHAIN_ID),
new ProtocolSpecAdapters(postMergeModifications),
privacyParameters,
isRevertReasonEnabled,
EvmConfiguration.DEFAULT,
miningParameters,
miningConfiguration,
badBlockManager,
isParallelTxProcessingEnabled,
metricsSystem)

@ -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);

@ -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,

@ -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<Address> 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<Address> 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<Hash> findValidAncestor(final Blockchain chain, final Hash parentHash) {

@ -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())

@ -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());

@ -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());

@ -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),

@ -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<QbftFork> 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());

@ -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<QbftConfigOptions> 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<QbftConfigOptions> 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);

@ -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<QbftConfigOp
final ProtocolContext protocolContext,
final ProtocolSchedule protocolSchedule,
final ForksSchedule<QbftConfigOptions> 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<QbftConfigOp
final BftExtraData extraData =
new BftExtraData(
ConsensusHelpers.zeroLeftPad(
miningParameters.getExtraData(), BftExtraDataCodec.EXTRA_VANITY_LENGTH),
miningConfiguration.getExtraData(), BftExtraDataCodec.EXTRA_VANITY_LENGTH),
Collections.emptyList(),
Optional.empty(),
round,

@ -30,7 +30,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis;
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.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.MiningConfiguration;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import java.util.Map;
@ -41,7 +41,7 @@ public class QbftJsonRpcMethods extends ApiGroupJsonRpcMethods {
private final ProtocolContext context;
private final ValidatorProvider readOnlyValidatorProvider;
private final ProtocolSchedule protocolSchedule;
private final MiningParameters miningParameters;
private final MiningConfiguration miningConfiguration;
private final BftConfigOptions bftConfig;
/**
@ -49,20 +49,20 @@ public class QbftJsonRpcMethods extends ApiGroupJsonRpcMethods {
*
* @param context the protocol context
* @param protocolSchedule the protocol schedule
* @param miningParameters the mining parameters
* @param miningConfiguration the mining parameters
* @param readOnlyValidatorProvider the read only validator provider
* @param bftConfig the BFT config options, containing QBFT-specific settings
*/
public QbftJsonRpcMethods(
final ProtocolContext context,
final ProtocolSchedule protocolSchedule,
final MiningParameters miningParameters,
final MiningConfiguration miningConfiguration,
final ValidatorProvider readOnlyValidatorProvider,
final BftConfigOptions bftConfig) {
this.context = context;
this.readOnlyValidatorProvider = readOnlyValidatorProvider;
this.protocolSchedule = protocolSchedule;
this.miningParameters = miningParameters;
this.miningConfiguration = miningConfiguration;
this.bftConfig = bftConfig;
}
@ -78,7 +78,7 @@ public class QbftJsonRpcMethods extends ApiGroupJsonRpcMethods {
protocolSchedule,
context.getBlockchain(),
context.getWorldStateArchive(),
miningParameters);
miningConfiguration);
final BftContext bftContext = context.getConsensusContext(BftContext.class);
final BlockInterface blockInterface = bftContext.getBlockInterface();
final ValidatorProvider validatorProvider = bftContext.getValidatorProvider();

@ -36,7 +36,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.mainnet.HeaderValidationMode;
@ -138,7 +138,7 @@ public class QbftProtocolScheduleTest {
false,
bftExtraDataCodec,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
MiningConfiguration.MINING_DISABLED,
new BadBlockManager(),
false,
new NoOpMetricsSystem());

@ -30,9 +30,9 @@ import org.hyperledger.besu.consensus.qbft.QbftExtraDataCodec;
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.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.eth.transactions.TransactionPool;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.testutil.DeterministicEthScheduler;
@ -50,8 +50,8 @@ public class QbftBlockCreatorFactoryTest {
@BeforeEach
@SuppressWarnings("unchecked")
public void setUp() {
final MiningParameters miningParams =
ImmutableMiningParameters.builder()
final MiningConfiguration miningParams =
ImmutableMiningConfiguration.builder()
.mutableInitValues(
MutableInitValues.builder()
.extraData(Bytes.wrap("Qbft tests".getBytes(UTF_8)))

@ -69,7 +69,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;
@ -182,12 +182,12 @@ public class QbftBlockHeightManagerTest {
final ProtocolScheduleBuilder protocolScheduleBuilder =
new ProtocolScheduleBuilder(
new StubGenesisConfigOptions(),
BigInteger.ONE,
Optional.of(BigInteger.ONE),
ProtocolSpecAdapters.create(0, Function.identity()),
new PrivacyParameters(),
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
MiningConfiguration.MINING_DISABLED,
new BadBlockManager(),
false,
new NoOpMetricsSystem());

@ -19,7 +19,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.core.Block;
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.mainnet.MainnetProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions;
@ -46,7 +46,7 @@ public class BlockchainImporter {
protocolSchedule =
MainnetProtocolSchedule.fromConfig(
GenesisConfigFile.fromConfig(genesisJson).getConfigOptions(),
MiningParameters.newDefault(),
MiningConfiguration.newDefault(),
new BadBlockManager(),
false,
new NoOpMetricsSystem());

@ -33,7 +33,7 @@ import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.chain.MutableBlockchain;
import org.hyperledger.besu.ethereum.core.Block;
import org.hyperledger.besu.ethereum.core.BlockImporter;
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;
@ -94,7 +94,7 @@ public class JsonRpcTestMethodsFactory {
}
this.blockchainQueries =
new BlockchainQueries(
protocolSchedule, blockchain, stateArchive, MiningParameters.newDefault());
protocolSchedule, blockchain, stateArchive, MiningConfiguration.newDefault());
}
public JsonRpcTestMethodsFactory(
@ -112,7 +112,7 @@ public class JsonRpcTestMethodsFactory {
importer.getProtocolSchedule(),
blockchain,
stateArchive,
MiningParameters.newDefault());
MiningConfiguration.newDefault());
this.synchronizer = mock(Synchronizer.class);
}
@ -133,7 +133,7 @@ public class JsonRpcTestMethodsFactory {
importer.getProtocolSchedule(),
blockchain,
stateArchive,
MiningParameters.newDefault());
MiningConfiguration.newDefault());
}
public BlockchainQueries getBlockchainQueries() {
@ -152,7 +152,7 @@ public class JsonRpcTestMethodsFactory {
final P2PNetwork peerDiscovery = mock(P2PNetwork.class);
final EthPeers ethPeers = mock(EthPeers.class);
final TransactionPool transactionPool = mock(TransactionPool.class);
final MiningParameters miningParameters = mock(MiningParameters.class);
final MiningConfiguration miningConfiguration = mock(MiningConfiguration.class);
final PoWMiningCoordinator miningCoordinator = mock(PoWMiningCoordinator.class);
final ObservableMetricsSystem metricsSystem = new NoOpMetricsSystem();
final Optional<AccountLocalConfigPermissioningController> accountWhitelistController =
@ -198,7 +198,7 @@ public class JsonRpcTestMethodsFactory {
context,
filterManager,
transactionPool,
miningParameters,
miningConfiguration,
miningCoordinator,
metricsSystem,
new HashSet<>(),

@ -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)

@ -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)

@ -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());
}
}

@ -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()));
}
}

@ -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()));
}
}

@ -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)

@ -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) {

@ -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);

@ -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<Capability> 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,

@ -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));
}
}

@ -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> transactionLogBloomCacher;
private final Optional<EthScheduler> 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<Path> cachePath,
final Optional<EthScheduler> 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<Path> cachePath,
final Optional<EthScheduler> 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,

@ -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<Capability> supportedCapabilities = new HashSet<>();
supportedCapabilities.add(EthProtocol.ETH62);

@ -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,

@ -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,

@ -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,

@ -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,

@ -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,

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save