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,
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
BNStartUpCmd* = enum
noCommand
@ -67,7 +73,7 @@ type
BeaconNodeConf* = object
logLevel* {.
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
logFile* {.
@ -75,7 +81,7 @@ type
name: "log-file" }: Option[OutFile]
eth2Network* {.
desc: "The Eth2 network to join"
desc: "The Eth2 network to join [=mainnet]"
name: "network" }: Option[string]
dataDir* {.
@ -114,13 +120,13 @@ type
netKeyFile* {.
defaultValue: "random",
desc: "Source of network (secp256k1) private key file " &
"(random|<path>) (default: random)"
"(random|<path>) [=random]"
name: "netkey-file" }: string
netKeyInsecurePassword* {.
defaultValue: false,
desc: "Use pre-generated INSECURE password for network private key " &
"file (default: false)"
"file [=false]"
name: "insecure-netkey-password" }: bool
agentString* {.
@ -136,7 +142,7 @@ type
slashingDbKind* {.
hidden
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
case cmd* {.
@ -155,23 +161,24 @@ type
name: "bootstrap-file" }: InputFile
listenAddress* {.
defaultValue: defaultListenAddress(config)
desc: "Listening address for the Ethereum LibP2P and Discovery v5 traffic"
defaultValue: defaultListenAddress
desc: "Listening address for the Ethereum LibP2P and Discovery v5 " &
"traffic [=0.0.0.0]"
name: "listen-address" }: ValidIpAddress
tcpPort* {.
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
udpPort* {.
defaultValue: defaultEth2TcpPort
desc: "Listening UDP port for node discovery, default is 9000"
desc: "Listening UDP port for node discovery [=9000]"
name: "udp-port" }: Port
maxPeers* {.
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
nat* {.
@ -222,17 +229,17 @@ type
metricsEnabled* {.
defaultValue: false
desc: "Enable the metrics server"
desc: "Enable the metrics server [=false]"
name: "metrics" }: bool
metricsAddress* {.
defaultValue: defaultAdminListenAddress(config)
desc: "Listening address of the metrics server"
defaultValue: defaultAdminListenAddress
desc: "Listening address of the metrics server [=127.0.0.1]"
name: "metrics-address" }: ValidIpAddress
metricsPort* {.
defaultValue: 8008
desc: "Listening HTTP port of the metrics server"
desc: "Listening HTTP port of the metrics server [=8008]"
name: "metrics-port" }: Port
statusBarEnabled* {.
@ -252,17 +259,17 @@ type
rpcEnabled* {.
defaultValue: false
desc: "Enable the JSON-RPC server"
desc: "Enable the JSON-RPC server [=false]"
name: "rpc" }: bool
rpcPort* {.
defaultValue: defaultEth2RpcPort
desc: "HTTP port for the JSON-RPC service"
desc: "HTTP port for the JSON-RPC service [=9190]"
name: "rpc-port" }: Port
rpcAddress* {.
defaultValue: defaultAdminListenAddress(config)
desc: "Listening address of the RPC server"
defaultValue: defaultAdminListenAddress
desc: "Listening address of the RPC server [=127.0.0.1]"
name: "rpc-address" }: ValidIpAddress
inProcessValidators* {.
@ -272,12 +279,12 @@ type
discv5Enabled* {.
defaultValue: true
desc: "Enable Discovery v5"
desc: "Enable Discovery v5 [=true]"
name: "discv5" }: bool
dumpEnabled* {.
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
directPeers* {.
@ -286,7 +293,7 @@ type
doppelgangerDetection* {.
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"
}: bool
@ -469,7 +476,7 @@ type
ValidatorClientConf* = object
logLevel* {.
defaultValue: "INFO"
desc: "Sets the log level"
desc: "Sets the log level [=INFO]"
name: "log-level" }: string
logFile* {.
@ -511,17 +518,17 @@ type
rpcPort* {.
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
rpcAddress* {.
defaultValue: defaultAdminListenAddress(config)
desc: "Address of the server to connect to for RPC - for the validator duties in the pull model"
defaultValue: defaultAdminListenAddress
desc: "Address of the server to connect to for RPC [=127.0.0.1]"
name: "rpc-address" }: ValidIpAddress
retryDelay* {.
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
proc defaultDataDir*(config: BeaconNodeConf|ValidatorClientConf): string =
@ -677,14 +684,6 @@ func outWalletFile*(config: BeaconNodeConf): Option[OutFile] =
func databaseDir*(config: BeaconNodeConf|ValidatorClientConf): string =
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,
value: TypedInputFile|InputFile|InputDir|OutPath|OutDir|OutFile) =
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:
```
Usage:
Usage:
nimbus_beacon_node [OPTIONS]... command
The following options are available:
--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.
--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.
--validators-dir A directory containing validator keystores.
--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
configuration.
--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
file (default: false).
file [=false].
--agent-string Node agent string which is used as identifier in network.
--subscribe-all-subnets Subscribe to all attestation subnet topics when gossiping.
-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
addresses.
--listen-address Listening address for the Ethereum LibP2P and Discovery v5
traffic.
--tcp-port Listening TCP port for Ethereum LibP2P traffic, the default is 9000
--udp-port Listening UDP port for node discovery, default is 9000
--max-peers The maximum number of peers to connect to.
traffic [=0.0.0.0].
--tcp-port Listening TCP port for Ethereum LibP2P traffic [=9000].
--udp-port Listening UDP port for node discovery [=9000].
--max-peers The maximum number of peers to connect to [=160].
--nat Specify method to use for determining public address. Must be
one of: any, none, upnp, pmp, extip:<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,
for testing.
--stop-at-epoch A positive epoch selects the epoch at which to stop.
--metrics Enable the metrics server.
--metrics-address Listening address of the metrics server.
--metrics-port Listening HTTP port of the metrics server.
--metrics Enable the metrics server [=false].
--metrics-address Listening address of the metrics server [=127.0.0.1].
--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-contents Textual template for the contents of the status bar.
--rpc Enable the JSON-RPC server.
--rpc-port HTTP port for the JSON-RPC service.
--rpc-address Listening address of the RPC server.
--rpc Enable the JSON-RPC server [=false].
--rpc-port HTTP port for the JSON-RPC service [=9190].
--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
process with the private keys of the validators what to sign
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
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
same validator keys (default true).
Available sub-commands:
same validator keys [=true].
...
```