|
|
@ -17,7 +17,6 @@ package org.hyperledger.besu.ethereum.api.jsonrpc; |
|
|
|
import static java.util.Collections.singletonList; |
|
|
|
import static java.util.Collections.singletonList; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
import static org.mockito.Mockito.spy; |
|
|
|
|
|
|
|
import static org.mockito.Mockito.when; |
|
|
|
import static org.mockito.Mockito.when; |
|
|
|
|
|
|
|
|
|
|
|
import org.hyperledger.besu.config.StubGenesisConfigOptions; |
|
|
|
import org.hyperledger.besu.config.StubGenesisConfigOptions; |
|
|
@ -201,37 +200,36 @@ public class JsonRpcHttpServiceRpcApisTest { |
|
|
|
supportedCapabilities.add(EthProtocol.ETH63); |
|
|
|
supportedCapabilities.add(EthProtocol.ETH63); |
|
|
|
|
|
|
|
|
|
|
|
final Map<String, JsonRpcMethod> rpcMethods = |
|
|
|
final Map<String, JsonRpcMethod> rpcMethods = |
|
|
|
spy( |
|
|
|
new JsonRpcMethodsFactory() |
|
|
|
new JsonRpcMethodsFactory() |
|
|
|
.methods( |
|
|
|
.methods( |
|
|
|
CLIENT_VERSION, |
|
|
|
CLIENT_VERSION, |
|
|
|
NETWORK_ID, |
|
|
|
NETWORK_ID, |
|
|
|
new StubGenesisConfigOptions(), |
|
|
|
new StubGenesisConfigOptions(), |
|
|
|
mock(P2PNetwork.class), |
|
|
|
mock(P2PNetwork.class), |
|
|
|
blockchainQueries, |
|
|
|
blockchainQueries, |
|
|
|
mock(Synchronizer.class), |
|
|
|
mock(Synchronizer.class), |
|
|
|
ProtocolScheduleFixture.MAINNET, |
|
|
|
ProtocolScheduleFixture.MAINNET, |
|
|
|
mock(ProtocolContext.class), |
|
|
|
mock(ProtocolContext.class), |
|
|
|
mock(FilterManager.class), |
|
|
|
mock(FilterManager.class), |
|
|
|
mock(TransactionPool.class), |
|
|
|
mock(TransactionPool.class), |
|
|
|
mock(MiningParameters.class), |
|
|
|
mock(MiningParameters.class), |
|
|
|
mock(PoWMiningCoordinator.class), |
|
|
|
mock(PoWMiningCoordinator.class), |
|
|
|
new NoOpMetricsSystem(), |
|
|
|
new NoOpMetricsSystem(), |
|
|
|
supportedCapabilities, |
|
|
|
supportedCapabilities, |
|
|
|
Optional.of(mock(AccountLocalConfigPermissioningController.class)), |
|
|
|
Optional.of(mock(AccountLocalConfigPermissioningController.class)), |
|
|
|
Optional.of(mock(NodeLocalConfigPermissioningController.class)), |
|
|
|
Optional.of(mock(NodeLocalConfigPermissioningController.class)), |
|
|
|
config.getRpcApis(), |
|
|
|
config.getRpcApis(), |
|
|
|
mock(PrivacyParameters.class), |
|
|
|
mock(PrivacyParameters.class), |
|
|
|
mock(JsonRpcConfiguration.class), |
|
|
|
mock(JsonRpcConfiguration.class), |
|
|
|
mock(WebSocketConfiguration.class), |
|
|
|
mock(WebSocketConfiguration.class), |
|
|
|
mock(MetricsConfiguration.class), |
|
|
|
mock(MetricsConfiguration.class), |
|
|
|
natService, |
|
|
|
natService, |
|
|
|
new HashMap<>(), |
|
|
|
new HashMap<>(), |
|
|
|
folder, |
|
|
|
folder, |
|
|
|
mock(EthPeers.class), |
|
|
|
mock(EthPeers.class), |
|
|
|
vertx, |
|
|
|
vertx, |
|
|
|
mock(ApiConfiguration.class), |
|
|
|
mock(ApiConfiguration.class), |
|
|
|
Optional.empty()); |
|
|
|
Optional.empty())); |
|
|
|
|
|
|
|
final JsonRpcHttpService jsonRpcHttpService = |
|
|
|
final JsonRpcHttpService jsonRpcHttpService = |
|
|
|
new JsonRpcHttpService( |
|
|
|
new JsonRpcHttpService( |
|
|
|
vertx, |
|
|
|
vertx, |
|
|
@ -302,8 +300,7 @@ public class JsonRpcHttpServiceRpcApisTest { |
|
|
|
final WebSocketConfiguration webSocketConfiguration, |
|
|
|
final WebSocketConfiguration webSocketConfiguration, |
|
|
|
final P2PNetwork p2pNetwork, |
|
|
|
final P2PNetwork p2pNetwork, |
|
|
|
final MetricsConfiguration metricsConfiguration, |
|
|
|
final MetricsConfiguration metricsConfiguration, |
|
|
|
final NatService natService) |
|
|
|
final NatService natService) { |
|
|
|
throws Exception { |
|
|
|
|
|
|
|
final Set<Capability> supportedCapabilities = new HashSet<>(); |
|
|
|
final Set<Capability> supportedCapabilities = new HashSet<>(); |
|
|
|
supportedCapabilities.add(EthProtocol.ETH62); |
|
|
|
supportedCapabilities.add(EthProtocol.ETH62); |
|
|
|
supportedCapabilities.add(EthProtocol.ETH63); |
|
|
|
supportedCapabilities.add(EthProtocol.ETH63); |
|
|
@ -311,37 +308,36 @@ public class JsonRpcHttpServiceRpcApisTest { |
|
|
|
webSocketConfiguration.setPort(0); |
|
|
|
webSocketConfiguration.setPort(0); |
|
|
|
|
|
|
|
|
|
|
|
final Map<String, JsonRpcMethod> rpcMethods = |
|
|
|
final Map<String, JsonRpcMethod> rpcMethods = |
|
|
|
spy( |
|
|
|
new JsonRpcMethodsFactory() |
|
|
|
new JsonRpcMethodsFactory() |
|
|
|
.methods( |
|
|
|
.methods( |
|
|
|
CLIENT_VERSION, |
|
|
|
CLIENT_VERSION, |
|
|
|
NETWORK_ID, |
|
|
|
NETWORK_ID, |
|
|
|
new StubGenesisConfigOptions(), |
|
|
|
new StubGenesisConfigOptions(), |
|
|
|
p2pNetwork, |
|
|
|
p2pNetwork, |
|
|
|
blockchainQueries, |
|
|
|
blockchainQueries, |
|
|
|
mock(Synchronizer.class), |
|
|
|
mock(Synchronizer.class), |
|
|
|
ProtocolScheduleFixture.MAINNET, |
|
|
|
ProtocolScheduleFixture.MAINNET, |
|
|
|
mock(ProtocolContext.class), |
|
|
|
mock(ProtocolContext.class), |
|
|
|
mock(FilterManager.class), |
|
|
|
mock(FilterManager.class), |
|
|
|
mock(TransactionPool.class), |
|
|
|
mock(TransactionPool.class), |
|
|
|
mock(MiningParameters.class), |
|
|
|
mock(MiningParameters.class), |
|
|
|
mock(PoWMiningCoordinator.class), |
|
|
|
mock(PoWMiningCoordinator.class), |
|
|
|
new NoOpMetricsSystem(), |
|
|
|
new NoOpMetricsSystem(), |
|
|
|
supportedCapabilities, |
|
|
|
supportedCapabilities, |
|
|
|
Optional.of(mock(AccountLocalConfigPermissioningController.class)), |
|
|
|
Optional.of(mock(AccountLocalConfigPermissioningController.class)), |
|
|
|
Optional.of(mock(NodeLocalConfigPermissioningController.class)), |
|
|
|
Optional.of(mock(NodeLocalConfigPermissioningController.class)), |
|
|
|
jsonRpcConfiguration.getRpcApis(), |
|
|
|
jsonRpcConfiguration.getRpcApis(), |
|
|
|
mock(PrivacyParameters.class), |
|
|
|
mock(PrivacyParameters.class), |
|
|
|
jsonRpcConfiguration, |
|
|
|
jsonRpcConfiguration, |
|
|
|
webSocketConfiguration, |
|
|
|
webSocketConfiguration, |
|
|
|
metricsConfiguration, |
|
|
|
metricsConfiguration, |
|
|
|
natService, |
|
|
|
natService, |
|
|
|
new HashMap<>(), |
|
|
|
new HashMap<>(), |
|
|
|
folder, |
|
|
|
folder, |
|
|
|
mock(EthPeers.class), |
|
|
|
mock(EthPeers.class), |
|
|
|
vertx, |
|
|
|
vertx, |
|
|
|
mock(ApiConfiguration.class), |
|
|
|
mock(ApiConfiguration.class), |
|
|
|
Optional.empty()); |
|
|
|
Optional.empty())); |
|
|
|
|
|
|
|
final JsonRpcHttpService jsonRpcHttpService = |
|
|
|
final JsonRpcHttpService jsonRpcHttpService = |
|
|
|
new JsonRpcHttpService( |
|
|
|
new JsonRpcHttpService( |
|
|
|
vertx, |
|
|
|
vertx, |
|
|
@ -425,8 +421,7 @@ public class JsonRpcHttpServiceRpcApisTest { |
|
|
|
"{\"jsonrpc\":\"2.0\",\"id\":" + Json.encode(id) + ",\"method\":\"net_services\"}", JSON); |
|
|
|
"{\"jsonrpc\":\"2.0\",\"id\":" + Json.encode(id) + ",\"method\":\"net_services\"}", JSON); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public JsonRpcHttpService getJsonRpcHttpService(final boolean[] enabledNetServices) |
|
|
|
public JsonRpcHttpService getJsonRpcHttpService(final boolean[] enabledNetServices) { |
|
|
|
throws Exception { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JsonRpcConfiguration jsonRpcConfiguration = JsonRpcConfiguration.createDefault(); |
|
|
|
JsonRpcConfiguration jsonRpcConfiguration = JsonRpcConfiguration.createDefault(); |
|
|
|
WebSocketConfiguration webSocketConfiguration = WebSocketConfiguration.createDefault(); |
|
|
|
WebSocketConfiguration webSocketConfiguration = WebSocketConfiguration.createDefault(); |
|
|
|