Skip to content

Commit

Permalink
Merge branch 'main' into reftests_pre_cancun
Browse files Browse the repository at this point in the history
Signed-off-by: Sally MacFarlane <[email protected]>
  • Loading branch information
macfarla authored Oct 25, 2023
2 parents a61a63b + 20a82d4 commit 52bdcb4
Show file tree
Hide file tree
Showing 86 changed files with 1,696 additions and 1,548 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ public void startNode(final BesuNode node) {
params.add(
Integer.toString(node.getMiningParameters().getMinTransactionGasPrice().intValue()));
params.add("--Xminer-remote-sealers-limit");
params.add(Integer.toString(node.getMiningParameters().getRemoteSealersLimit()));
params.add(
Integer.toString(node.getMiningParameters().getUnstable().getRemoteSealersLimit()));
params.add("--Xminer-remote-sealers-hashrate-ttl");
params.add(Long.toString(node.getMiningParameters().getRemoteSealersTimeToLive()));
params.add(
Long.toString(node.getMiningParameters().getUnstable().getRemoteSealersTimeToLive()));
}
if (node.getMiningParameters().isStratumMiningEnabled()) {
params.add("--miner-stratum-enabled");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@

import org.hyperledger.besu.cli.config.NetworkName;
import org.hyperledger.besu.crypto.KeyPair;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis;
import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.JwtAlgorithm;
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.PrivacyParameters;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
Expand All @@ -56,11 +57,11 @@ public class BesuNodeConfigurationBuilder {
private String name;
private Optional<Path> dataPath = Optional.empty();
private MiningParameters miningParameters =
new MiningParameters.Builder()
.miningEnabled(false)
.coinbase(AddressHelpers.ofValue(1))
.minTransactionGasPrice(Wei.of(1000))
ImmutableMiningParameters.builder()
.mutableInitValues(
MutableInitValues.builder().coinbase(AddressHelpers.ofValue(1)).build())
.build();

private JsonRpcConfiguration jsonRpcConfiguration = JsonRpcConfiguration.createDefault();
private JsonRpcConfiguration engineRpcConfiguration = JsonRpcConfiguration.createEngineDefault();
private WebSocketConfiguration webSocketConfiguration = WebSocketConfiguration.createDefault();
Expand Down Expand Up @@ -113,12 +114,7 @@ public BesuNodeConfigurationBuilder miningEnabled() {
}

public BesuNodeConfigurationBuilder miningEnabled(final boolean enabled) {
this.miningParameters =
new MiningParameters.Builder()
.miningEnabled(enabled)
.minTransactionGasPrice(Wei.of(1000))
.coinbase(AddressHelpers.ofValue(1))
.build();
this.miningParameters = miningParameters.setMiningEnabled(enabled);
this.jsonRpcConfiguration.addRpcApi(RpcApis.MINER.name());
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration;
import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration;
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.InMemoryPrivacyStorageProvider;
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
Expand Down Expand Up @@ -303,10 +305,13 @@ public BesuNode createNodeWithMultiTenantedPrivacy(
.build();

final MiningParameters miningParameters =
new MiningParameters.Builder()
.minTransactionGasPrice(Wei.ZERO)
.coinbase(AddressHelpers.ofValue(1))
.miningEnabled(true)
ImmutableMiningParameters.builder()
.mutableInitValues(
MutableInitValues.builder()
.isMiningEnabled(true)
.minTransactionGasPrice(Wei.ZERO)
.coinbase(AddressHelpers.ofValue(1))
.build())
.build();

return create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
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.tests.acceptance.dsl.account.Account;
import org.hyperledger.besu.tests.acceptance.dsl.blockchain.Amount;
Expand Down Expand Up @@ -59,10 +61,13 @@ public void shouldMineOnSingleNodeWithPaidGas_Berlin() throws Exception {
public void shouldMineOnSingleNodeWithFreeGas_Berlin() throws Exception {
final BesuNode minerNode = nodeFactory.createNode(besu, "miner1");
final MiningParameters zeroGasMiningParams =
new MiningParameters.Builder()
.miningEnabled(true)
.minTransactionGasPrice(Wei.ZERO)
.coinbase(AddressHelpers.ofValue(1))
ImmutableMiningParameters.builder()
.mutableInitValues(
MutableInitValues.builder()
.isMiningEnabled(true)
.minTransactionGasPrice(Wei.ZERO)
.coinbase(AddressHelpers.ofValue(1))
.build())
.build();
minerNode.setMiningParameters(zeroGasMiningParams);

Expand Down
2 changes: 1 addition & 1 deletion besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ public Runner build() {
powMiningCoordinator,
miningParameters.getStratumPort(),
miningParameters.getStratumNetworkInterface(),
miningParameters.getStratumExtranonce(),
miningParameters.getUnstable().getStratumExtranonce(),
metricsSystem));
miningCoordinator.addEthHashObserver(stratumServer.get());
LOG.debug("added ethash observer: {}", stratumServer.get());
Expand Down
Loading

0 comments on commit 52bdcb4

Please sign in to comment.