Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
log a warning if PERM apis enabled without perm CLI enabled (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
macfarla authored Feb 20, 2019
1 parent 920d8ec commit 9584291
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,10 @@ MetricsConfiguration metricsConfiguration() {
private Optional<PermissioningConfiguration> permissioningConfiguration() throws Exception {

if (!permissionsAccountsEnabled && !permissionsNodesEnabled) {
if (rpcHttpApis.contains(RpcApis.PERM) || rpcWsApis.contains(RpcApis.PERM)) {
logger.warn(
"Permissions are disabled. Cannot enable PERM APIs when not using Permissions.");
}
return Optional.empty();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static tech.pegasys.pantheon.cli.NetworkName.ROPSTEN;
import static tech.pegasys.pantheon.ethereum.jsonrpc.RpcApis.ETH;
import static tech.pegasys.pantheon.ethereum.jsonrpc.RpcApis.NET;
import static tech.pegasys.pantheon.ethereum.jsonrpc.RpcApis.PERM;
import static tech.pegasys.pantheon.ethereum.jsonrpc.RpcApis.WEB3;
import static tech.pegasys.pantheon.ethereum.p2p.config.DiscoveryConfiguration.MAINNET_BOOTSTRAP_NODES;

Expand Down Expand Up @@ -947,13 +948,15 @@ public void rpcHttpEnabledPropertyMustBeUsed() {

@Test
public void rpcApisPropertyMustBeUsed() {
parseCommand("--rpc-http-api", "ETH,NET", "--rpc-http-enabled");
parseCommand("--rpc-http-api", "ETH,NET,PERM", "--rpc-http-enabled");

verify(mockRunnerBuilder).jsonRpcConfiguration(jsonRpcConfigArgumentCaptor.capture());
verify(mockRunnerBuilder).build();
verify(mockLogger)
.warn("Permissions are disabled. Cannot enable PERM APIs when not using Permissions.");

assertThat(jsonRpcConfigArgumentCaptor.getValue().getRpcApis())
.containsExactlyInAnyOrder(ETH, NET);
.containsExactlyInAnyOrder(ETH, NET, PERM);

assertThat(commandOutput.toString()).isEmpty();
assertThat(commandErrorOutput.toString()).isEmpty();
Expand Down

0 comments on commit 9584291

Please sign in to comment.