More version in --version and less version in --help (#1260)

Long version and copyright banners is probably not what the user is
after when typing `--help`
This commit is contained in:
Jacek Sieka 2020-06-30 14:23:52 +02:00 committed by GitHub
parent d09e9f1aaf
commit e898525b16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 134 additions and 81 deletions

View File

@ -850,6 +850,7 @@ proc start(node: BeaconNode) =
info "Starting beacon node",
version = fullVersionStr,
nim = shortNimBanner(),
timeSinceFinalization =
int64(finalizedHead.slot.toBeaconTime()) -
int64(node.beaconClock.now()),

View File

@ -55,8 +55,14 @@ template ctrlCHandling*(extraCode: untyped) =
setControlCHook(controlCHandler)
template makeBannerAndConfig*(clientId: string, ConfType: type): untyped =
let banner = clientId & "\p" & copyrights & "\p\p" & nimBanner
ConfType.load(version = banner, copyrightBanner = banner)
let
version = clientId & "\p" & copyrights & "\p\p" &
"eth2 specification v" & SPEC_VERSION & "\p\p" &
nimBanner
# TODO for some reason, copyrights are printed when doing `--help`
ConfType.load(
version = version,
copyrightBanner = clientId) # but a short version string makes more sense...
# TODO not sure if this belongs here but it doesn't belong in `time.nim` either
proc sleepToSlotOffset*(clock: BeaconClock, extra: chronos.Duration,

View File

@ -1,19 +1,16 @@
{.push raises: [Defect].}
import strutils
when not defined(nimscript):
import times
let copyrights* = "Copyright (c) 2019-" & $(now().utc.year) & " Status Research & Development GmbH"
const
versionMajor* = 0
versionMinor* = 3
versionMinor* = 5
versionBuild* = 0
semanticVersion* = 2
# Bump this up every time a breaking change is introduced
# Clients having different semantic versions won't be able
# to join the same testnets.
useInsecureFeatures* = defined(insecure)
gitRevision* = staticExec("git rev-parse --short HEAD")
@ -25,3 +22,18 @@ const
fullVersionStr* =
versionAsStr & " (" & gitRevision & ")"
func shortNimBanner*(): string =
const gitPrefix = "git hash: "
let tmp = splitLines(nimBanner)
if tmp.len == 0:
return
var gitHash = ""
for line in tmp:
if line.startsWith(gitPrefix) and line.len > 8 + gitPrefix.len:
gitHash = line[gitPrefix.len..<gitPrefix.len + 8]
if gitHash.len > 0:
tmp[0] & " (" & gitHash & ")"
else:
tmp[0]

View File

@ -13,18 +13,8 @@ For example, download a genesis file and then run the following command to start
## Usage
```
$ ./build/beacon_node --help
Nimbus beacon node v0.3.0 (e537ed9
)
Copyright (c) 2019-2020 Status Research & Development GmbH
Nim Compiler Version 1.3.1 [Windows: amd64]
Compiled at 2020-04-16
Copyright (c) 2006-2020 by Andreas Rumpf
git hash: b4e9f8e814373fc38741736197d88475663ce758
active boot switches: -d:release
$ ./beacon_node --help
Nimbus beacon node v0.3.0 (877a358)
Usage:
@ -34,24 +24,27 @@ The following options are available:
--log-level Sets the log level.
--eth1-network The Eth1 network tracked by the beacon node.
--quick-start Run in quickstart mode
-d, --data-dir The directory where nimbus will store all blockchain data.
--web3-url URL of the Web3 server to observe Eth1.
--deposit-contract Address of the deposit contract.
-b, --bootstrap-node Specifies one or more bootstrap nodes to use when connecting to the
network.
--deposit-contract-block The Eth1 block hash where the deposit contract has been deployed.
--non-interactive Do not display interative prompts. Quit on missing configuration.
-b, --bootstrap-node Specifies one or more bootstrap nodes to use when connecting to the network.
--bootstrap-file Specifies a line-delimited file of bootstrap Ethereum network addresses.
--listen-address Listening address for the Ethereum LibP2P traffic.
--tcp-port Listening TCP port for Ethereum LibP2P traffic.
--udp-port Listening UDP port for node discovery.
--max-peers The maximum number of peers to connect to
--nat Specify method to use for determining public address. Must be one of: any,
none, upnp, pmp, extip:<IP>.
-v, --validator Path to a validator private key, as generated by makeDeposits.
--max-peers The maximum number of peers to connect to.
--nat Specify method to use for determining public address. Must be one of: any, none,
upnp, pmp, extip:<IP>.
-v, --validator Path to a validator keystore.
--validators-dir A directory containing validator keystores.
--secrets-dir A directory containing validator keystore passwords.
--wallets-dir A directory containing wallet files.
-s, --state-snapshot Json file specifying a recent state snapshot.
--node-name A name for this node that will appear in the logs. If you set this to
'auto', a persistent automatically generated ID will be selected for each
--dataDir folder.
--node-name A name for this node that will appear in the logs. If you set this to 'auto', a
persistent automatically generated ID will be selected for each --data-dir
folder.
--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.
@ -59,51 +52,92 @@ The following options are available:
--metrics-port Listening HTTP port of the metrics server.
--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 Enable the JSON-RPC server.
--rpc-port HTTP port for the JSON-RPC service.
--rpc-address Listening address of the RPC server
--dump Write SSZ dumps of blocks, attestations and states to data dir
--rpc-address Listening address of the RPC server.
--dump Write SSZ dumps of blocks, attestations and states to data dir.
Available sub-commands:
beacon_node importValidator [OPTIONS]...
beacon_node_shared_altona_0 createTestnet [OPTIONS]...
The following options are available:
--keyfile File with validator key to be imported (in hex form).
beacon_node createTestnet [OPTIONS]...
The following options are available:
-d, --validators-dir Directory containing validator descriptors named 'vXXXXXXX.deposit.json'.
--total-validators The number of validators in the newly created chain.
--validators-dir Directory containing validator keystores.
--total-validators The number of validator deposits in the newly created chain.
--first-validator Index of first validator to add to validator list.
--last-user-validator The last validator index that will free for taking from a testnet
participant.
--last-user-validator The last validator index that will free for taking from a testnet participant.
--bootstrap-address The public IP address that will be advertised as a bootstrap node for the
testnet.
--bootstrap-port The TCP/UDP port that will be used by the bootstrap node.
-g, --genesis-offset Seconds from now to add to genesis time.
--genesis-offset Seconds from now to add to genesis time.
--output-genesis Output file where to write the initial state snapshot.
--with-genesis-root Include a genesis root in 'network.json'.
--output-bootstrap-file Output file with list of bootstrap nodes for the network.
beacon_node makeDeposits [OPTIONS]...
beacon_node_shared_altona_0 deposits [OPTIONS]... command
The following options are available:
--quickstart-deposits Number of quick-start deposits to generate.
--random-deposits Number of secure random deposits to generate.
--deposits-dir Folder to write deposits to.
--deposit-private-key Private key of the controlling (sending) account
--min-delay Minimum possible delay between making two deposits (in seconds)
--max-delay Maximum possible delay between making two deposits (in seconds)
beacon_node query command
--deposit-private-key Private key of the controlling (sending) account.
Available sub-commands:
beacon_node query get <getQueryPath>
<getQueryPath> REST API path to evaluate
beacon_node_shared_altona_0 deposits create [OPTIONS]...
Creates validator keystores and deposits.
The following options are available:
--count Number of deposits to generate.
--wallet An existing wallet ID. If not specified, a new wallet will be created.
--out-deposits-dir Output folder for validator keystores and deposits.
--out-secrets-dir Output folder for randomly generated keystore passphrases.
--dont-send By default, all created deposits are also immediately sent to the validator
deposit contract. You can use this option to prevent this behavior. Use the
`deposits send` command to send the deposit transactions at your convenience
later.
beacon_node_shared_altona_0 deposits send [OPTIONS]...
Sends prepared deposits to the validator deposit contract.
The following options are available:
--deposits-dir A folder with validator metadata created by the `deposits create` command.
--min-delay Minimum possible delay between making two deposits (in seconds).
--max-delay Maximum possible delay between making two deposits (in seconds).
beacon_node_shared_altona_0 deposits status
Displays status information about all deposits.
beacon_node_shared_altona_0 wallets command
Available sub-commands:
beacon_node_shared_altona_0 wallets create [OPTIONS]...
Creates a new EIP-2386 wallet.
The following options are available:
--name An easy-to-remember name for the wallet of your choice.
--next-account Initial value for the 'nextaccount' property of the wallet.
--out Output wallet file.
beacon_node_shared_altona_0 wallets restore [OPTIONS]...
Restores a wallet from cold storage.
The following options are available:
--name An easy-to-remember name for the wallet of your choice.
--deposits Expected number of deposits to recover. If not specified, Nimbus will try to
guess the number by inspecting the latest beacon state.
--out Output wallet file.
beacon_node_shared_altona_0 wallets list
Lists details about all wallets.
```