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

Nc 2026 network option #645

Merged
Prev Previous commit
Next Next commit
fixes NC-2104 remove Clique and iBFT defaults and centralise default …
…values

As toString() is used to display default values in CLI description and this is
not used anywhere else for RpcApi objects, it may have benn used for debug long
ago, but now we can use the simple string value as return from toString.
Then we are able to use the DEFAULT_JSON_RPC_APIS constant as default value
directly instead of hard coded defaults string in option that was probably used
because previous toString was not outputting correct representation. It may be
interesting to comment when some does this sort of hack.
  • Loading branch information
NicolasMassart committed Jan 22, 2019
commit e5bbd37464c3d4ba0ecb2222595b969eabb7dae0
4 changes: 2 additions & 2 deletions docs/Reference/Pantheon-CLI-Syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ rpc-http-api=["ETH","NET","WEB3"]
Comma-separated APIs to enable on the HTTP JSON-RPC channel.
When you use this option, the `--rpc-http-enabled` option must also be specified.
The available API options are: `ADMIN`, `ETH`, `NET`, `WEB3`, `CLIQUE`, `IBFT`, `DEBUG`, and `MINER`.
The default is: `ETH`, `NET`, `WEB3`, `CLIQUE`, `IBFT`.
The default is: `ETH`, `NET`, `WEB3`.

!!!note
:construction: IBFT is not currently supported. Support for IBFT is in active development.
Expand Down Expand Up @@ -701,7 +701,7 @@ rpc-ws-api=["ETH","NET","WEB3"]
Comma-separated APIs to enable on Websockets channel.
When you use this option, the `--rpc-ws-enabled` option must also be specified.
The available API options are: `ETH`, `NET`, `WEB3`, `CLIQUE`, `IBFT`, `DEBUG`, and `MINER`.
The default is: `ETH`, `NET`, `WEB3`, `CLIQUE`, `IBFT`.
The default is: `ETH`, `NET`, `WEB3`.

!!!note
:construction: IBFT is not currently supported. Support for IBFT is in active development.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package tech.pegasys.pantheon.ethereum.jsonrpc;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

public class RpcApi {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration.DEFAULT_METRICS_PORT;
import static tech.pegasys.pantheon.metrics.prometheus.MetricsConfiguration.createDefault;

import java.util.Collections;
import tech.pegasys.pantheon.Runner;
import tech.pegasys.pantheon.RunnerBuilder;
import tech.pegasys.pantheon.cli.custom.CorsAllowedOriginsProperty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import static tech.pegasys.pantheon.ethereum.p2p.config.DiscoveryConfiguration.MAINNET_BOOTSTRAP_NODES;

import tech.pegasys.pantheon.PantheonInfo;
import tech.pegasys.pantheon.consensus.clique.jsonrpc.CliqueRpcApis;
import tech.pegasys.pantheon.consensus.ibft.jsonrpc.IbftRpcApis;
import tech.pegasys.pantheon.ethereum.core.Address;
import tech.pegasys.pantheon.ethereum.core.MiningParameters;
import tech.pegasys.pantheon.ethereum.core.Wei;
Expand Down Expand Up @@ -84,13 +82,9 @@ public class PantheonCommandTest extends CommandTestAbstract {

static {
final JsonRpcConfiguration rpcConf = JsonRpcConfiguration.createDefault();
rpcConf.addRpcApi(CliqueRpcApis.CLIQUE);
rpcConf.addRpcApi(IbftRpcApis.IBFT);
defaultJsonRpcConfiguration = rpcConf;

final WebSocketConfiguration websocketConf = WebSocketConfiguration.createDefault();
websocketConf.addRpcApi(CliqueRpcApis.CLIQUE);
websocketConf.addRpcApi(IbftRpcApis.IBFT);
defaultWebSocketConfiguration = websocketConf;

defaultMetricsConfiguration = MetricsConfiguration.createDefault();
Expand All @@ -107,7 +101,7 @@ public void callingHelpSubCommandMustDisplayUsage() {
@Test
public void callingHelpDisplaysDefaultRpcApisCorrectly() {
parseCommand("--help");
assertThat(commandOutput.toString()).contains("default: ETH,NET,WEB3,CLIQUE,IBFT");
assertThat(commandOutput.toString()).contains("default: [ETH, NET, WEB3]");
assertThat(commandErrorOutput.toString()).isEmpty();
}

Expand Down Expand Up @@ -254,16 +248,12 @@ public void overrideDefaultValuesIfKeyIsPresentInConfigFile() throws IOException
jsonRpcConfiguration.setPort(5678);
jsonRpcConfiguration.setCorsAllowedDomains(Collections.emptyList());
jsonRpcConfiguration.setRpcApis(RpcApis.DEFAULT_JSON_RPC_APIS);
jsonRpcConfiguration.addRpcApi(CliqueRpcApis.CLIQUE);
jsonRpcConfiguration.addRpcApi(IbftRpcApis.IBFT);

final WebSocketConfiguration webSocketConfiguration = WebSocketConfiguration.createDefault();
webSocketConfiguration.setEnabled(false);
webSocketConfiguration.setHost("9.10.11.12");
webSocketConfiguration.setPort(9101);
webSocketConfiguration.setRpcApis(WebSocketConfiguration.DEFAULT_WEBSOCKET_APIS);
webSocketConfiguration.addRpcApi(CliqueRpcApis.CLIQUE);
webSocketConfiguration.addRpcApi(IbftRpcApis.IBFT);

final MetricsConfiguration metricsConfiguration = MetricsConfiguration.createDefault();
metricsConfiguration.setEnabled(false);
Expand Down Expand Up @@ -356,12 +346,8 @@ public void noOverrideDefaultValuesIfKeyIsNotPresentInConfigFile() throws IOExce

parseCommand("--config-file", configFile);
final JsonRpcConfiguration jsonRpcConfiguration = JsonRpcConfiguration.createDefault();
jsonRpcConfiguration.addRpcApi(CliqueRpcApis.CLIQUE);
jsonRpcConfiguration.addRpcApi(IbftRpcApis.IBFT);

final WebSocketConfiguration webSocketConfiguration = WebSocketConfiguration.createDefault();
webSocketConfiguration.addRpcApi(CliqueRpcApis.CLIQUE);
webSocketConfiguration.addRpcApi(IbftRpcApis.IBFT);

final MetricsConfiguration metricsConfiguration = MetricsConfiguration.createDefault();

Expand Down