Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make transaction pool configurable in acceptance tests #33

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.TLSConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
Expand Down Expand Up @@ -100,6 +101,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable

private final String name;
private MiningParameters miningParameters;
private TransactionPoolConfiguration txPoolConfiguration;
private final List<String> runCommand;
private PrivacyParameters privacyParameters = PrivacyParameters.DEFAULT;
private final JsonRpcConfiguration jsonRpcConfiguration;
Expand Down Expand Up @@ -135,6 +137,7 @@ public BesuNode(
final String name,
final Optional<Path> dataPath,
final MiningParameters miningParameters,
final TransactionPoolConfiguration txPoolConfiguration,
final JsonRpcConfiguration jsonRpcConfiguration,
final Optional<JsonRpcConfiguration> engineRpcConfiguration,
final WebSocketConfiguration webSocketConfiguration,
Expand Down Expand Up @@ -184,6 +187,7 @@ public BesuNode(
() -> this.keyPair = KeyPairUtil.loadKeyPair(homeDirectory));
this.name = name;
this.miningParameters = miningParameters;
this.txPoolConfiguration = txPoolConfiguration;
this.jsonRpcConfiguration = jsonRpcConfiguration;
this.engineRpcConfiguration = engineRpcConfiguration;
this.webSocketConfiguration = webSocketConfiguration;
Expand Down Expand Up @@ -669,6 +673,15 @@ public void setMiningParameters(final MiningParameters miningParameters) {
this.miningParameters = miningParameters;
}

public TransactionPoolConfiguration getTransactionPoolConfiguration() {
return txPoolConfiguration;
}

public void setTransactionPoolConfiguration(
final TransactionPoolConfiguration txPoolConfiguration) {
this.txPoolConfiguration = txPoolConfiguration;
}

public PrivacyParameters getPrivacyParameters() {
return privacyParameters;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
import static com.google.common.base.Preconditions.checkState;
import static java.nio.charset.StandardCharsets.UTF_8;

import org.hyperledger.besu.cli.options.TransactionPoolOptions;
import org.hyperledger.besu.cli.options.unstable.NetworkingOptions;
import org.hyperledger.besu.ethereum.api.jsonrpc.ipc.JsonRpcIpcConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.ImmutableTransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.TLSConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
import org.hyperledger.besu.metrics.prometheus.MetricsConfiguration;
Expand Down Expand Up @@ -98,6 +100,15 @@ public void startNode(final BesuNode node) {
params.add("--p2p-port");
params.add(node.getP2pPort());

params.addAll(
TransactionPoolOptions.fromConfig(
ImmutableTransactionPoolConfiguration.builder()
.from(node.getTransactionPoolConfiguration())
.strictTransactionReplayProtectionEnabled(
node.isStrictTxReplayProtectionEnabled())
.build())
.getCLIOptions());

if (node.getMiningParameters().isMiningEnabled()) {
params.add("--miner-enabled");
params.add("--miner-coinbase");
Expand Down Expand Up @@ -391,9 +402,6 @@ public void startNode(final BesuNode node) {
params.add("--auto-log-bloom-caching-enabled");
params.add("false");

params.add("--strict-tx-replay-protection-enabled");
params.add(Boolean.toString(node.isStrictTxReplayProtectionEnabled()));

final String level = System.getProperty("root.log.level");
if (level != null) {
params.add("--logging=" + level);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ public void startNode(final BesuNode node) {

final TransactionPoolConfiguration txPoolConfig =
ImmutableTransactionPoolConfiguration.builder()
.from(node.getTransactionPoolConfiguration())
.strictTransactionReplayProtectionEnabled(node.isStrictTxReplayProtectionEnabled())
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketConfiguration;
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.TLSConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
Expand All @@ -39,6 +40,7 @@ public class BesuNodeConfiguration {
private final String name;
private final Optional<Path> dataPath;
private final MiningParameters miningParameters;
private final TransactionPoolConfiguration transactionPoolConfiguration;
private final JsonRpcConfiguration jsonRpcConfiguration;
private final Optional<JsonRpcConfiguration> engineRpcConfiguration;
private final WebSocketConfiguration webSocketConfiguration;
Expand Down Expand Up @@ -74,6 +76,7 @@ public class BesuNodeConfiguration {
final String name,
final Optional<Path> dataPath,
final MiningParameters miningParameters,
final TransactionPoolConfiguration transactionPoolConfiguration,
final JsonRpcConfiguration jsonRpcConfiguration,
final Optional<JsonRpcConfiguration> engineRpcConfiguration,
final WebSocketConfiguration webSocketConfiguration,
Expand Down Expand Up @@ -106,6 +109,7 @@ public class BesuNodeConfiguration {
final Map<String, String> environment) {
this.name = name;
this.miningParameters = miningParameters;
this.transactionPoolConfiguration = transactionPoolConfiguration;
this.jsonRpcConfiguration = jsonRpcConfiguration;
this.engineRpcConfiguration = engineRpcConfiguration;
this.webSocketConfiguration = webSocketConfiguration;
Expand Down Expand Up @@ -147,6 +151,10 @@ public MiningParameters getMiningParameters() {
return miningParameters;
}

public TransactionPoolConfiguration getTransactionPoolConfiguration() {
return transactionPoolConfiguration;
}

public JsonRpcConfiguration getJsonRpcConfiguration() {
return jsonRpcConfiguration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
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.eth.transactions.TransactionPoolConfiguration;
import org.hyperledger.besu.ethereum.p2p.config.NetworkingConfiguration;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.netty.TLSConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
Expand Down Expand Up @@ -63,7 +64,8 @@ public class BesuNodeConfigurationBuilder {
.mutableInitValues(
MutableInitValues.builder().coinbase(AddressHelpers.ofValue(1)).build())
.build();

private TransactionPoolConfiguration transactionPoolConfiguration =
TransactionPoolConfiguration.DEFAULT;
private JsonRpcConfiguration jsonRpcConfiguration = JsonRpcConfiguration.createDefault();
private JsonRpcConfiguration engineRpcConfiguration = JsonRpcConfiguration.createEngineDefault();
private WebSocketConfiguration webSocketConfiguration = WebSocketConfiguration.createDefault();
Expand Down Expand Up @@ -128,6 +130,12 @@ public BesuNodeConfigurationBuilder miningConfiguration(final MiningParameters m
return this;
}

public BesuNodeConfigurationBuilder transactionPoolConfiguration(
final TransactionPoolConfiguration transactionPoolConfiguration) {
this.transactionPoolConfiguration = transactionPoolConfiguration;
return this;
}

public BesuNodeConfigurationBuilder jsonRpcConfiguration(
final JsonRpcConfiguration jsonRpcConfiguration) {
this.jsonRpcConfiguration = jsonRpcConfiguration;
Expand Down Expand Up @@ -503,6 +511,7 @@ public BesuNodeConfiguration build() {
name,
dataPath,
miningParameters,
transactionPoolConfiguration,
jsonRpcConfiguration,
Optional.of(engineRpcConfiguration),
webSocketConfiguration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public BesuNode create(final BesuNodeConfiguration config) throws IOException {
config.getName(),
config.getDataPath(),
config.getMiningParameters(),
config.getTransactionPoolConfiguration(),
config.getJsonRpcConfiguration(),
config.getEngineRpcConfiguration(),
config.getWebSocketConfiguration(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public PrivacyNode(
besuConfig.getName(),
besuConfig.getDataPath(),
besuConfig.getMiningParameters(),
besuConfig.getTransactionPoolConfiguration(),
besuConfig.getJsonRpcConfiguration(),
besuConfig.getEngineRpcConfiguration(),
besuConfig.getWebSocketConfiguration(),
Expand Down
Loading