Skip to content

Commit

Permalink
fix ThreadBesuNodeRunner missing engineRpcConfiguration (hyperledger#…
Browse files Browse the repository at this point in the history
…3974)

* fix ThreadBesuNodeRunner engineRpcConfiguration
* fix test dsl BesuNode MergeConfigOptions setting

Signed-off-by: Pedro Novais <jpvnovais@gmail.com>

Co-authored-by: Sally MacFarlane <sally.macfarlane@consensys.net>
  • Loading branch information
jpnovais and macfarla authored Jun 17, 2022
1 parent e29c654 commit d5739fb
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import static org.apache.tuweni.io.file.Files.copyResource;

import org.hyperledger.besu.cli.config.NetworkName;
import org.hyperledger.besu.config.MergeConfigOptions;
import org.hyperledger.besu.crypto.KeyPair;
import org.hyperledger.besu.crypto.KeyPairUtil;
import org.hyperledger.besu.datatypes.Address;
Expand Down Expand Up @@ -208,6 +209,8 @@ public BesuNode(
LOG.error("Could not find plugin \"{}\" in resources", pluginName);
}
});
engineRpcConfiguration.ifPresent(
config -> MergeConfigOptions.setMergeEnabled(config.isEnabled()));
this.extraCLIOptions = extraCLIOptions;
this.staticNodes = staticNodes;
this.isDnsEnabled = isDnsEnabled;
Expand Down Expand Up @@ -566,6 +569,10 @@ JsonRpcConfiguration jsonRpcConfiguration() {
return jsonRpcConfiguration;
}

Optional<JsonRpcConfiguration> engineRpcConfiguration() {
return engineRpcConfiguration;
}

Optional<String> jsonRpcListenHost() {
if (isJsonRpcEnabled()) {
return Optional.of(jsonRpcConfiguration().getHost());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,36 +190,37 @@ public void startNode(final BesuNode node) {
final RunnerBuilder runnerBuilder = new RunnerBuilder();
runnerBuilder.permissioningConfiguration(node.getPermissioningConfiguration());

final Runner runner =
runnerBuilder
.vertx(Vertx.vertx())
.besuController(besuController)
.ethNetworkConfig(ethNetworkConfig)
.discovery(node.isDiscoveryEnabled())
.p2pAdvertisedHost(node.getHostName())
.p2pListenPort(0)
.maxPeers(maxPeers)
.networkingConfiguration(node.getNetworkingConfiguration())
.jsonRpcConfiguration(node.jsonRpcConfiguration())
.webSocketConfiguration(node.webSocketConfiguration())
.jsonRpcIpcConfiguration(node.jsonRpcIpcConfiguration())
.dataDir(node.homeDirectory())
.metricsSystem(metricsSystem)
.permissioningService(new PermissioningServiceImpl())
.metricsConfiguration(node.getMetricsConfiguration())
.p2pEnabled(node.isP2pEnabled())
.p2pTLSConfiguration(node.getTLSConfiguration())
.graphQLConfiguration(GraphQLConfiguration.createDefault())
.staticNodes(
node.getStaticNodes().stream()
.map(EnodeURLImpl::fromString)
.collect(Collectors.toList()))
.besuPluginContext(new BesuPluginContextImpl())
.autoLogBloomCaching(false)
.storageProvider(storageProvider)
.forkIdSupplier(() -> besuController.getProtocolManager().getForkIdAsBytesList())
.rpcEndpointService(new RpcEndpointServiceImpl())
.build();
runnerBuilder
.vertx(Vertx.vertx())
.besuController(besuController)
.ethNetworkConfig(ethNetworkConfig)
.discovery(node.isDiscoveryEnabled())
.p2pAdvertisedHost(node.getHostName())
.p2pListenPort(0)
.maxPeers(maxPeers)
.networkingConfiguration(node.getNetworkingConfiguration())
.jsonRpcConfiguration(node.jsonRpcConfiguration())
.webSocketConfiguration(node.webSocketConfiguration())
.jsonRpcIpcConfiguration(node.jsonRpcIpcConfiguration())
.dataDir(node.homeDirectory())
.metricsSystem(metricsSystem)
.permissioningService(new PermissioningServiceImpl())
.metricsConfiguration(node.getMetricsConfiguration())
.p2pEnabled(node.isP2pEnabled())
.p2pTLSConfiguration(node.getTLSConfiguration())
.graphQLConfiguration(GraphQLConfiguration.createDefault())
.staticNodes(
node.getStaticNodes().stream()
.map(EnodeURLImpl::fromString)
.collect(Collectors.toList()))
.besuPluginContext(new BesuPluginContextImpl())
.autoLogBloomCaching(false)
.storageProvider(storageProvider)
.forkIdSupplier(() -> besuController.getProtocolManager().getForkIdAsBytesList())
.rpcEndpointService(new RpcEndpointServiceImpl());
node.engineRpcConfiguration().ifPresent(runnerBuilder::engineJsonRpcConfiguration);

final Runner runner = runnerBuilder.build();

besuPluginContext.beforeExternalServices();

Expand Down

0 comments on commit d5739fb

Please sign in to comment.