Add a few help defaults, format all of them the same (#2284) (#2467)

No support in confutils, so so this code simply hardcodes it
This commit is contained in:
Jacek Sieka 2021-04-01 14:28:57 +02:00 committed by GitHub
parent 3cd7cebc7c
commit 8f441588cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 54 deletions

View File

@ -24,6 +24,12 @@ export
defaultEth2TcpPort, enabledLogLevel, ValidIpAddress, defaultEth2TcpPort, enabledLogLevel, ValidIpAddress,
defs, parseCmdArg, completeCmdArg, network_metadata defs, parseCmdArg, completeCmdArg, network_metadata
const
# TODO: How should we select between IPv4 and IPv6
# Maybe there should be a config option for this.
defaultListenAddress* = (static ValidIpAddress.init("0.0.0.0"))
defaultAdminListenAddress* = (static ValidIpAddress.init("127.0.0.1"))
type type
BNStartUpCmd* = enum BNStartUpCmd* = enum
noCommand noCommand
@ -67,7 +73,7 @@ type
BeaconNodeConf* = object BeaconNodeConf* = object
logLevel* {. logLevel* {.
defaultValue: "INFO" defaultValue: "INFO"
desc: "Sets the log level for process and topics (e.g. \"DEBUG; TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none\")" desc: "Sets the log level for process and topics (e.g. \"DEBUG; TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none\") [=INFO]"
name: "log-level" }: string name: "log-level" }: string
logFile* {. logFile* {.
@ -75,7 +81,7 @@ type
name: "log-file" }: Option[OutFile] name: "log-file" }: Option[OutFile]
eth2Network* {. eth2Network* {.
desc: "The Eth2 network to join" desc: "The Eth2 network to join [=mainnet]"
name: "network" }: Option[string] name: "network" }: Option[string]
dataDir* {. dataDir* {.
@ -114,13 +120,13 @@ type
netKeyFile* {. netKeyFile* {.
defaultValue: "random", defaultValue: "random",
desc: "Source of network (secp256k1) private key file " & desc: "Source of network (secp256k1) private key file " &
"(random|<path>) (default: random)" "(random|<path>) [=random]"
name: "netkey-file" }: string name: "netkey-file" }: string
netKeyInsecurePassword* {. netKeyInsecurePassword* {.
defaultValue: false, defaultValue: false,
desc: "Use pre-generated INSECURE password for network private key " & desc: "Use pre-generated INSECURE password for network private key " &
"file (default: false)" "file [=false]"
name: "insecure-netkey-password" }: bool name: "insecure-netkey-password" }: bool
agentString* {. agentString* {.
@ -136,7 +142,7 @@ type
slashingDbKind* {. slashingDbKind* {.
hidden hidden
defaultValue: SlashingDbKind.both defaultValue: SlashingDbKind.both
desc: "The slashing DB flavour to use (v1, v2 or both)" desc: "The slashing DB flavour to use (v1, v2 or both) [=both]"
name: "slashing-db-kind" }: SlashingDbKind name: "slashing-db-kind" }: SlashingDbKind
case cmd* {. case cmd* {.
@ -155,23 +161,24 @@ type
name: "bootstrap-file" }: InputFile name: "bootstrap-file" }: InputFile
listenAddress* {. listenAddress* {.
defaultValue: defaultListenAddress(config) defaultValue: defaultListenAddress
desc: "Listening address for the Ethereum LibP2P and Discovery v5 traffic" desc: "Listening address for the Ethereum LibP2P and Discovery v5 " &
"traffic [=0.0.0.0]"
name: "listen-address" }: ValidIpAddress name: "listen-address" }: ValidIpAddress
tcpPort* {. tcpPort* {.
defaultValue: defaultEth2TcpPort defaultValue: defaultEth2TcpPort
desc: "Listening TCP port for Ethereum LibP2P traffic, the default is 9000" desc: "Listening TCP port for Ethereum LibP2P traffic [=9000]"
name: "tcp-port" }: Port name: "tcp-port" }: Port
udpPort* {. udpPort* {.
defaultValue: defaultEth2TcpPort defaultValue: defaultEth2TcpPort
desc: "Listening UDP port for node discovery, default is 9000" desc: "Listening UDP port for node discovery [=9000]"
name: "udp-port" }: Port name: "udp-port" }: Port
maxPeers* {. maxPeers* {.
defaultValue: 160 # 5 (fanout) * 64 (subnets) / 2 (subs) for a heathy mesh defaultValue: 160 # 5 (fanout) * 64 (subnets) / 2 (subs) for a heathy mesh
desc: "The maximum number of peers to connect to" desc: "The maximum number of peers to connect to [=160]"
name: "max-peers" }: int name: "max-peers" }: int
nat* {. nat* {.
@ -222,17 +229,17 @@ type
metricsEnabled* {. metricsEnabled* {.
defaultValue: false defaultValue: false
desc: "Enable the metrics server" desc: "Enable the metrics server [=false]"
name: "metrics" }: bool name: "metrics" }: bool
metricsAddress* {. metricsAddress* {.
defaultValue: defaultAdminListenAddress(config) defaultValue: defaultAdminListenAddress
desc: "Listening address of the metrics server" desc: "Listening address of the metrics server [=127.0.0.1]"
name: "metrics-address" }: ValidIpAddress name: "metrics-address" }: ValidIpAddress
metricsPort* {. metricsPort* {.
defaultValue: 8008 defaultValue: 8008
desc: "Listening HTTP port of the metrics server" desc: "Listening HTTP port of the metrics server [=8008]"
name: "metrics-port" }: Port name: "metrics-port" }: Port
statusBarEnabled* {. statusBarEnabled* {.
@ -252,17 +259,17 @@ type
rpcEnabled* {. rpcEnabled* {.
defaultValue: false defaultValue: false
desc: "Enable the JSON-RPC server" desc: "Enable the JSON-RPC server [=false]"
name: "rpc" }: bool name: "rpc" }: bool
rpcPort* {. rpcPort* {.
defaultValue: defaultEth2RpcPort defaultValue: defaultEth2RpcPort
desc: "HTTP port for the JSON-RPC service" desc: "HTTP port for the JSON-RPC service [=9190]"
name: "rpc-port" }: Port name: "rpc-port" }: Port
rpcAddress* {. rpcAddress* {.
defaultValue: defaultAdminListenAddress(config) defaultValue: defaultAdminListenAddress
desc: "Listening address of the RPC server" desc: "Listening address of the RPC server [=127.0.0.1]"
name: "rpc-address" }: ValidIpAddress name: "rpc-address" }: ValidIpAddress
inProcessValidators* {. inProcessValidators* {.
@ -272,12 +279,12 @@ type
discv5Enabled* {. discv5Enabled* {.
defaultValue: true defaultValue: true
desc: "Enable Discovery v5" desc: "Enable Discovery v5 [=true]"
name: "discv5" }: bool name: "discv5" }: bool
dumpEnabled* {. dumpEnabled* {.
defaultValue: false defaultValue: false
desc: "Write SSZ dumps of blocks, attestations and states to data dir" desc: "Write SSZ dumps of blocks, attestations and states to data dir [=false]"
name: "dump" }: bool name: "dump" }: bool
directPeers* {. directPeers* {.
@ -286,7 +293,7 @@ type
doppelgangerDetection* {. doppelgangerDetection* {.
defaultValue: true defaultValue: true
desc: "Whether to detect whether another validator is be running the same validator keys (default true)" desc: "Whether to detect whether another validator is be running the same validator keys [=true]"
name: "doppelganger-detection" name: "doppelganger-detection"
}: bool }: bool
@ -469,7 +476,7 @@ type
ValidatorClientConf* = object ValidatorClientConf* = object
logLevel* {. logLevel* {.
defaultValue: "INFO" defaultValue: "INFO"
desc: "Sets the log level" desc: "Sets the log level [=INFO]"
name: "log-level" }: string name: "log-level" }: string
logFile* {. logFile* {.
@ -511,17 +518,17 @@ type
rpcPort* {. rpcPort* {.
defaultValue: defaultEth2RpcPort defaultValue: defaultEth2RpcPort
desc: "HTTP port of the server to connect to for RPC - for the validator duties in the pull model" desc: "HTTP port of the server to connect to for RPC [=9190]"
name: "rpc-port" }: Port name: "rpc-port" }: Port
rpcAddress* {. rpcAddress* {.
defaultValue: defaultAdminListenAddress(config) defaultValue: defaultAdminListenAddress
desc: "Address of the server to connect to for RPC - for the validator duties in the pull model" desc: "Address of the server to connect to for RPC [=127.0.0.1]"
name: "rpc-address" }: ValidIpAddress name: "rpc-address" }: ValidIpAddress
retryDelay* {. retryDelay* {.
defaultValue: 10 defaultValue: 10
desc: "Delay in seconds between retries after unsuccessful attempts to connect to a beacon node" desc: "Delay in seconds between retries after unsuccessful attempts to connect to a beacon node [=10]"
name: "retry-delay" }: int name: "retry-delay" }: int
proc defaultDataDir*(config: BeaconNodeConf|ValidatorClientConf): string = proc defaultDataDir*(config: BeaconNodeConf|ValidatorClientConf): string =
@ -677,14 +684,6 @@ func outWalletFile*(config: BeaconNodeConf): Option[OutFile] =
func databaseDir*(config: BeaconNodeConf|ValidatorClientConf): string = func databaseDir*(config: BeaconNodeConf|ValidatorClientConf): string =
config.dataDir / "db" config.dataDir / "db"
func defaultListenAddress*(config: BeaconNodeConf|ValidatorClientConf): ValidIpAddress =
# TODO: How should we select between IPv4 and IPv6
# Maybe there should be a config option for this.
(static ValidIpAddress.init("0.0.0.0"))
func defaultAdminListenAddress*(config: BeaconNodeConf|ValidatorClientConf): ValidIpAddress =
(static ValidIpAddress.init("127.0.0.1"))
template writeValue*(writer: var JsonWriter, template writeValue*(writer: var JsonWriter,
value: TypedInputFile|InputFile|InputDir|OutPath|OutDir|OutFile) = value: TypedInputFile|InputFile|InputDir|OutPath|OutDir|OutFile) =
writer.writeValue(string value) writer.writeValue(string value)

View File

@ -15,16 +15,16 @@ To see a list of the command line options availabe to you, with descriptions, na
You should see the following output: You should see the following output:
``` ```
Usage: Usage:
nimbus_beacon_node [OPTIONS]... command nimbus_beacon_node [OPTIONS]... command
The following options are available: The following options are available:
--log-level Sets the log level for process and topics (e.g. "DEBUG; --log-level Sets the log level for process and topics (e.g. "DEBUG;
TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none"). TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none") [=INFO].
--log-file Specifies a path for the written Json log file. --log-file Specifies a path for the written Json log file.
--network The Eth2 network to join. --network The Eth2 network to join [=mainnet].
-d, --data-dir The directory where nimbus will store all blockchain data. -d, --data-dir The directory where nimbus will store all blockchain data.
--validators-dir A directory containing validator keystores. --validators-dir A directory containing validator keystores.
--secrets-dir A directory containing validator keystore passwords. --secrets-dir A directory containing validator keystore passwords.
@ -33,9 +33,9 @@ The following options are available:
--non-interactive Do not display interative prompts. Quit on missing --non-interactive Do not display interative prompts. Quit on missing
configuration. configuration.
--netkey-file Source of network (secp256k1) private key file --netkey-file Source of network (secp256k1) private key file
(random|<path>) (default: random). (random|<path>) [=random].
--insecure-netkey-password Use pre-generated INSECURE password for network private key --insecure-netkey-password Use pre-generated INSECURE password for network private key
file (default: false). file [=false].
--agent-string Node agent string which is used as identifier in network. --agent-string Node agent string which is used as identifier in network.
--subscribe-all-subnets Subscribe to all attestation subnet topics when gossiping. --subscribe-all-subnets Subscribe to all attestation subnet topics when gossiping.
-b, --bootstrap-node Specifies one or more bootstrap nodes to use when connecting -b, --bootstrap-node Specifies one or more bootstrap nodes to use when connecting
@ -43,10 +43,10 @@ The following options are available:
--bootstrap-file Specifies a line-delimited file of bootstrap Ethereum network --bootstrap-file Specifies a line-delimited file of bootstrap Ethereum network
addresses. addresses.
--listen-address Listening address for the Ethereum LibP2P and Discovery v5 --listen-address Listening address for the Ethereum LibP2P and Discovery v5
traffic. traffic [=0.0.0.0].
--tcp-port Listening TCP port for Ethereum LibP2P traffic, the default is 9000 --tcp-port Listening TCP port for Ethereum LibP2P traffic [=9000].
--udp-port Listening UDP port for node discovery, default is 9000 --udp-port Listening UDP port for node discovery [=9000].
--max-peers The maximum number of peers to connect to. --max-peers The maximum number of peers to connect to [=160].
--nat Specify method to use for determining public address. Must be --nat Specify method to use for determining public address. Must be
one of: any, none, upnp, pmp, extip:<IP>. one of: any, none, upnp, pmp, extip:<IP>.
--enr-auto-update Discovery can automatically update its ENR with the IP --enr-auto-update Discovery can automatically update its ENR with the IP
@ -66,24 +66,28 @@ The following options are available:
--verify-finalization Specify whether to verify finalization occurs on schedule, --verify-finalization Specify whether to verify finalization occurs on schedule,
for testing. for testing.
--stop-at-epoch A positive epoch selects the epoch at which to stop. --stop-at-epoch A positive epoch selects the epoch at which to stop.
--metrics Enable the metrics server. --metrics Enable the metrics server [=false].
--metrics-address Listening address of the metrics server. --metrics-address Listening address of the metrics server [=127.0.0.1].
--metrics-port Listening HTTP port of the metrics server. --metrics-port Listening HTTP port of the metrics server [=8008].
--status-bar Display a status bar at the bottom of the terminal screen. --status-bar Display a status bar at the bottom of the terminal screen.
--status-bar-contents Textual template for the contents of the status bar. --status-bar-contents Textual template for the contents of the status bar.
--rpc Enable the JSON-RPC server. --rpc Enable the JSON-RPC server [=false].
--rpc-port HTTP port for the JSON-RPC service. --rpc-port HTTP port for the JSON-RPC service [=9190].
--rpc-address Listening address of the RPC server. --rpc-address Listening address of the RPC server [=127.0.0.1].
--in-process-validators Disable the push model (the beacon node tells a signing --in-process-validators Disable the push model (the beacon node tells a signing
process with the private keys of the validators what to sign process with the private keys of the validators what to sign
and when) and load the validators in the beacon node itself. and when) and load the validators in the beacon node itself.
--discv5 Enable Discovery v5. --discv5 Enable Discovery v5 [=true].
--dump Write SSZ dumps of blocks, attestations and states to data --dump Write SSZ dumps of blocks, attestations and states to data
dir. dir [=false].
--direct-peer The list of priviledged, secure and known peers to connect
and maintain the connection to, this requires a not random
netkey-file. In the complete multiaddress format like:
/ip4/<address>/tcp/<port>/p2p/<peerId-public-key>. Peering
agreements are established out of band and must be
reciprocal..
--doppelganger-detection Whether to detect whether another validator is be running the --doppelganger-detection Whether to detect whether another validator is be running the
same validator keys (default true). same validator keys [=true].
Available sub-commands:
... ...
``` ```