Skip to content
Closed
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 @@ -17,7 +17,6 @@
import static java.util.Arrays.asList;
import static java.util.stream.Collectors.toList;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.ADMIN;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.CLIQUE;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.IBFT;
import static org.hyperledger.besu.ethereum.api.jsonrpc.RpcApis.PLUGINS;
import static org.hyperledger.besu.tests.acceptance.dsl.transaction.bft.ConsensusType.QBFT;
Expand All @@ -36,7 +35,6 @@
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode;
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationFactory;
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.genesis.GenesisConfigurationFactory.CliqueOptions;

import java.io.File;
import java.io.IOException;
Expand All @@ -46,7 +44,6 @@
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.UnaryOperator;

import org.apache.tuweni.bytes.Bytes;
Expand Down Expand Up @@ -122,16 +119,6 @@ public BesuNode createNode(
return create(configBuilder.build());
}

public Node createArchiveNodeThatMustNotBeTheBootnode(final String name) throws IOException {
return create(
new BesuNodeConfigurationBuilder()
.name(name)
.jsonRpcEnabled()
.webSocketEnabled()
.bootnodeEligible(false)
.build());
}

public Node createQbftNodeThatMustNotBeTheBootnode(final String name) throws IOException {
return createQbftNode(name, nodeConfigBuilder -> nodeConfigBuilder.bootnodeEligible(false));
}
Expand Down Expand Up @@ -233,15 +220,6 @@ public BesuNode createNodeWithAuthenticationUsingEcdsaJwtPublicKey(final String
.build());
}

public BesuNode createNodeWithP2pDisabled(final String name) throws IOException {
return create(
new BesuNodeConfigurationBuilder()
.name(name)
.p2pEnabled(false)
.jsonRpcConfiguration(node.createJsonRpcEnabledConfig())
.build());
}

public BesuNode createArchiveNodeWithRpcDisabled(final String name) throws IOException {
return create(new BesuNodeConfigurationBuilder().name(name).build());
}
Expand Down Expand Up @@ -310,40 +288,14 @@ public BesuNode createQbftNode(final String name) throws IOException {
return createQbftNode(name, UnaryOperator.identity());
}

public BesuNode createCliqueNode(final String name) throws IOException {
return createCliqueNode(name, UnaryOperator.identity());
}

public BesuNode createCliqueNode(
final String name, final UnaryOperator<BesuNodeConfigurationBuilder> configModifier)
throws IOException {
final List<String> enableRpcApis = new ArrayList<>(Arrays.asList());
enableRpcApis.addAll(List.of(IBFT.name(), ADMIN.name(), CLIQUE.name()));
BesuNodeConfigurationBuilder builder =
new BesuNodeConfigurationBuilder()
.name(name)
.jsonRpcConfiguration(
node.createJsonRpcWithRpcApiEnabledConfig(enableRpcApis.toArray(String[]::new)))
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false)
.jsonRpcTxPool()
.genesisConfigProvider(GenesisConfigurationFactory::createCliqueGenesisConfig);

builder = configModifier.apply(builder);

return create(builder.build());
}

public BesuNode createQbftNode(
final String name, final UnaryOperator<BesuNodeConfigurationBuilder> configModifier)
throws IOException {
final List<String> enableRpcApis = new ArrayList<>(Arrays.asList());
enableRpcApis.addAll(List.of(QBFT.name(), ADMIN.name()));
final String[] enableRpcApis = new String[] {QBFT.name(), ADMIN.name()};
BesuNodeConfigurationBuilder builder =
new BesuNodeConfigurationBuilder()
.name(name)
.jsonRpcConfiguration(
node.createJsonRpcWithRpcApiEnabledConfig(enableRpcApis.toArray(String[]::new)))
.jsonRpcConfiguration(node.createJsonRpcWithRpcApiEnabledConfig(enableRpcApis))
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false)
.jsonRpcTxPool()
Expand All @@ -358,68 +310,6 @@ public BesuNode createQbftNodeWithRevertReasonEnabled(final String name) throws
return createQbftNode(name, BesuNodeConfigurationBuilder::revertReasonEnabled);
}

public BesuNode createCliquePluginsNode(
final String name,
final List<String> plugins,
final List<String> extraCLIOptions,
final String... extraRpcApis)
throws IOException {

final List<String> enableRpcApis = new ArrayList<>(Arrays.asList(extraRpcApis));
enableRpcApis.addAll(List.of(IBFT.name(), ADMIN.name(), PLUGINS.name(), CLIQUE.name()));

return create(
new BesuNodeConfigurationBuilder()
.name(name)
.jsonRpcConfiguration(
node.createJsonRpcWithRpcApiEnabledConfig(enableRpcApis.toArray(String[]::new)))
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.plugins(plugins)
.extraCLIOptions(extraCLIOptions)
.devMode(false)
.jsonRpcTxPool()
.genesisConfigProvider(
validators ->
GenesisConfigurationFactory.createCliqueGenesisConfig(
validators, CliqueOptions.DEFAULT))
.build());
}

public BesuNode createCliqueNode(final String name, final CliqueOptions cliqueOptions)
throws IOException {
return createCliqueNodeWithExtraCliOptionsAndRpcApis(name, cliqueOptions, List.of());
}

