diff --git a/besu/src/main/java/org/hyperledger/besu/Runner.java b/besu/src/main/java/org/hyperledger/besu/Runner.java index fb4facf0eb2..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.EngineJsonRpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcHttpService; -import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcService; 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..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.JsonRpcService; 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..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.EngineJsonRpcService; import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcConfiguration; -import org.hyperledger.besu.ethereum.api.jsonrpc.JsonRpcService; 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(); } }