diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index ec0a8ce65..35cf67eef 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -936,13 +936,11 @@ template bytes(memFile: MemFile): untyped = makeOpenArray(f.mem, byte, f.size) when isMainModule: - echo "$# ($#)\p" % [clientId, gitRevision] - randomize() - let config = BeaconNodeConf.load(version = fullVersionStr()) - if config.showVersion: - quit(QuitSuccess) + let config = BeaconNodeConf.load( + version = clientId, + copyrightBanner = clientId & "\p" & copyrights) when compiles(defaultChroniclesStream.output.writer): defaultChroniclesStream.output.writer = diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index e7fd27b63..95b0ed8dc 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -31,52 +31,48 @@ type BeaconNodeConf* = object logLevel* {. - desc: "Sets the log level." defaultValue: enabledLogLevel - longform: "log-level" }: LogLevel + desc: "Sets the log level." + name: "log-level" }: LogLevel eth1Network* {. - desc: "The Eth1 network tracked by the beacon node." defaultValue: goerli - longform: "eth1-network" }: Eth1Network + desc: "The Eth1 network tracked by the beacon node." + name: "eth1-network" }: Eth1Network quickStart* {. - desc: "Run in quickstart mode" defaultValue: false - longform: "quick-start" }: bool + desc: "Run in quickstart mode" + name: "quick-start" }: bool dataDir* {. - desc: "The directory where nimbus will store all blockchain data." defaultValue: config.defaultDataDir() - shortform: "d" - longform: "data-dir" }: OutDir + desc: "The directory where nimbus will store all blockchain data." + abbr: "d" + name: "data-dir" }: OutDir depositWeb3Url* {. - desc: "URL of the Web3 server to observe Eth1." defaultValue: "" - longform: "web3-url" }: string + desc: "URL of the Web3 server to observe Eth1." + name: "web3-url" }: string depositContractAddress* {. - desc: "Address of the deposit contract." defaultValue: "" - longform: "deposit-contract" }: string + desc: "Address of the deposit contract." + name: "deposit-contract" }: string statusBarEnabled* {. - desc: "Display a status bar at the bottom of the terminal screen." defaultValue: true - longform: "status-bar" }: bool + desc: "Display a status bar at the bottom of the terminal screen." + name: "status-bar" }: bool statusBarContents* {. - desc: "" defaultValue: "peers: $connected_peers; " & "epoch: $epoch, slot: $epoch_slot/$slots_per_epoch ($slot); " & "finalized epoch: $last_finalized_epoch |" & "ETH: $attached_validators_balance" - longform: "status-bar-contents" }: string - - showVersion* {. - desc: "Show version and exit." - longform: "version" }: bool + desc: "Textual template for the contents of the status bar." + name: "status-bar-contents" }: string case cmd* {. command @@ -85,23 +81,23 @@ type of noCommand: bootstrapNodes* {. desc: "Specifies one or more bootstrap nodes to use when connecting to the network." - shortform: "b" - longform: "bootstrap-node" }: seq[string] + abbr: "b" + name: "bootstrap-node" }: seq[string] bootstrapNodesFile* {. - desc: "Specifies a line-delimited file of bootsrap Ethereum network addresses." defaultValue: "" - longform: "bootstrap-file" }: InputFile + desc: "Specifies a line-delimited file of bootsrap Ethereum network addresses." + name: "bootstrap-file" }: InputFile tcpPort* {. - desc: "TCP listening port." defaultValue: defaultPort(config) - longform: "tcp-port" }: int + desc: "TCP listening port." + name: "tcp-port" }: int udpPort* {. - desc: "UDP listening port." defaultValue: defaultPort(config) - longform: "udp-port" }: int + desc: "UDP listening port." + name: "udp-port" }: int nat* {. desc: "Specify method to use for determining public address. " & @@ -111,114 +107,114 @@ type validators* {. required desc: "Path to a validator private key, as generated by makeDeposits." - shortform: "v" - longform: "validator" }: seq[ValidatorKeyPath] + abbr: "v" + name: "validator" }: seq[ValidatorKeyPath] stateSnapshot* {. desc: "Json file specifying a recent state snapshot." - shortform: "s" - longform: "state-snapshot" }: Option[InputFile] + abbr: "s" + name: "state-snapshot" }: Option[InputFile] nodeName* {. + defaultValue: "" desc: "A name for this node that will appear in the logs. " & "If you set this to 'auto', a persistent automatically generated ID will be seleceted for each --dataDir folder." - defaultValue: "" - longform: "node-name" }: string + name: "node-name" }: string metricsServer* {. - desc: "Enable the metrics server." defaultValue: false - longform: "metrics-server" }: bool + desc: "Enable the metrics server." + name: "metrics-server" }: bool metricsServerAddress* {. - desc: "Listening address of the metrics server." defaultValue: "0.0.0.0" - longform: "metrics-server-address" }: string # TODO: use a validated type here + desc: "Listening address of the metrics server." + name: "metrics-server-address" }: string # TODO: use a validated type here metricsServerPort* {. - desc: "Listening HTTP port of the metrics server." defaultValue: 8008 - longform: "metrics-server-port" }: uint16 + desc: "Listening HTTP port of the metrics server." + name: "metrics-server-port" }: uint16 of createTestnet: validatorsDir* {. desc: "Directory containing validator descriptors named 'vXXXXXXX.deposit.json'." - shortform: "d" - longform: "validators-dir" }: InputDir + abbr: "d" + name: "validators-dir" }: InputDir totalValidators* {. desc: "The number of validators in the newly created chain." - longform: "total-validators" }: uint64 + name: "total-validators" }: uint64 firstValidator* {. - desc: "Index of first validator to add to validator list." defaultValue: 0 - longform: "first-validator" }: uint64 + desc: "Index of first validator to add to validator list." + name: "first-validator" }: uint64 lastUserValidator* {. - desc: "The last validator index that will free for taking from a testnet participant." defaultValue: config.totalValidators - 1, - longform: "last-user-validator" }: uint64 + desc: "The last validator index that will free for taking from a testnet participant." + name: "last-user-validator" }: uint64 bootstrapAddress* {. - desc: "The public IP address that will be advertised as a bootstrap node for the testnet." defaultValue: "127.0.0.1" - longform: "bootstrap-address" }: string + desc: "The public IP address that will be advertised as a bootstrap node for the testnet." + name: "bootstrap-address" }: string bootstrapPort* {. - desc: "The TCP/UDP port that will be used by the bootstrap node." defaultValue: defaultPort(config) - longform: "bootstrap-port" }: int + desc: "The TCP/UDP port that will be used by the bootstrap node." + name: "bootstrap-port" }: int genesisOffset* {. - desc: "Seconds from now to add to genesis time." defaultValue: 5 - shortForm: "g" - longform: "genesis-offset" }: int + desc: "Seconds from now to add to genesis time." + abbr: "g" + name: "genesis-offset" }: int outputGenesis* {. desc: "Output file where to write the initial state snapshot." - longform: "output-genesis" }: OutFile + name: "output-genesis" }: OutFile withGenesisRoot* {. - desc: "Include a genesis root in 'network.json'." defaultValue: false - longform: "with-genesis-root" }: bool + desc: "Include a genesis root in 'network.json'." + name: "with-genesis-root" }: bool outputBootstrapFile* {. desc: "Output file with list of bootstrap nodes for the network." - longform: "output-bootstrap-file" }: OutFile + name: "output-bootstrap-file" }: OutFile of importValidator: keyFiles* {. desc: "File with validator key to be imported (in hex form)." - longform: "keyfile" }: seq[ValidatorKeyPath] + name: "keyfile" }: seq[ValidatorKeyPath] of makeDeposits: totalQuickstartDeposits* {. - desc: "Number of quick-start deposits to generate." defaultValue: 0 - longform: "quickstart-deposits" }: int + desc: "Number of quick-start deposits to generate." + name: "quickstart-deposits" }: int totalRandomDeposits* {. - desc: "Number of secure random deposits to generate." defaultValue: 0 - longform: "random-deposits" }: int + desc: "Number of secure random deposits to generate." + name: "random-deposits" }: int depositsDir* {. - desc: "Folder to write deposits to." defaultValue: "validators" - longform: "deposits-dir" }: string + desc: "Folder to write deposits to." + name: "deposits-dir" }: string depositPrivateKey* {. - desc: "Private key of the controlling (sending) account", defaultValue: "" - longform: "deposit-private-key" }: string + desc: "Private key of the controlling (sending) account", + name: "deposit-private-key" }: string of query: case queryCmd* {. - command defaultValue: nimQuery + command desc: "Query the beacon node database and print the result" }: QueryCmd of nimQuery: diff --git a/beacon_chain/deposit_contract.nim b/beacon_chain/deposit_contract.nim index 294f0059f..22ecae958 100644 --- a/beacon_chain/deposit_contract.nim +++ b/beacon_chain/deposit_contract.nim @@ -16,12 +16,12 @@ type CliConfig = object depositWeb3Url* {. desc: "URL of the Web3 server to observe Eth1" - longform: "web3-url" }: string + name: "web3-url" }: string privateKey* {. - desc: "Private key of the controlling account", defaultValue: "" - longform: "private-key" }: string + desc: "Private key of the controlling account" + name: "private-key" }: string case cmd* {.command.}: StartUpCommand of deploy: @@ -29,13 +29,13 @@ type of drain: contractAddress* {. - desc: "Address of the contract to drain", defaultValue: "" - longform: "deposit-contract" }: string + desc: "Address of the contract to drain" + name: "deposit-contract" }: string of sendEth: - toAddress {.longform: "to".}: string - valueEth {.longform: "eth".}: string + toAddress {.name: "to".}: string + valueEth {.name: "eth".}: string contract(Deposit): proc drain() diff --git a/beacon_chain/inspector.nim b/beacon_chain/inspector.nim index d76a004fa..63ea42bba 100644 --- a/beacon_chain/inspector.nim +++ b/beacon_chain/inspector.nim @@ -33,36 +33,60 @@ type noCommand InspectorConf* = object - logLevel* {.desc: "Sets the inspector's verbosity log level", - longform: "verbosity", shortform: "v", - defaultValue: LogLevel.TRACE.}: LogLevel - fullPeerId* {.desc: "Sets the inspector full PeerID output", - longform: "fullpeerid", shortform: "p", - defaultValue: false.}: bool - floodSub* {.desc: "Sets inspector engine to FloodSub", - longform: "floodsub", shortform: "f", - defaultValue: true.}: bool - gossipSub* {.desc: "Sets inspector engine to GossipSub", - longform: "gossipsub", shortform: "g", - defaultValue: false.}: bool - signFlag* {.desc: "Sets the inspector's to send/verify signatures in " & - "pubsub messages", - longform: "sign", shortform: "s", defaultValue: false.}: bool - topics* {.desc: "Sets monitored topics, where `*` - all, " & - "[a]ttestations, [b]locks, [e]xits, " & - "[ps]roposer slashings, [as]ttester slashings", - longform: "topics", shortform: "t".}: seq[string] - customTopics* {.desc: "Sets custom monitored topics", - longform: "custom", shortform: "c".}: seq[string] + logLevel* {. + defaultValue: LogLevel.TRACE + desc: "Sets the inspector's verbosity log level" + abbr: "v" + name: "verbosity" }: LogLevel + + fullPeerId* {. + defaultValue: false + desc: "Sets the inspector full PeerID output" + abbr: "p" + name: "fullpeerid" }: bool + + floodSub* {. + defaultValue: true + desc: "Sets inspector engine to FloodSub" + abbr: "f" + name: "floodsub" }: bool + + gossipSub* {. + defaultValue: false + desc: "Sets inspector engine to GossipSub" + abbr: "g" + name: "gossipsub" }: bool + + signFlag* {. + defaultValue: false + desc: "Sets the inspector's to send/verify signatures in pubsub messages" + abbr: "s" + name: "sign" }: bool + + topics* {. + desc: "Sets monitored topics, where `*` - all, " & + "[a]ttestations, [b]locks, [e]xits, " & + "[ps]roposer slashings, [as]ttester slashings" + abbr: "t" + name: "topics" }: seq[string] + + customTopics* {. + desc: "Sets custom monitored topics" + abbr: "c" + name: "custom" }: seq[string] + bootstrapFile* {. + defaultValue: "" desc: "Specifies file which holds bootstrap nodes multiaddresses " & - "delimeted by CRLF", - longform: "bootfile", shortform: "l", defaultValue: "".}: string + "delimeted by CRLF" + abbr: "l" + name: "bootfile" }: string + bootstrapNodes* {. desc: "Specifies one or more bootstrap nodes" & - " to use when connecting to the network", - longform: "bootnodes", shortform: "b".}: seq[string] - + " to use when connecting to the network" + abbr: "b" + name: "bootnodes" }: seq[string] proc getTopic(filter: TopicFilter): string {.inline.} = case filter diff --git a/beacon_chain/version.nim b/beacon_chain/version.nim index 20308ab1d..0d297d91c 100644 --- a/beacon_chain/version.nim +++ b/beacon_chain/version.nim @@ -13,6 +13,8 @@ const else: {.fatal: "The 'network_type' should be either 'libp2p', 'libp2p_daemon' or 'rlpx'" .} const + copyrights* = "Copyright (c) 2019 Status Research & Development GmbH" + versionMajor* = 0 versionMinor* = 3 versionBuild* = 0 @@ -33,5 +35,5 @@ template versionAsStr*: string = $versionMajor & "." & $versionMinor & "." & $versionBuild proc fullVersionStr*: string = - versionAsStr & "_" & network_type + versionAsStr & " (" & gitRevision & ", " & network_type & ")" diff --git a/docker/manage_testnet_hosts.nims b/docker/manage_testnet_hosts.nims index 8bb08105f..9667b04c3 100644 --- a/docker/manage_testnet_hosts.nims +++ b/docker/manage_testnet_hosts.nims @@ -16,18 +16,18 @@ type of reset_network: depositsDir {. defaultValue: "deposits" - longform: "deposits-dir" }: string + name: "deposits-dir" }: string networkDataDir {. defaultValue: "data" - longform: "network-data-dir"}: string + name: "network-data-dir" }: string totalValidators {. - longform: "total-validators" }: int + name: "total-validators" }: int totalUserValidators {. defaultValue: 0 - longform: "user-validators" }: int + name: "user-validators" }: int var conf = load CliConfig diff --git a/vendor/nim-confutils b/vendor/nim-confutils index 4ba6c6476..b42717a73 160000 --- a/vendor/nim-confutils +++ b/vendor/nim-confutils @@ -1 +1 @@ -Subproject commit 4ba6c64761579ca4cd4e06b2d5f843ef6f1c359c +Subproject commit b42717a73a4f31f67a59146d95dbe765b2a9e406