Skip to content

Commit

Permalink
Rename JsonRpcService to EngineJsonRpcService (hyperledger#5036)
Browse files Browse the repository at this point in the history
* rename JsonRpcService to EngineJsonRpcService

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
  • Loading branch information
daniellehrner authored and gfukushima committed Feb 2, 2023
1 parent d4e5120 commit 5700e9b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
6 changes: 3 additions & 3 deletions besu/src/main/java/org/hyperledger/besu/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -65,7 +65,7 @@ public class Runner implements AutoCloseable {
private final Optional<EthStatsService> ethStatsService;
private final Optional<GraphQLHttpService> graphQLHttp;
private final Optional<JsonRpcHttpService> jsonRpc;
private final Optional<JsonRpcService> engineJsonRpc;
private final Optional<EngineJsonRpcService> engineJsonRpc;
private final Optional<MetricsService> metrics;
private final Optional<JsonRpcIpcService> ipcJsonRpc;
private final Optional<Path> pidPath;
Expand Down Expand Up @@ -103,7 +103,7 @@ public class Runner implements AutoCloseable {
final NetworkRunner networkRunner,
final NatService natService,
final Optional<JsonRpcHttpService> jsonRpc,
final Optional<JsonRpcService> engineJsonRpc,
final Optional<EngineJsonRpcService> engineJsonRpc,
final Optional<GraphQLHttpService> graphQLHttp,
final Optional<WebSocketService> webSocketRpc,
final Optional<JsonRpcIpcService> ipcJsonRpc,
Expand Down
6 changes: 3 additions & 3 deletions besu/src/main/java/org/hyperledger/besu/RunnerBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -887,7 +887,7 @@ public Runner build() {
final SubscriptionManager subscriptionManager =
createSubscriptionManager(vertx, transactionPool, blockchainQueries);

Optional<JsonRpcService> engineJsonRpcService = Optional.empty();
Optional<EngineJsonRpcService> engineJsonRpcService = Optional.empty();
if (engineJsonRpcConfiguration.isPresent() && engineJsonRpcConfiguration.get().isEnabled()) {
final Map<String, JsonRpcMethod> engineMethods =
jsonRpcMethods(
Expand Down Expand Up @@ -934,7 +934,7 @@ public Runner build() {

engineJsonRpcService =
Optional.of(
new JsonRpcService(
new EngineJsonRpcService(
vertx,
dataDir,
engineJsonRpcConfiguration.orElse(JsonRpcConfiguration.createEngineDefault()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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 =
Expand Down Expand Up @@ -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,
Expand All @@ -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 =
Expand Down Expand Up @@ -248,7 +248,7 @@ public void httpRequestWithDefaultHeaderAndValidJWTIsAccepted(final TestContext
});

async.awaitSuccess(10000);
jsonRpcService.stop();
engineJsonRpcService.stop();
httpClient.close();
}

Expand All @@ -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,
Expand All @@ -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 =
Expand Down Expand Up @@ -310,7 +310,7 @@ public void wsRequestFromBadHostAndValidJWTIsDenied(final TestContext context) {
});

async.awaitSuccess(10000);
jsonRpcService.stop();
engineJsonRpcService.stop();

httpClient.close();
}
Expand All @@ -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,
Expand All @@ -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 =
Expand Down Expand Up @@ -377,16 +377,16 @@ public void httpRequestFromBadHostAndValidJWTIsDenied(final TestContext context)
});

async.awaitSuccess(10000);
jsonRpcService.stop();
engineJsonRpcService.stop();

httpClient.close();
}

@Test
public void httpRequestWithDefaultHeaderAndInvalidJWTIsDenied(final TestContext context) {

JsonRpcService jsonRpcService =
new JsonRpcService(
EngineJsonRpcService engineJsonRpcService =
new EngineJsonRpcService(
vertx,
bufferDir,
jsonRpcConfiguration,
Expand All @@ -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 =
Expand All @@ -427,7 +427,7 @@ public void httpRequestWithDefaultHeaderAndInvalidJWTIsDenied(final TestContext
});

async.awaitSuccess(10000);
jsonRpcService.stop();
engineJsonRpcService.stop();
httpClient.close();
}
}

0 comments on commit 5700e9b

Please sign in to comment.