From bd289db3304cab14aa9fba7e6c8abb4cfb752c7d Mon Sep 17 00:00:00 2001 From: Daniel Lehrner Date: Wed, 1 Feb 2023 12:17:34 +0100 Subject: [PATCH 1/2] rename JsonRpcService to EngineJsonRpcService Signed-off-by: Daniel Lehrner --- .../java/org/hyperledger/besu/Runner.java | 6 +-- .../org/hyperledger/besu/RunnerBuilder.java | 6 +-- ...Service.java => EngineJsonRpcService.java} | 8 +-- .../api/jsonrpc/websocket/JsonRpcJWTTest.java | 52 +++++++++---------- 4 files changed, 36 insertions(+), 36 deletions(-) rename ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/{JsonRpcService.java => EngineJsonRpcService.java} (99%) diff --git a/besu/src/main/java/org/hyperledger/besu/Runner.java b/besu/src/main/java/org/hyperledger/besu/Runner.java index fb4facf0eb2..242a23139c3 100644 --- a/besu/src/main/java/org/hyperledger/besu/Runner.java +++ b/besu/src/main/java/org/hyperledger/besu/Runner.java @@ -17,7 +17,7 @@ import org.hyperledger.besu.controller.BesuController; import org.hyperledger.besu.ethereum.api.graphql.GraphQLHttpService; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcHttpService; -import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcService; +import org.hyperledger.besu.ethereum.api.jsonrpc.EngineJsonRpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.ipc.JsonRpcIpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketService; import org.hyperledger.besu.ethereum.api.query.cache.AutoTransactionLogBloomCachingService; @@ -65,7 +65,7 @@ public class Runner implements AutoCloseable { private final Optional ethStatsService; private final Optional graphQLHttp; private final Optional jsonRpc; - private final Optional engineJsonRpc; + private final Optional engineJsonRpc; private final Optional metrics; private final Optional ipcJsonRpc; private final Optional pidPath; @@ -103,7 +103,7 @@ public class Runner implements AutoCloseable { final NetworkRunner networkRunner, final NatService natService, final Optional jsonRpc, - final Optional engineJsonRpc, + final Optional engineJsonRpc, final Optional graphQLHttp, final Optional webSocketRpc, final Optional ipcJsonRpc, diff --git a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java index 6d1a0f57443..4234ead43ee 100644 --- a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java @@ -35,7 +35,7 @@ import org.hyperledger.besu.ethereum.api.graphql.GraphQLProvider; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcHttpService; -import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcService; +import org.hyperledger.besu.ethereum.api.jsonrpc.EngineJsonRpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.AuthenticationService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.DefaultAuthenticationService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.EngineAuthService; @@ -887,7 +887,7 @@ public Runner build() { final SubscriptionManager subscriptionManager = createSubscriptionManager(vertx, transactionPool, blockchainQueries); - Optional engineJsonRpcService = Optional.empty(); + Optional engineJsonRpcService = Optional.empty(); if (engineJsonRpcConfiguration.isPresent() && engineJsonRpcConfiguration.get().isEnabled()) { final Map engineMethods = jsonRpcMethods( @@ -934,7 +934,7 @@ public Runner build() { engineJsonRpcService = Optional.of( - new JsonRpcService( + new EngineJsonRpcService( vertx, dataDir, engineJsonRpcConfiguration.orElse(JsonRpcConfiguration.createEngineDefault()), diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcService.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/EngineJsonRpcService.java similarity index 99% rename from ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcService.java rename to ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/EngineJsonRpcService.java index 0b4c8753a6b..26710ff53ee 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/JsonRpcService.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/EngineJsonRpcService.java @@ -100,9 +100,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class JsonRpcService { +public class EngineJsonRpcService { - private static final Logger LOG = LoggerFactory.getLogger(JsonRpcService.class); + private static final Logger LOG = LoggerFactory.getLogger(EngineJsonRpcService.class); private static final String SPAN_CONTEXT = "span_context"; private static final InetSocketAddress EMPTY_SOCKET_ADDRESS = new InetSocketAddress("0.0.0.0", 0); @@ -152,7 +152,7 @@ public String get(final @Nullable HttpServerRequest carrier, final String key) { private final HealthService readinessService; /** - * Construct a JsonRpcService to handle either http or websocket clients + * Construct a EngineJsonRpcService to handle either http or websocket clients * * @param vertx The vertx process that will be running this service * @param dataDir The data directory where requests can be buffered @@ -166,7 +166,7 @@ public String get(final @Nullable HttpServerRequest carrier, final String key) { * @param livenessService A service responsible for reporting whether this node is live * @param readinessService A service responsible for reporting whether this node has fully started */ - public JsonRpcService( + public EngineJsonRpcService( final Vertx vertx, final Path dataDir, final JsonRpcConfiguration config, diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java index 965e32eb3ae..4060a6ddde5 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java @@ -19,7 +19,7 @@ import static org.mockito.Mockito.spy; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; -import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcService; +import org.hyperledger.besu.ethereum.api.jsonrpc.EngineJsonRpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.AuthenticationService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.EngineAuthService; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService; @@ -131,8 +131,8 @@ public void after() {} @Test public void unauthenticatedWebsocketAllowedWithoutJWTAuth(final TestContext context) { - JsonRpcService jsonRpcService = - new JsonRpcService( + EngineJsonRpcService engineJsonRpcService = + new EngineJsonRpcService( vertx, bufferDir, jsonRpcConfiguration, @@ -145,9 +145,9 @@ public void unauthenticatedWebsocketAllowedWithoutJWTAuth(final TestContext cont healthy, healthy); - jsonRpcService.start().join(); + engineJsonRpcService.start().join(); - final InetSocketAddress inetSocketAddress = jsonRpcService.socketAddress(); + final InetSocketAddress inetSocketAddress = engineJsonRpcService.socketAddress(); int listenPort = inetSocketAddress.getPort(); final HttpClientOptions httpClientOptions = @@ -184,15 +184,15 @@ public void unauthenticatedWebsocketAllowedWithoutJWTAuth(final TestContext cont }); async.awaitSuccess(10000); - jsonRpcService.stop(); + engineJsonRpcService.stop(); httpClient.close(); } @Test public void httpRequestWithDefaultHeaderAndValidJWTIsAccepted(final TestContext context) { - JsonRpcService jsonRpcService = - new JsonRpcService( + EngineJsonRpcService engineJsonRpcService = + new EngineJsonRpcService( vertx, bufferDir, jsonRpcConfiguration, @@ -205,9 +205,9 @@ public void httpRequestWithDefaultHeaderAndValidJWTIsAccepted(final TestContext healthy, healthy); - jsonRpcService.start().join(); + engineJsonRpcService.start().join(); - final InetSocketAddress inetSocketAddress = jsonRpcService.socketAddress(); + final InetSocketAddress inetSocketAddress = engineJsonRpcService.socketAddress(); int listenPort = inetSocketAddress.getPort(); final HttpClientOptions httpClientOptions = @@ -248,7 +248,7 @@ public void httpRequestWithDefaultHeaderAndValidJWTIsAccepted(final TestContext }); async.awaitSuccess(10000); - jsonRpcService.stop(); + engineJsonRpcService.stop(); httpClient.close(); } @@ -265,9 +265,9 @@ public void wsRequestFromBadHostAndValidJWTIsDenied(final TestContext context) { fail("didn't parse jwt"); } - JsonRpcService jsonRpcService = + EngineJsonRpcService engineJsonRpcService = spy( - new JsonRpcService( + new EngineJsonRpcService( vertx, bufferDir, strictHost, @@ -280,9 +280,9 @@ public void wsRequestFromBadHostAndValidJWTIsDenied(final TestContext context) { healthy, healthy)); - jsonRpcService.start().join(); + engineJsonRpcService.start().join(); - final InetSocketAddress inetSocketAddress = jsonRpcService.socketAddress(); + final InetSocketAddress inetSocketAddress = engineJsonRpcService.socketAddress(); int listenPort = inetSocketAddress.getPort(); final HttpClientOptions httpClientOptions = @@ -310,7 +310,7 @@ public void wsRequestFromBadHostAndValidJWTIsDenied(final TestContext context) { }); async.awaitSuccess(10000); - jsonRpcService.stop(); + engineJsonRpcService.stop(); httpClient.close(); } @@ -328,9 +328,9 @@ public void httpRequestFromBadHostAndValidJWTIsDenied(final TestContext context) fail("didn't parse jwt"); } - JsonRpcService jsonRpcService = + EngineJsonRpcService engineJsonRpcService = spy( - new JsonRpcService( + new EngineJsonRpcService( vertx, bufferDir, strictHost, @@ -343,9 +343,9 @@ public void httpRequestFromBadHostAndValidJWTIsDenied(final TestContext context) healthy, healthy)); - jsonRpcService.start().join(); + engineJsonRpcService.start().join(); - final InetSocketAddress inetSocketAddress = jsonRpcService.socketAddress(); + final InetSocketAddress inetSocketAddress = engineJsonRpcService.socketAddress(); int listenPort = inetSocketAddress.getPort(); final HttpClientOptions httpClientOptions = @@ -377,7 +377,7 @@ public void httpRequestFromBadHostAndValidJWTIsDenied(final TestContext context) }); async.awaitSuccess(10000); - jsonRpcService.stop(); + engineJsonRpcService.stop(); httpClient.close(); } @@ -385,8 +385,8 @@ public void httpRequestFromBadHostAndValidJWTIsDenied(final TestContext context) @Test public void httpRequestWithDefaultHeaderAndInvalidJWTIsDenied(final TestContext context) { - JsonRpcService jsonRpcService = - new JsonRpcService( + EngineJsonRpcService engineJsonRpcService = + new EngineJsonRpcService( vertx, bufferDir, jsonRpcConfiguration, @@ -399,9 +399,9 @@ public void httpRequestWithDefaultHeaderAndInvalidJWTIsDenied(final TestContext healthy, healthy); - jsonRpcService.start().join(); + engineJsonRpcService.start().join(); - final InetSocketAddress inetSocketAddress = jsonRpcService.socketAddress(); + final InetSocketAddress inetSocketAddress = engineJsonRpcService.socketAddress(); int listenPort = inetSocketAddress.getPort(); final HttpClientOptions httpClientOptions = @@ -427,7 +427,7 @@ public void httpRequestWithDefaultHeaderAndInvalidJWTIsDenied(final TestContext }); async.awaitSuccess(10000); - jsonRpcService.stop(); + engineJsonRpcService.stop(); httpClient.close(); } } From 17bdf428679b6790d8f3eb35ad9f0b1343d0ca25 Mon Sep 17 00:00:00 2001 From: Daniel Lehrner Date: Wed, 1 Feb 2023 12:20:30 +0100 Subject: [PATCH 2/2] spotlessApply Signed-off-by: Daniel Lehrner --- besu/src/main/java/org/hyperledger/besu/Runner.java | 2 +- besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java | 2 +- .../besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/besu/src/main/java/org/hyperledger/besu/Runner.java b/besu/src/main/java/org/hyperledger/besu/Runner.java index 242a23139c3..f496bbaf221 100644 --- a/besu/src/main/java/org/hyperledger/besu/Runner.java +++ b/besu/src/main/java/org/hyperledger/besu/Runner.java @@ -16,8 +16,8 @@ import org.hyperledger.besu.controller.BesuController; import org.hyperledger.besu.ethereum.api.graphql.GraphQLHttpService; -import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcHttpService; import org.hyperledger.besu.ethereum.api.jsonrpc.EngineJsonRpcService; +import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcHttpService; import org.hyperledger.besu.ethereum.api.jsonrpc.ipc.JsonRpcIpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.WebSocketService; import org.hyperledger.besu.ethereum.api.query.cache.AutoTransactionLogBloomCachingService; diff --git a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java index 4234ead43ee..a9a8f6fea57 100644 --- a/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java +++ b/besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java @@ -33,9 +33,9 @@ import org.hyperledger.besu.ethereum.api.graphql.GraphQLDataFetchers; import org.hyperledger.besu.ethereum.api.graphql.GraphQLHttpService; import org.hyperledger.besu.ethereum.api.graphql.GraphQLProvider; +import org.hyperledger.besu.ethereum.api.jsonrpc.EngineJsonRpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcHttpService; -import org.hyperledger.besu.ethereum.api.jsonrpc.EngineJsonRpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.AuthenticationService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.DefaultAuthenticationService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.EngineAuthService; diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java index 4060a6ddde5..66b82e73c6a 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/JsonRpcJWTTest.java @@ -18,8 +18,8 @@ import static org.assertj.core.api.Assertions.fail; import static org.mockito.Mockito.spy; -import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.EngineJsonRpcService; +import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.AuthenticationService; import org.hyperledger.besu.ethereum.api.jsonrpc.authentication.EngineAuthService; import org.hyperledger.besu.ethereum.api.jsonrpc.health.HealthService;