public BesuNode createCliqueNodeWithExtraCliOptionsAndRpcApis(
final String name, final CliqueOptions cliqueOptions, final List<String> extraCliOptions)
throws IOException {
return createCliqueNodeWithExtraCliOptionsAndRpcApis(
name, cliqueOptions, extraCliOptions, Set.of());
}

public BesuNode createCliqueNodeWithExtraCliOptionsAndRpcApis(
final String name,
final CliqueOptions cliqueOptions,
final List<String> extraCliOptions,
final Set<String> extraRpcApis)
throws IOException {
return create(
new BesuNodeConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(node.createJsonRpcWithCliqueEnabledConfig(extraRpcApis))
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.inProcessRpcConfiguration(node.createInProcessRpcConfiguration(extraRpcApis))
.devMode(false)
.jsonRpcTxPool()
.genesisConfigProvider(
validators ->
GenesisConfigurationFactory.createCliqueGenesisConfig(
validators, cliqueOptions))
.extraCLIOptions(extraCliOptions)
.build());
}

public BesuNode createIbft2NonValidatorBootnode(final String name, final String genesisFile)
throws IOException {
return create(
Expand Down Expand Up @@ -463,22 +353,6 @@ public BesuNode createIbft2NodeWithLocalAccountPermissioning(
.build());
}

public BesuNode createIbft2Node(final String name, final String genesisFile) throws IOException {
return create(
new BesuNodeConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(node.createJsonRpcWithIbft2AdminEnabledConfig())
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(
validators ->
GenesisConfigurationFactory.createIbft2GenesisConfigFilterBootnode(
validators, genesisFile))
.bootnodeEligible(false)
.build());
}

public BesuNode createIbft2Node(
final String name, final boolean fixedPort, final DataStorageFormat storageFormat)
throws IOException {
Expand Down Expand Up @@ -659,34 +533,6 @@ public BesuNode createExecutionEngineGenesisNode(final String name, final String
.build());
}

public BesuNode createCliqueNodeWithValidators(final String name, final String... validators)
throws IOException {
return createCliqueNodeWithValidators(name, CliqueOptions.DEFAULT, validators);
}

public BesuNode createCliqueNodeWithValidators(
final String name, final CliqueOptions cliqueOptions, final String... validators)
throws IOException {

return create(
new BesuNodeConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(node.createJsonRpcWithCliqueEnabledConfig(Set.of()))
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.jsonRpcTxPool()
.devMode(false)
.genesisConfigProvider(
nodes ->
node.createGenesisConfigForValidators(
asList(validators),
nodes,
vs ->
GenesisConfigurationFactory.createCliqueGenesisConfig(
vs, cliqueOptions)))
.build());
}

public BesuNode createIbft2NodeWithValidators(final String name, final String... validators)
throws IOException {

Expand All @@ -706,25 +552,6 @@ public BesuNode createIbft2NodeWithValidators(final String name, final String...
.build());
}

public BesuNode createQbftTLSNodeWithValidators(
final String name, final String type, final String... validators) throws IOException {

return create(
new BesuNodeConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(node.createJsonRpcWithIbft2EnabledConfig(false))
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(
nodes ->
node.createGenesisConfigForValidators(
asList(validators),
nodes,
GenesisConfigurationFactory::createIbft2GenesisConfig))
.build());
}

public BesuNode createQbftNodeWithValidators(final String name, final String... validators)
throws IOException {

Expand Down Expand Up @@ -789,33 +616,22 @@ private BesuNodeConfigurationBuilder createConfigurationBuilderWithStaticNodes(
}

public BesuNode createNodeWithNonDefaultSignatureAlgorithm(
final String name,
final String genesisPath,
final KeyPair keyPair,
final List<Node> staticNodes)
throws IOException {
final String name, final KeyPair keyPair, final List<Node> staticNodes) throws IOException {
BesuNodeConfigurationBuilder builder =
createNodeConfigurationWithNonDefaultSignatureAlgorithm(
name, genesisPath, keyPair, staticNodes);
createNodeConfigurationWithNonDefaultSignatureAlgorithm(name, keyPair, staticNodes);
return create(builder.build());
}

public BesuNodeConfigurationBuilder createNodeConfigurationWithNonDefaultSignatureAlgorithm(
final String name,
final String genesisPath,
final KeyPair keyPair,
final List<Node> staticNodes) {

final List<String> enableRpcApis = new ArrayList<>(Arrays.asList());
enableRpcApis.addAll(List.of(QBFT.name(), ADMIN.name()));
final String name, final KeyPair keyPair, final List<Node> staticNodes) {

final String[] enableRpcApis = new String[] {QBFT.name(), ADMIN.name()};
BesuNodeConfigurationBuilder builder =
createConfigurationBuilderWithStaticNodes(name, staticNodes);

builder =
builder
.jsonRpcConfiguration(
node.createJsonRpcWithRpcApiEnabledConfig(enableRpcApis.toArray(String[]::new)))
.jsonRpcConfiguration(node.createJsonRpcWithRpcApiEnabledConfig(enableRpcApis))
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false)
.jsonRpcTxPool()
Expand Down

This file was deleted.

This file was deleted.

Loading