From d5739fb11779cdb781ddb3fa8190c56239295ac2 Mon Sep 17 00:00:00 2001 From: Pedro Novais Date: Fri, 17 Jun 2022 02:38:05 +0100 Subject: [PATCH] fix ThreadBesuNodeRunner missing engineRpcConfiguration (#3974) * fix ThreadBesuNodeRunner engineRpcConfiguration * fix test dsl BesuNode MergeConfigOptions setting Signed-off-by: Pedro Novais Co-authored-by: Sally MacFarlane --- .../tests/acceptance/dsl/node/BesuNode.java | 7 +++ .../dsl/node/ThreadBesuNodeRunner.java | 61 ++++++++++--------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java index 0805b57e1b..52e767b189 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java @@ -18,6 +18,7 @@ import static java.util.Collections.unmodifiableList; 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; @@ -208,6 +209,8 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable 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; @@ -566,6 +569,10 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable return jsonRpcConfiguration; } + Optional engineRpcConfiguration() { + return engineRpcConfiguration; + } + Optional jsonRpcListenHost() { if (isJsonRpcEnabled()) { return Optional.of(jsonRpcConfiguration().getHost()); diff --git a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java index 28e4f25f9b..35c1a69c38 100644 --- a/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java +++ b/acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java @@ -190,36 +190,37 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner { 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();