diff --git a/build.gradle b/build.gradle index 614da01..fdbfb8a 100644 --- a/build.gradle +++ b/build.gradle @@ -185,9 +185,9 @@ dependencies { implementation 'org.apache.logging.log4j:log4j-core' - implementation 'org.hyperledger.besu.internal:pipeline' - implementation 'org.hyperledger.besu.internal:rlp' - implementation 'org.hyperledger.besu:plugin-api' + implementation 'org.hyperledger.besu.internal:besu-services-pipeline' + implementation 'org.hyperledger.besu.internal:besu-ethereum-rlp' + implementation 'org.hyperledger.besu:besu-plugin-api' implementation 'org.hyperledger.besu:besu-datatypes' implementation 'info.picocli:picocli' diff --git a/gradle.properties b/gradle.properties index a5366fe..94cb7a8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ releaseVersion=0.3.9-SNAPSHOT -besuVersion=25.5.0 +besuVersion=25.9.0 diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 78ce013..9119ca8 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -32,10 +32,10 @@ dependencyManagement { dependency 'tech.pegasys.tools.epchecks:errorprone-checks:1.1.1' // Besu dependencies - dependency "org.hyperledger.besu:plugin-api:${besuVersion}" + dependency "org.hyperledger.besu:besu-plugin-api:${besuVersion}" dependency "org.hyperledger.besu:besu-datatypes:${besuVersion}" - dependency "org.hyperledger.besu.internal:pipeline:${besuVersion}" - dependency "org.hyperledger.besu.internal:rlp:${besuVersion}" + dependency "org.hyperledger.besu.internal:besu-services-pipeline:${besuVersion}" + dependency "org.hyperledger.besu.internal:besu-ethereum-rlp:${besuVersion}" // Logging dependencies diff --git a/src/main/java/net/consensys/fleet/common/plugin/FleetPlugin.java b/src/main/java/net/consensys/fleet/common/plugin/FleetPlugin.java index 2c2d779..771d8dc 100644 --- a/src/main/java/net/consensys/fleet/common/plugin/FleetPlugin.java +++ b/src/main/java/net/consensys/fleet/common/plugin/FleetPlugin.java @@ -45,6 +45,7 @@ import com.google.auto.service.AutoService; import org.hyperledger.besu.plugin.BesuPlugin; import org.hyperledger.besu.plugin.ServiceManager; +import org.hyperledger.besu.plugin.services.BesuConfiguration; import org.hyperledger.besu.plugin.services.BesuEvents; import org.hyperledger.besu.plugin.services.BlockchainService; import org.hyperledger.besu.plugin.services.PicoCLIOptions; @@ -90,9 +91,22 @@ public void register(final ServiceManager serviceManager) { } cmdlineOptions.get().addPicoCLIOptions(NAME, CLI_OPTIONS); + LOG.debug("Loading BesuConfiguration service"); + final BesuConfiguration besuConfigurationService = + serviceManager + .getService(BesuConfiguration.class) + .orElseThrow( + () -> + new IllegalStateException( + "Expecting a BesuConfiguration service, but none found.")); + LOG.info("Creating peer manager"); - peerManagers = new PeerNodesManager(); - this.webClient = new WebClientWrapper(convertMapperProvider, peerManagers); + this.peerManagers = new PeerNodesManager(); + this.webClient = + new WebClientWrapper( + convertMapperProvider, + peerManagers, + besuConfigurationService.getConfiguredRpcHttpTimeoutSec()); LOG.info("Setting up RPC endpoints"); final List pluginRpcMethods = createServerMethods(); @@ -179,6 +193,7 @@ public void stop() { private void createPeerNetworkMaintainer() { LOG.info("Setting up connection parameters"); final PeerNetworkMaintainer peerNetworkMaintainer; + switch (CLI_OPTIONS.getNodeRole()) { case LEADER -> { /* ********** LEADER ************* */ diff --git a/src/main/java/net/consensys/fleet/common/rpc/client/WebClientWrapper.java b/src/main/java/net/consensys/fleet/common/rpc/client/WebClientWrapper.java index d0f2c77..1268906 100644 --- a/src/main/java/net/consensys/fleet/common/rpc/client/WebClientWrapper.java +++ b/src/main/java/net/consensys/fleet/common/rpc/client/WebClientWrapper.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; import com.fasterxml.jackson.core.JsonProcessingException; import io.vertx.core.Vertx; @@ -39,11 +40,15 @@ public class WebClientWrapper { private final WebClient webClient; private final ConvertMapperProvider convertMapperProvider; private final PeerNodesManager peerManagers; + private final long timeoutInMillisecond; public WebClientWrapper( - final ConvertMapperProvider convertMapperProvider, final PeerNodesManager peerManagers) { + final ConvertMapperProvider convertMapperProvider, + final PeerNodesManager peerManagers, + final long timeoutInMillisecond) { this.peerManagers = peerManagers; this.convertMapperProvider = convertMapperProvider; + this.timeoutInMillisecond = TimeUnit.SECONDS.toMillis(timeoutInMillisecond); this.webClient = WebClient.create(Vertx.vertx(), new WebClientOptions()); } @@ -64,7 +69,7 @@ public CompletableFuture> sendToLeader( webClient .post(leader.port(), leader.host(), endpoint) - .timeout(100) + .timeout(timeoutInMillisecond) .putHeader("Content-Type", CONTENT_TYPE) .sendJsonObject( jsonObject, @@ -99,7 +104,7 @@ public void sendToFollowers(final String endpoint, final String methodName, fina peerNode -> { webClient .post(peerNode.port(), peerNode.host(), endpoint) - .timeout(100) + .timeout(timeoutInMillisecond) .putHeader("Content-Type", CONTENT_TYPE) .sendJsonObject( jsonObject,