2021-03-26 06:52:01 +00:00
# beacon_chain
# Copyright (c) 2018-2021 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
2020-04-22 05:53:02 +00:00
{. push raises : [ Defect ] . }
2018-11-23 23:58:49 +00:00
import
2021-12-22 12:37:31 +00:00
std / [ strutils , os , options , unicode , uri ] ,
2021-05-19 06:38:13 +00:00
2020-07-02 15:14:11 +00:00
chronicles , chronicles / options as chroniclesOptions ,
2020-10-01 19:08:59 +00:00
confutils , confutils / defs , confutils / std / net , stew / shims / net as stewNet ,
2021-05-19 06:38:13 +00:00
stew / [ io2 , byteutils ] , unicodedb / properties , normalize ,
2021-02-16 20:35:10 +00:00
eth / common / eth_types as commonEthTypes , eth / net / nat ,
2020-11-24 23:23:28 +00:00
eth / p2p / discoveryv5 / enr ,
2020-07-17 20:59:50 +00:00
json_serialization , web3 / [ ethtypes , confutils_defs ] ,
2021-05-19 06:38:13 +00:00
2021-08-12 13:08:20 +00:00
. / spec / [ keystore , network ] ,
2021-06-21 08:35:24 +00:00
. / spec / datatypes / base ,
2021-03-05 13:12:00 +00:00
. / networking / network_metadata ,
2021-05-19 06:38:13 +00:00
. / validators / slashing_protection_common ,
. / filepath
2018-12-19 12:58:53 +00:00
export
2020-11-27 19:48:33 +00:00
uri ,
2020-10-01 19:08:59 +00:00
defaultEth2TcpPort , enabledLogLevel , ValidIpAddress ,
2021-12-22 12:37:31 +00:00
defs , parseCmdArg , completeCmdArg , network_metadata ,
network
2019-03-26 19:44:51 +00:00
2021-04-01 12:28:57 +00:00
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 " ) )
2021-11-30 01:20:21 +00:00
defaultSigningNodeRequestTimeout * = 60
2021-04-01 12:28:57 +00:00
2018-11-23 23:58:49 +00:00
type
2022-01-17 09:27:08 +00:00
BNStartUpCmd * {. pure . } = enum
2018-12-19 12:58:53 +00:00
noCommand
2019-03-26 10:01:13 +00:00
createTestnet
2020-06-15 22:20:31 +00:00
deposits
2020-06-23 19:11:07 +00:00
wallets
2020-11-24 23:23:28 +00:00
record
2020-12-04 16:28:42 +00:00
web3
2021-05-19 06:38:13 +00:00
slashingdb
2022-01-17 09:27:08 +00:00
trustedNodeSync
2020-06-15 22:20:31 +00:00
2020-06-23 19:11:07 +00:00
WalletsCmd * {. pure . } = enum
create = " Creates a new EIP-2386 wallet "
restore = " Restores a wallet from cold storage "
list = " Lists details about all wallets "
2020-06-15 22:20:31 +00:00
2020-06-23 19:11:07 +00:00
DepositsCmd * {. pure . } = enum
2021-04-08 11:35:58 +00:00
createTestnetDeposits = " Creates validator keystores and deposits for testnet usage "
2020-08-02 17:26:57 +00:00
` import ` = " Imports password-protected keystores interactively "
2020-11-27 19:48:33 +00:00
# status = "Displays status information about all deposits"
exit = " Submits a validator voluntary exit "
2019-11-01 09:53:06 +00:00
2020-05-22 17:04:52 +00:00
VCStartUpCmd * = enum
VCNoCommand
2021-11-30 01:20:21 +00:00
SNStartUpCmd * = enum
SNNoCommand
2020-11-24 23:23:28 +00:00
RecordCmd * {. pure . } = enum
create = " Create a new ENR "
print = " Print the content of a given ENR "
2020-12-04 16:28:42 +00:00
Web3Cmd * {. pure . } = enum
test = " Test a web3 provider "
2021-02-19 18:39:18 +00:00
SlashingDbKind * {. pure . } = enum
v1
v2
both
2021-11-02 17:06:36 +00:00
StdoutLogKind * {. pure . } = enum
Auto = " auto "
Colors = " colors "
NoColors = " nocolors "
Json = " json "
None = " none "
2021-05-19 06:38:13 +00:00
SlashProtCmd * = enum
` import ` = " Import a EIP-3076 slashing protection interchange file "
` export ` = " Export a EIP-3076 slashing protection interchange file "
# migrateAll = "Export and remove the whole validator slashing protection DB."
# migrate = "Export and remove specified validators from Nimbus."
2018-11-29 01:08:34 +00:00
BeaconNodeConf * = object
2019-01-16 23:01:15 +00:00
logLevel * {.
2021-05-19 06:38:13 +00:00
desc : " Sets the log level for process and topics (e.g. \" DEBUG; TRACE:discv5,libp2p; REQUIRED:none; DISABLED:none \" ) "
2020-11-09 08:12:48 +00:00
defaultValue : " INFO "
2020-04-27 22:39:04 +00:00
name : " log-level " } : string
2019-03-18 03:54:08 +00:00
2021-11-02 17:06:36 +00:00
logStdout * {.
2021-11-10 09:02:18 +00:00
hidden
2021-11-02 17:06:36 +00:00
desc : " Specifies what kind of logs should be written to stdout (auto, colors, nocolors, json) "
defaultValueDesc : " auto "
defaultValue : StdoutLogKind . Auto
2021-11-10 09:02:18 +00:00
name : " log-format " } : StdoutLogKind
2021-11-02 17:06:36 +00:00
2020-07-15 13:15:55 +00:00
logFile * {.
2021-11-10 09:02:18 +00:00
desc : " Specifies a path for the written Json log file (deprecated) "
2020-07-15 13:15:55 +00:00
name : " log-file " } : Option [ OutFile ]
2020-07-02 15:14:11 +00:00
eth2Network * {.
2021-05-19 06:38:13 +00:00
desc : " The Eth2 network to join "
defaultValueDesc : " mainnet "
2020-07-02 15:14:11 +00:00
name : " network " } : Option [ string ]
2019-03-19 17:22:17 +00:00
dataDir * {.
2020-06-23 19:11:07 +00:00
desc : " The directory where nimbus will store all blockchain data "
2021-05-19 06:38:13 +00:00
defaultValue : config . defaultDataDir ( )
defaultValueDesc : " "
2019-11-11 14:43:12 +00:00
abbr : " d "
name : " data-dir " } : OutDir
2019-01-16 23:01:15 +00:00
2020-08-01 18:32:41 +00:00
validatorsDirFlag * {.
desc : " A directory containing validator keystores "
name : " validators-dir " } : Option [ InputDir ]
2020-08-02 17:26:57 +00:00
secretsDirFlag * {.
desc : " A directory containing validator keystore passwords "
name : " secrets-dir " } : Option [ InputDir ]
2020-07-17 20:59:50 +00:00
walletsDirFlag * {.
desc : " A directory containing wallet files "
name : " wallets-dir " } : Option [ InputDir ]
2021-04-06 21:42:59 +00:00
web3Urls * {.
2021-05-02 15:01:49 +00:00
desc : " One or more Web3 provider URLs used for obtaining deposit contract data "
2021-04-06 21:42:59 +00:00
name : " web3-url " } : seq [ string ]
2019-09-01 15:02:49 +00:00
2021-11-25 16:51:51 +00:00
web3ForcePolling * {.
hidden
defaultValue : false
desc : " Force the use of polling when determining the head block of Eth1 "
name : " web3-force-polling " } : bool
2020-06-01 19:48:20 +00:00
nonInteractive * {.
2020-06-23 19:11:07 +00:00
desc : " Do not display interative prompts. Quit on missing configuration "
2020-06-01 19:48:20 +00:00
name : " non-interactive " } : bool
2020-08-25 12:49:05 +00:00
netKeyFile * {.
desc : " Source of network (secp256k1) private key file " &
2021-05-19 06:38:13 +00:00
" (random|<path>) "
defaultValue : " random " ,
2020-08-25 12:49:05 +00:00
name : " netkey-file " } : string
netKeyInsecurePassword * {.
2021-05-19 06:38:13 +00:00
desc : " Use pre-generated INSECURE password for network private key file "
2020-08-25 12:49:05 +00:00
defaultValue : false ,
name : " insecure-netkey-password " } : bool
2020-11-28 07:00:36 +00:00
agentString * {.
defaultValue : " nimbus " ,
desc : " Node agent string which is used as identifier in network "
name : " agent-string " } : string
2021-01-12 12:43:15 +00:00
subscribeAllSubnets * {.
defaultValue : false ,
desc : " Subscribe to all attestation subnet topics when gossiping "
name : " subscribe-all-subnets " } : bool
2021-02-19 18:39:18 +00:00
slashingDbKind * {.
2021-02-19 15:18:17 +00:00
hidden
2021-04-04 22:55:17 +00:00
defaultValue : SlashingDbKind . v2
2021-05-19 06:38:13 +00:00
desc : " The slashing DB flavour to use "
2021-02-19 18:39:18 +00:00
name : " slashing-db-kind " } : SlashingDbKind
2021-02-19 15:18:17 +00:00
2021-09-17 00:13:52 +00:00
numThreads * {.
defaultValue : 1 ,
2021-10-04 15:10:24 +00:00
desc : " Number of worker threads (set this to 0 to use as many threads as there are CPU cores available) "
2021-09-17 00:13:52 +00:00
name : " num-threads " } : int
2018-12-19 12:58:53 +00:00
case cmd * {.
command
2022-01-17 09:27:08 +00:00
defaultValue : BNStartUpCmd . noCommand } : BNStartUpCmd
2018-12-19 12:58:53 +00:00
2022-01-17 09:27:08 +00:00
of BNStartUpCmd . noCommand :
2018-12-19 12:58:53 +00:00
bootstrapNodes * {.
2020-06-23 19:11:07 +00:00
desc : " Specifies one or more bootstrap nodes to use when connecting to the network "
2019-11-11 14:43:12 +00:00
abbr : " b "
name : " bootstrap-node " } : seq [ string ]
2018-11-23 23:58:49 +00:00
2018-12-19 12:58:53 +00:00
bootstrapNodesFile * {.
2020-06-23 19:11:07 +00:00
desc : " Specifies a line-delimited file of bootstrap Ethereum network addresses "
2021-05-19 06:38:13 +00:00
defaultValue : " "
2019-11-11 14:43:12 +00:00
name : " bootstrap-file " } : InputFile
2018-11-23 23:58:49 +00:00
2020-09-27 20:00:24 +00:00
listenAddress * {.
2021-05-19 06:38:13 +00:00
desc : " Listening address for the Ethereum LibP2P and Discovery v5 traffic "
2021-04-01 12:28:57 +00:00
defaultValue : defaultListenAddress
2021-05-19 06:38:13 +00:00
defaultValueDesc : " 0.0.0.0 "
2020-06-05 15:08:50 +00:00
name : " listen-address " } : ValidIpAddress
2020-03-18 19:36:22 +00:00
2018-12-19 12:58:53 +00:00
tcpPort * {.
2021-05-19 06:38:13 +00:00
desc : " Listening TCP port for Ethereum LibP2P traffic "
2020-03-16 22:28:54 +00:00
defaultValue : defaultEth2TcpPort
2021-05-19 06:38:13 +00:00
defaultValueDesc : " 9000 "
2020-03-16 22:28:54 +00:00
name : " tcp-port " } : Port
2018-11-23 23:58:49 +00:00
2018-12-19 12:58:53 +00:00
udpPort * {.
2021-05-19 06:38:13 +00:00
desc : " Listening UDP port for node discovery "
2020-03-16 22:28:54 +00:00
defaultValue : defaultEth2TcpPort
2021-06-10 08:42:40 +00:00
defaultValueDesc : " 9000 "
2020-03-16 22:28:54 +00:00
name : " udp-port " } : Port
2018-11-23 23:58:49 +00:00
2019-12-18 01:11:20 +00:00
maxPeers * {.
2021-05-19 06:38:13 +00:00
desc : " The maximum number of peers to connect to "
2020-11-29 13:43:41 +00:00
defaultValue : 160 # 5 (fanout) * 64 (subnets) / 2 (subs) for a heathy mesh
2019-12-18 01:11:20 +00:00
name : " max-peers " } : int
2019-03-19 03:57:19 +00:00
nat * {.
2019-10-28 23:04:52 +00:00
desc : " Specify method to use for determining public address. " &
2020-06-23 19:11:07 +00:00
" Must be one of: any, none, upnp, pmp, extip:<IP> "
2021-02-16 20:35:10 +00:00
defaultValue : NatConfig ( hasExtIp : false , nat : NatAny )
2021-05-19 06:38:13 +00:00
defaultValueDesc : " any "
2021-02-16 20:35:10 +00:00
name : " nat " . } : NatConfig
2019-03-19 03:57:19 +00:00
2021-02-02 08:07:21 +00:00
enrAutoUpdate * {.
desc : " Discovery can automatically update its ENR with the IP address " &
" and UDP port as seen by other nodes it communicates with. " &
" This option allows to enable/disable this functionality "
2021-05-19 06:38:13 +00:00
defaultValue : false
2021-02-02 08:07:21 +00:00
name : " enr-auto-update " . } : bool
2020-09-22 20:42:42 +00:00
weakSubjectivityCheckpoint * {.
desc : " Weak subjectivity checkpoint in the format block_root:epoch_number "
2020-10-06 15:32:17 +00:00
name : " weak-subjectivity-checkpoint " } : Option [ Checkpoint ]
2018-12-19 12:58:53 +00:00
2020-09-22 20:42:42 +00:00
finalizedCheckpointState * {.
2021-11-10 11:39:08 +00:00
hidden # TODO unhide when backfilling is done
2020-09-22 20:42:42 +00:00
desc : " SSZ file specifying a recent finalized state "
name : " finalized-checkpoint-state " } : Option [ InputFile ]
finalizedCheckpointBlock * {.
2021-11-10 11:39:08 +00:00
hidden # TODO unhide when backfilling is done
2020-09-22 20:42:42 +00:00
desc : " SSZ file specifying a recent finalized block "
name : " finalized-checkpoint-block " } : Option [ InputFile ]
2020-07-02 15:52:48 +00:00
2019-10-28 23:04:52 +00:00
nodeName * {.
2019-03-22 14:35:20 +00:00
desc : " A name for this node that will appear in the logs. " &
2020-06-23 19:11:07 +00:00
" If you set this to ' auto ' , a persistent automatically generated ID will be selected for each --data-dir folder "
2021-05-19 06:38:13 +00:00
defaultValue : " "
2019-11-11 14:43:12 +00:00
name : " node-name " } : string
2019-03-22 14:35:20 +00:00
2020-06-29 17:30:19 +00:00
graffiti * {.
desc : " The graffiti value that will appear in proposed blocks. " &
2020-11-09 08:12:48 +00:00
" You can use a 0x-prefixed hex encoded string to specify raw bytes "
2020-06-29 17:30:19 +00:00
name : " graffiti " } : Option [ GraffitiBytes ]
2020-02-17 18:24:14 +00:00
verifyFinalization * {.
2020-06-23 19:11:07 +00:00
desc : " Specify whether to verify finalization occurs on schedule, for testing "
2021-05-19 06:38:13 +00:00
defaultValue : false
2020-02-17 18:24:14 +00:00
name : " verify-finalization " } : bool
2020-02-17 21:22:50 +00:00
stopAtEpoch * {.
2020-06-23 19:11:07 +00:00
desc : " A positive epoch selects the epoch at which to stop "
2021-05-19 06:38:13 +00:00
defaultValue : 0
2020-02-17 21:22:50 +00:00
name : " stop-at-epoch " } : uint64
2020-02-17 18:24:14 +00:00
2020-03-16 22:28:54 +00:00
metricsEnabled * {.
2021-05-19 06:38:13 +00:00
desc : " Enable the metrics server "
2019-10-28 23:04:52 +00:00
defaultValue : false
2020-03-16 22:28:54 +00:00
name : " metrics " } : bool
2019-09-07 17:48:05 +00:00
2020-03-16 22:28:54 +00:00
metricsAddress * {.
2021-05-19 06:38:13 +00:00
desc : " Listening address of the metrics server "
2021-04-01 12:28:57 +00:00
defaultValue : defaultAdminListenAddress
2021-05-19 06:38:13 +00:00
defaultValueDesc : " 127.0.0.1 "
2020-06-05 15:08:50 +00:00
name : " metrics-address " } : ValidIpAddress
2019-09-07 17:48:05 +00:00
2020-03-16 22:28:54 +00:00
metricsPort * {.
2021-05-19 06:38:13 +00:00
desc : " Listening HTTP port of the metrics server "
2019-10-28 23:04:52 +00:00
defaultValue : 8008
2020-03-16 22:28:54 +00:00
name : " metrics-port " } : Port
2019-09-07 17:48:05 +00:00
2020-03-18 19:36:22 +00:00
statusBarEnabled * {.
2020-06-23 19:11:07 +00:00
desc : " Display a status bar at the bottom of the terminal screen "
2021-05-19 06:38:13 +00:00
defaultValue : true
2020-03-18 19:36:22 +00:00
name : " status-bar " } : bool
statusBarContents * {.
2021-05-19 06:38:13 +00:00
desc : " Textual template for the contents of the status bar "
2020-06-08 16:04:11 +00:00
defaultValue : " peers: $connected_peers ; " &
" finalized: $finalized_root : $finalized_epoch ; " &
" head: $head_root : $head_epoch : $head_epoch_slot ; " &
2020-09-11 12:46:01 +00:00
" time: $epoch : $epoch_slot ( $slot ); " &
2020-11-28 18:53:51 +00:00
" sync: $sync_status | " &
" ETH: $attached_validators_balance "
2021-05-19 06:38:13 +00:00
defaultValueDesc : " "
2020-03-18 19:36:22 +00:00
name : " status-bar-contents " } : string
rpcEnabled * {.
2021-05-19 06:38:13 +00:00
desc : " Enable the JSON-RPC server "
2020-03-18 19:36:22 +00:00
defaultValue : false
name : " rpc " } : bool
rpcPort * {.
2021-05-19 06:38:13 +00:00
desc : " HTTP port for the JSON-RPC service "
2020-03-18 19:36:22 +00:00
defaultValue : defaultEth2RpcPort
2021-05-19 06:38:13 +00:00
defaultValueDesc : " 9190 "
2020-03-18 19:36:22 +00:00
name : " rpc-port " } : Port
rpcAddress * {.
2021-05-19 06:38:13 +00:00
desc : " Listening address of the RPC server "
2021-04-01 12:28:57 +00:00
defaultValue : defaultAdminListenAddress
2021-05-19 06:38:13 +00:00
defaultValueDesc : " 127.0.0.1 "
2020-06-05 15:08:50 +00:00
name : " rpc-address " } : ValidIpAddress
2020-03-18 19:36:22 +00:00
2021-03-17 18:46:45 +00:00
restEnabled * {.
2021-10-21 08:24:22 +00:00
desc : " Enable the REST server "
2021-03-17 18:46:45 +00:00
defaultValue : false
name : " rest " } : bool
restPort * {.
2021-10-21 08:24:22 +00:00
desc : " Port for the REST server "
2021-03-29 10:59:39 +00:00
defaultValue : DefaultEth2RestPort
2021-05-19 06:38:13 +00:00
defaultValueDesc : " 5052 "
2021-03-17 18:46:45 +00:00
name : " rest-port " } : Port
restAddress * {.
2021-10-21 08:24:22 +00:00
desc : " Listening address of the REST server "
2021-04-03 01:50:47 +00:00
defaultValue : defaultAdminListenAddress
2021-05-19 06:38:13 +00:00
defaultValueDesc : " 127.0.0.1 "
2021-03-17 18:46:45 +00:00
name : " rest-address " } : ValidIpAddress
2022-01-05 14:49:10 +00:00
restCacheSize * {.
defaultValue : 3
desc : " The maximum number of recently accessed states that are kept in " &
" memory. Speeds up requests obtaining information for consecutive " &
" slots or epochs. "
name : " rest-statecache-size " } : Natural
restCacheTtl * {.
defaultValue : 60
desc : " The number of seconds to keep recently accessed states in memory "
name : " rest-statecache-ttl " } : Natural
2021-12-22 12:37:31 +00:00
keymanagerEnabled * {.
desc : " Enable the REST keymanager API (BETA version) "
defaultValue : false
name : " keymanager " } : bool
keymanagerPort * {.
desc : " Listening port for the REST keymanager API "
defaultValue : DefaultEth2RestPort
defaultValueDesc : " 5052 "
name : " keymanager-port " } : Port
keymanagerAddress * {.
desc : " Listening port for the REST keymanager API "
defaultValue : defaultAdminListenAddress
defaultValueDesc : " 127.0.0.1 "
name : " keymanager-address " } : ValidIpAddress
keymanagerTokenFile * {.
desc : " A file specifying the authorizition token required for accessing the keymanager API "
name : " keymanager-token-file " } : Option [ InputFile ]
2021-10-04 19:08:31 +00:00
2020-09-01 13:44:40 +00:00
inProcessValidators * {.
desc : " 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 "
2021-05-19 06:38:13 +00:00
defaultValue : true # the use of the nimbus_signing_process binary by default will be delayed until async I/O over stdin/stdout is developed for the child process.
2020-09-01 13:44:40 +00:00
name : " in-process-validators " } : bool
2020-08-24 11:52:06 +00:00
discv5Enabled * {.
2021-05-19 06:38:13 +00:00
desc : " Enable Discovery v5 "
2020-08-24 11:52:06 +00:00
defaultValue : true
name : " discv5 " } : bool
2020-03-18 19:36:22 +00:00
dumpEnabled * {.
2021-05-19 06:38:13 +00:00
desc : " Write SSZ dumps of blocks, attestations and states to data dir "
2019-12-03 11:32:27 +00:00
defaultValue : false
2020-03-18 19:36:22 +00:00
name : " dump " } : bool
2019-12-03 11:32:27 +00:00
2021-03-23 06:10:17 +00:00
directPeers * {.
desc : " 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. "
name : " direct-peer " . } : seq [ string ]
2021-02-01 11:18:16 +00:00
doppelgangerDetection * {.
2021-06-03 09:20:42 +00:00
desc : " If enabled, the beacon node prudently listens for 2 epochs for attestations from a validator with the same index (a doppelganger), before sending an attestation itself. This protects against slashing (due to double-voting) but means you will miss two attestations when restarting. "
2021-02-03 17:11:42 +00:00
defaultValue : true
2021-02-01 11:18:16 +00:00
name : " doppelganger-detection "
2021-02-03 17:11:42 +00:00
} : bool
2020-10-27 17:21:35 +00:00
2021-11-18 19:35:26 +00:00
syncHorizon * {.
hidden
desc : " Number of empty slots to process before considering the client out of sync "
defaultValue : MaxEmptySlotCount
defaultValueDesc : " 50 "
name : " sync-horizon " } : uint64
2021-12-13 15:45:48 +00:00
# https://github.com/ethereum/consensus-specs/blob/v1.1.6/specs/merge/client-settings.md#override-terminal-total-difficulty
2022-01-03 12:22:56 +00:00
# TODO nim-confutils on 32-bit platforms overflows decoding integers
# requiring 64-bit representations and doesn't build when specifying
# UInt256 directly, so pass this through for decoding elsewhere.
2021-11-25 10:53:31 +00:00
terminalTotalDifficultyOverride * {.
hidden
desc : " Override pre-configured TERMINAL_TOTAL_DIFFICULTY parameter "
name : " terminal-total-difficulty-override "
2022-01-03 12:22:56 +00:00
} : Option [ string ]
2021-11-25 10:53:31 +00:00
2021-12-20 19:20:31 +00:00
validatorMonitorAuto * {.
desc : " Automatically monitor locally active validators (BETA) "
defaultValue : false
name : " validator-monitor-auto " } : bool
validatorMonitorPubkeys * {.
desc : " One or more validators to monitor - works best when --subscribe-all-subnets is enabled (BETA) "
name : " validator-monitor-pubkey " } : seq [ ValidatorPubKey ]
validatorMonitorTotals * {.
desc : " Publish metrics to single ' totals ' label for better collection performance when monitoring many validators (BETA) "
defaultValue : false
name : " validator-monitor-totals " } : bool
2022-01-17 09:27:08 +00:00
of BNStartUpCmd . createTestnet :
2020-07-17 20:59:50 +00:00
testnetDepositsFile * {.
desc : " A LaunchPad deposits file for the genesis state validators "
name : " deposits-file " } : InputFile
2019-03-07 13:59:28 +00:00
2019-03-27 12:06:06 +00:00
totalValidators * {.
2020-06-23 19:11:07 +00:00
desc : " The number of validator deposits in the newly created chain "
2019-11-11 14:43:12 +00:00
name : " total-validators " } : uint64
2019-03-07 13:59:28 +00:00
2019-03-19 17:22:17 +00:00
bootstrapAddress * {.
2020-06-23 19:11:07 +00:00
desc : " The public IP address that will be advertised as a bootstrap node for the testnet "
2021-05-19 06:38:13 +00:00
defaultValue : init ( ValidIpAddress , " 127.0.0.1 " )
defaultValueDesc : " 127.0.0.1 "
2020-06-05 15:08:50 +00:00
name : " bootstrap-address " } : ValidIpAddress
2019-03-19 17:22:17 +00:00
bootstrapPort * {.
2020-06-23 19:11:07 +00:00
desc : " The TCP/UDP port that will be used by the bootstrap node "
2021-05-19 06:38:13 +00:00
defaultValue : defaultEth2TcpPort
defaultValueDesc : " 9000 "
2020-03-16 22:28:54 +00:00
name : " bootstrap-port " } : Port
2018-12-19 12:58:53 +00:00
2019-02-15 16:33:32 +00:00
genesisOffset * {.
2020-06-23 19:11:07 +00:00
desc : " Seconds from now to add to genesis time "
2021-05-19 06:38:13 +00:00
defaultValue : 5
2019-11-11 14:43:12 +00:00
name : " genesis-offset " } : int
2019-02-15 16:33:32 +00:00
2019-03-19 17:22:17 +00:00
outputGenesis * {.
2020-06-23 19:11:07 +00:00
desc : " Output file where to write the initial state snapshot "
2019-11-11 14:43:12 +00:00
name : " output-genesis " } : OutFile
2019-03-18 03:54:08 +00:00
2019-10-28 23:04:52 +00:00
outputBootstrapFile * {.
2020-06-23 19:11:07 +00:00
desc : " Output file with list of bootstrap nodes for the network "
2019-11-11 14:43:12 +00:00
name : " output-bootstrap-file " } : OutFile
2019-09-10 22:13:27 +00:00
2022-01-17 09:27:08 +00:00
of BNStartUpCmd . wallets :
2020-06-23 19:11:07 +00:00
case walletsCmd * {. command . } : WalletsCmd
of WalletsCmd . create :
nextAccount * {.
desc : " Initial value for the ' nextaccount ' property of the wallet "
name : " next-account " } : Option [ Natural ]
2020-07-17 20:59:50 +00:00
createdWalletNameFlag * {.
desc : " An easy-to-remember name for the wallet of your choice "
name : " name " } : Option [ WalletName ]
2020-07-14 19:00:35 +00:00
2020-07-17 20:59:50 +00:00
createdWalletFileFlag * {.
2020-06-23 19:11:07 +00:00
desc : " Output wallet file "
name : " out " } : Option [ OutFile ]
of WalletsCmd . restore :
2020-07-17 20:59:50 +00:00
restoredWalletNameFlag * {.
2020-06-23 19:11:07 +00:00
desc : " An easy-to-remember name for the wallet of your choice "
name : " name " } : Option [ WalletName ]
2020-07-17 20:59:50 +00:00
restoredWalletFileFlag * {.
desc : " Output wallet file "
name : " out " } : Option [ OutFile ]
2020-06-23 19:11:07 +00:00
restoredDepositsCount * {.
desc : " Expected number of deposits to recover. If not specified, " &
" Nimbus will try to guess the number by inspecting the latest " &
" beacon state "
name : " deposits " . } : Option [ Natural ]
of WalletsCmd . list :
discard
2018-11-23 23:58:49 +00:00
2022-01-17 09:27:08 +00:00
of BNStartUpCmd . deposits :
2020-06-16 18:38:51 +00:00
case depositsCmd * {. command . } : DepositsCmd
2021-04-08 11:35:58 +00:00
of DepositsCmd . createTestnetDeposits :
2020-06-15 22:20:31 +00:00
totalDeposits * {.
2020-06-23 19:11:07 +00:00
desc : " Number of deposits to generate "
2021-05-19 06:38:13 +00:00
defaultValue : 1
2020-06-15 22:20:31 +00:00
name : " count " } : int
2020-06-23 19:11:07 +00:00
existingWalletId * {.
desc : " An existing wallet ID. If not specified, a new wallet will be created "
name : " wallet " } : Option [ WalletName ]
2020-06-15 22:20:31 +00:00
outValidatorsDir * {.
2020-08-01 18:32:41 +00:00
desc : " Output folder for validator keystores "
2021-05-19 06:38:13 +00:00
defaultValue : " validators "
2020-08-01 18:32:41 +00:00
name : " out-validators-dir " } : string
2020-06-15 22:20:31 +00:00
outSecretsDir * {.
2020-06-23 19:11:07 +00:00
desc : " Output folder for randomly generated keystore passphrases "
2021-05-19 06:38:13 +00:00
defaultValue : " secrets "
2020-06-15 22:20:31 +00:00
name : " out-secrets-dir " } : string
2020-07-17 20:59:50 +00:00
outDepositsFile * {.
desc : " The name of generated deposits file "
name : " out-deposits-file " } : Option [ OutFile ]
newWalletNameFlag * {.
desc : " An easy-to-remember name for the wallet of your choice "
2020-08-02 17:26:57 +00:00
name : " new-wallet-name " } : Option [ WalletName ]
2020-07-17 20:59:50 +00:00
newWalletFileFlag * {.
desc : " Output wallet file "
name : " new-wallet-file " } : Option [ OutFile ]
2020-06-16 18:38:51 +00:00
2021-04-06 22:12:07 +00:00
#[
2020-11-27 19:48:33 +00:00
of DepositsCmd . status :
discard
2021-04-06 22:12:07 +00:00
] #
2020-11-27 19:48:33 +00:00
2020-08-02 17:26:57 +00:00
of DepositsCmd . ` import ` :
importedDepositsDir * {.
argument
2020-11-28 18:50:09 +00:00
desc : " A directory with keystores to import " } : Option [ InputDir ]
2020-08-02 17:26:57 +00:00
2020-11-27 19:48:33 +00:00
of DepositsCmd . exit :
exitedValidator * {.
name : " validator "
desc : " Validator index or a public key of the exited validator " } : string
rpcUrlForExit * {.
2021-05-19 06:38:13 +00:00
desc : " URL of the beacon node JSON-RPC service "
2021-01-15 17:39:45 +00:00
defaultValue : parseUri ( " http://localhost: " & $ defaultEth2RpcPort )
2021-05-19 06:38:13 +00:00
defaultValueDesc : " http://localhost:9190 "
name : " rpc-url " } : Uri
2020-11-27 19:48:33 +00:00
exitAtEpoch * {.
name : " epoch "
desc : " The desired exit epoch " } : Option [ uint64 ]
2020-06-23 19:11:07 +00:00
2022-01-17 09:27:08 +00:00
of BNStartUpCmd . record :
2020-11-24 23:23:28 +00:00
case recordCmd * {. command . } : RecordCmd
of RecordCmd . create :
ipExt * {.
desc : " External IP address "
name : " ip " . } : ValidIpAddress
tcpPortExt * {.
desc : " External TCP port "
name : " tcp-port " . } : Port
udpPortExt * {.
desc : " External UDP port "
name : " udp-port " . } : Port
seqNumber * {.
desc : " Record sequence number "
2021-05-19 06:38:13 +00:00
defaultValue : 1 ,
2020-11-24 23:23:28 +00:00
name : " seq-number " . } : uint
fields * {.
desc : " Additional record key pairs, provide as <string>:<bytes in hex> "
name : " field " . } : seq [ ( string ) ]
of RecordCmd . print :
recordPrint * {.
argument
desc : " ENR URI of the record to print "
name : " enr " . } : Record
2022-01-17 09:27:08 +00:00
of BNStartUpCmd . web3 :
2020-12-04 16:28:42 +00:00
case web3Cmd * {. command . } : Web3Cmd
of Web3Cmd . test :
web3TestUrl * {.
argument
desc : " The web3 provider URL to test "
name : " url " } : Uri
2022-01-17 09:27:08 +00:00
of BNStartUpCmd . slashingdb :
2021-05-19 06:38:13 +00:00
case slashingdbCmd * {. command . } : SlashProtCmd
of SlashProtCmd . ` import ` :
importedInterchangeFile * {.
desc : " EIP-3076 slashing protection interchange file to import "
argument . } : InputFile
of SlashProtCmd . ` export ` :
exportedValidators * {.
desc : " Limit the export to specific validators " &
" (specified as numeric indices or public keys) "
abbr : " v "
name : " validator " } : seq [ PubKey0x ]
exportedInterchangeFile * {.
desc : " EIP-3076 slashing protection interchange file to export "
argument } : OutFile
2022-01-17 09:27:08 +00:00
of BNStartUpCmd . trustedNodeSync :
trustedNodeUrl * {.
desc : " URL of the REST API to sync from "
defaultValue : " http://localhost:5052 "
name : " trusted-node-url "
. } : string
blockId * {.
desc : " Block id to sync to - this can be a block root, slot number, \" finalized \" or \" head \" "
defaultValue : " finalized "
. } : string
backfillBlocks * {.
desc : " Backfill blocks directly from REST server instead of fetching via API "
defaultValue : true
name : " backfill " } : bool
2020-05-22 17:04:52 +00:00
ValidatorClientConf * = object
logLevel * {.
2021-05-19 06:38:13 +00:00
desc : " Sets the log level "
2020-11-09 08:12:48 +00:00
defaultValue : " INFO "
2020-05-22 17:04:52 +00:00
name : " log-level " } : string
2021-11-02 17:06:36 +00:00
logStdout * {.
2021-11-10 09:02:18 +00:00
hidden
2021-11-02 17:06:36 +00:00
desc : " Specifies what kind of logs should be written to stdout (auto, colors, nocolors, json) "
defaultValueDesc : " auto "
defaultValue : StdoutLogKind . Auto
2021-11-10 09:02:18 +00:00
name : " log-format " } : StdoutLogKind
2021-11-02 17:06:36 +00:00
2020-07-15 13:15:55 +00:00
logFile * {.
2021-11-10 09:02:18 +00:00
desc : " Specifies a path for the written Json log file (deprecated) "
2020-07-15 13:15:55 +00:00
name : " log-file " } : Option [ OutFile ]
2020-05-22 17:04:52 +00:00
dataDir * {.
2020-06-23 19:11:07 +00:00
desc : " The directory where nimbus will store all blockchain data "
2021-05-19 06:38:13 +00:00
defaultValue : config . defaultDataDir ( )
defaultValueDesc : " "
2020-05-22 17:04:52 +00:00
abbr : " d "
name : " data-dir " } : OutDir
2020-06-01 19:48:20 +00:00
nonInteractive * {.
2020-06-23 19:11:07 +00:00
desc : " Do not display interative prompts. Quit on missing configuration "
2020-06-01 19:48:20 +00:00
name : " non-interactive " } : bool
2020-09-01 13:44:40 +00:00
validatorsDirFlag * {.
desc : " A directory containing validator keystores "
name : " validators-dir " } : Option [ InputDir ]
secretsDirFlag * {.
desc : " A directory containing validator keystore passwords "
name : " secrets-dir " } : Option [ InputDir ]
2021-12-22 12:37:31 +00:00
keymanagerEnabled * {.
desc : " Enable the REST keymanager API (BETA version) "
defaultValue : false
name : " keymanager " } : bool
keymanagerPort * {.
desc : " Listening port for the REST keymanager API "
defaultValue : DefaultEth2RestPort
defaultValueDesc : " 5052 "
name : " keymanager-port " } : Port
keymanagerAddress * {.
desc : " Listening port for the REST keymanager API "
defaultValue : defaultAdminListenAddress
defaultValueDesc : " 127.0.0.1 "
name : " keymanager-address " } : ValidIpAddress
keymanagerTokenFile * {.
desc : " A file specifying the authorizition token required for accessing the keymanager API "
name : " keymanager-token-file " } : Option [ InputFile ]
2021-10-04 19:08:31 +00:00
2020-05-22 17:04:52 +00:00
case cmd * {.
command
defaultValue : VCNoCommand } : VCStartUpCmd
2020-10-27 11:04:17 +00:00
2020-05-22 17:04:52 +00:00
of VCNoCommand :
2020-06-29 17:30:19 +00:00
graffiti * {.
desc : " The graffiti value that will appear in proposed blocks. " &
2021-07-13 11:15:07 +00:00
" You can use a 0x-prefixed hex encoded string to specify " &
" raw bytes "
2020-06-29 17:30:19 +00:00
name : " graffiti " } : Option [ GraffitiBytes ]
2020-09-01 13:38:34 +00:00
stopAtEpoch * {.
desc : " A positive epoch selects the epoch at which to stop "
2021-05-19 06:38:13 +00:00
defaultValue : 0
2020-09-01 13:38:34 +00:00
name : " stop-at-epoch " } : uint64
2021-07-13 11:15:07 +00:00
beaconNodes * {.
desc : " URL addresses to one or more beacon node HTTP REST APIs " ,
name : " beacon-node " } : seq [ string ]
2020-06-01 19:48:20 +00:00
2021-11-30 01:20:21 +00:00
SigningNodeConf * = object
logLevel * {.
desc : " Sets the log level "
defaultValue : " INFO "
name : " log-level " } : string
logStdout * {.
desc : " Specifies what kind of logs should be written to stdout (auto, colors, nocolors, json) "
defaultValueDesc : " auto "
defaultValue : StdoutLogKind . Auto
name : " log-stdout " } : StdoutLogKind
logFile * {.
desc : " Specifies a path for the written Json log file "
name : " log-file " } : Option [ OutFile ]
nonInteractive * {.
desc : " Do not display interative prompts. Quit on missing configuration "
name : " non-interactive " } : bool
dataDir * {.
desc : " The directory where nimbus will store validator ' s keys "
defaultValue : config . defaultDataDir ( )
defaultValueDesc : " "
abbr : " d "
name : " data-dir " } : OutDir
validatorsDirFlag * {.
desc : " A directory containing validator keystores "
name : " validators-dir " } : Option [ InputDir ]
secretsDirFlag * {.
desc : " A directory containing validator keystore passwords "
name : " secrets-dir " } : Option [ InputDir ]
serverIdent * {.
desc : " Server identifier which will be used in HTTP Host header "
name : " server-ident " } : Option [ string ]
requestTimeout * {.
desc : " Request timeout, maximum time that node will wait for remote " &
" client request (in seconds) "
defaultValue : defaultSigningNodeRequestTimeout
name : " request-timeout " } : int
case cmd * {.
command
defaultValue : SNNoCommand } : SNStartUpCmd
of SNNoCommand :
bindPort * {.
desc : " Port for the REST (BETA version) HTTP server "
defaultValue : DefaultEth2RestPort
defaultValueDesc : " 5052 "
name : " bind-port " } : Port
bindAddress * {.
desc : " Listening address of the REST (BETA version) HTTP server "
defaultValue : defaultAdminListenAddress
defaultValueDesc : " 127.0.0.1 "
name : " bind-address " } : ValidIpAddress
tlsEnabled * {.
desc : " Use secure TLS communication for REST (BETA version) server "
defaultValue : false
name : " tls " } : bool
tlsCertificate * {.
desc : " Path to SSL certificate file "
name : " tls-cert " } : Option [ InputFile ]
tlsPrivateKey * {.
desc : " Path to SSL ceritificate ' s private key "
name : " tls-key " } : Option [ InputFile ]
AnyConf * = BeaconNodeConf | ValidatorClientConf | SigningNodeConf
proc defaultDataDir * ( config : AnyConf ) : string =
2019-03-19 17:22:17 +00:00
let dataDir = when defined ( windows ) :
" AppData " / " Roaming " / " Nimbus "
elif defined ( macosx ) :
" Library " / " Application Support " / " Nimbus "
else :
" .cache " / " nimbus "
2018-12-09 08:25:02 +00:00
2019-10-28 23:04:52 +00:00
getHomeDir ( ) / dataDir / " BeaconNode "
2018-11-29 01:08:34 +00:00
2021-11-30 01:20:21 +00:00
func dumpDir * ( config : AnyConf ) : string =
2021-02-22 16:17:48 +00:00
config . dataDir / " dump "
2019-12-10 14:20:40 +00:00
2021-11-30 01:20:21 +00:00
func dumpDirInvalid * ( config : AnyConf ) : string =
2021-02-22 16:17:48 +00:00
config . dumpDir / " invalid " # things that failed validation
2020-06-16 08:49:32 +00:00
2021-11-30 01:20:21 +00:00
func dumpDirIncoming * ( config : AnyConf ) : string =
2021-02-22 16:17:48 +00:00
config . dumpDir / " incoming " # things that couldn't be validated (missingparent etc)
2020-06-16 08:49:32 +00:00
2021-11-30 01:20:21 +00:00
func dumpDirOutgoing * ( config : AnyConf ) : string =
2021-02-22 16:17:48 +00:00
config . dumpDir / " outgoing " # things we produced
2020-06-16 08:49:32 +00:00
2021-02-22 16:17:48 +00:00
proc createDumpDirs * ( config : BeaconNodeConf ) =
if config . dumpEnabled :
let resInv = secureCreatePath ( config . dumpDirInvalid )
2020-08-27 18:23:41 +00:00
if resInv . isErr ( ) :
2021-02-22 16:17:48 +00:00
warn " Could not create dump directory " , path = config . dumpDirInvalid
let resInc = secureCreatePath ( config . dumpDirIncoming )
2020-08-27 18:23:41 +00:00
if resInc . isErr ( ) :
2021-02-22 16:17:48 +00:00
warn " Could not create dump directory " , path = config . dumpDirIncoming
let resOut = secureCreatePath ( config . dumpDirOutgoing )
2020-08-27 18:23:41 +00:00
if resOut . isErr ( ) :
2021-02-22 16:17:48 +00:00
warn " Could not create dump directory " , path = config . dumpDirOutgoing
2020-06-16 08:49:32 +00:00
2020-06-29 17:30:19 +00:00
func parseCmdArg * ( T : type GraffitiBytes , input : TaintedString ) : T
{. raises : [ ValueError , Defect ] . } =
GraffitiBytes . init ( string input )
func completeCmdArg * ( T : type GraffitiBytes , input : TaintedString ) : seq [ string ] =
return @ [ ]
2020-11-12 19:01:26 +00:00
func parseCmdArg * ( T : type BlockHashOrNumber , input : TaintedString ) : T
{. raises : [ ValueError , Defect ] . } =
init ( BlockHashOrNumber , string input )
func completeCmdArg * ( T : type BlockHashOrNumber , input : TaintedString ) : seq [ string ] =
return @ [ ]
2020-11-27 19:48:33 +00:00
func parseCmdArg * ( T : type Uri , input : TaintedString ) : T
{. raises : [ ValueError , Defect ] . } =
parseUri ( input . string )
func completeCmdArg * ( T : type Uri , input : TaintedString ) : seq [ string ] =
return @ [ ]
2021-05-19 06:38:13 +00:00
func parseCmdArg * ( T : type PubKey0x , input : TaintedString ) : T
{. raises : [ ValueError , Defect ] . } =
PubKey0x ( hexToPaddedByteArray [ RawPubKeySize ] ( input . string ) )
2021-12-20 19:20:31 +00:00
func parseCmdArg * ( T : type ValidatorPubKey , input : TaintedString ) : T
{. raises : [ ValueError , Defect ] . } =
let res = ValidatorPubKey . fromHex ( input . string )
if res . isErr ( ) : raise ( ref ValueError ) ( msg : $ res . error ( ) )
res . get ( )
2021-05-19 06:38:13 +00:00
func completeCmdArg * ( T : type PubKey0x , input : TaintedString ) : seq [ string ] =
return @ [ ]
2020-10-06 15:32:17 +00:00
func parseCmdArg * ( T : type Checkpoint , input : TaintedString ) : T
2020-09-22 20:42:42 +00:00
{. raises : [ ValueError , Defect ] . } =
2020-10-06 15:32:17 +00:00
let sepIdx = find ( input . string , ' : ' )
if sepIdx = = - 1 :
raise newException ( ValueError ,
" The weak subjectivity checkpoint must be provided in the `block_root:epoch_number` format " )
T ( root : Eth2Digest . fromHex ( input [ 0 .. < sepIdx ] ) ,
epoch : parseBiggestUInt ( input [ sepIdx .. ^ 1 ] ) . Epoch )
func completeCmdArg * ( T : type Checkpoint , input : TaintedString ) : seq [ string ] =
2020-09-22 20:42:42 +00:00
return @ [ ]
2020-10-02 14:48:27 +00:00
proc isPrintable ( rune : Rune ) : bool =
# This can be eventually replaced by the `unicodeplus` package, but a single
# proc does not justify the extra dependencies at the moment:
# https://github.com/nitely/nim-unicodeplus
# https://github.com/nitely/nim-segmentation
rune = = Rune ( 0x20 ) or unicodeCategory ( rune ) notin ctgC + ctgZ
2020-06-23 19:11:07 +00:00
func parseCmdArg * ( T : type WalletName , input : TaintedString ) : T
{. raises : [ ValueError , Defect ] . } =
if input . len = = 0 :
raise newException ( ValueError , " The wallet name should not be empty " )
if input [ 0 ] = = ' _ ' :
raise newException ( ValueError , " The wallet name should not start with an underscore " )
2020-10-02 14:48:27 +00:00
for rune in runes ( input . string ) :
if not rune . isPrintable :
raise newException ( ValueError , " The wallet name should consist only of printable characters " )
# From the Unicode Normalization FAQ (https://unicode.org/faq/normalization.html):
# NFKC is the preferred form for identifiers, especially where there are security concerns
# (see UTR #36 http://www.unicode.org/reports/tr36/)
return T ( toNFKC ( input ) )
2020-06-23 19:11:07 +00:00
func completeCmdArg * ( T : type WalletName , input : TaintedString ) : seq [ string ] =
return @ [ ]
2020-11-24 23:23:28 +00:00
proc parseCmdArg * ( T : type enr . Record , p : TaintedString ) : T
{. raises : [ ConfigurationError , Defect ] . } =
if not fromURI ( result , p ) :
raise newException ( ConfigurationError , " Invalid ENR " )
proc completeCmdArg * ( T : type enr . Record , val : TaintedString ) : seq [ string ] =
return @ [ ]
2020-06-23 19:11:07 +00:00
2021-11-30 01:20:21 +00:00
func validatorsDir * ( config : AnyConf ) : string =
2021-02-22 16:17:48 +00:00
string config . validatorsDirFlag . get ( InputDir ( config . dataDir / " validators " ) )
2020-06-03 11:52:36 +00:00
2021-11-30 01:20:21 +00:00
func secretsDir * ( config : AnyConf ) : string =
2021-02-22 16:17:48 +00:00
string config . secretsDirFlag . get ( InputDir ( config . dataDir / " secrets " ) )
2019-12-10 14:20:40 +00:00
2021-02-22 16:17:48 +00:00
func walletsDir * ( config : BeaconNodeConf ) : string =
if config . walletsDirFlag . isSome :
config . walletsDirFlag . get . string
2020-07-17 20:59:50 +00:00
else :
2021-02-22 16:17:48 +00:00
config . dataDir / " wallets "
2020-07-17 20:59:50 +00:00
2021-02-22 16:17:48 +00:00
func outWalletName * ( config : BeaconNodeConf ) : Option [ WalletName ] =
2020-07-17 20:59:50 +00:00
proc fail {. noReturn . } =
raiseAssert " outWalletName should be used only in the right context "
2021-02-22 16:17:48 +00:00
case config . cmd
2020-07-14 19:00:35 +00:00
of wallets :
2021-02-22 16:17:48 +00:00
case config . walletsCmd
of WalletsCmd . create : config . createdWalletNameFlag
of WalletsCmd . restore : config . restoredWalletNameFlag
2020-07-17 20:59:50 +00:00
of WalletsCmd . list : fail ( )
of deposits :
2021-04-06 22:12:07 +00:00
case config . depositsCmd
2021-04-08 11:35:58 +00:00
of DepositsCmd . createTestnetDeposits : config . newWalletNameFlag
2021-04-06 22:12:07 +00:00
else : fail ( )
2020-07-14 19:00:35 +00:00
else :
2020-07-17 20:59:50 +00:00
fail ( )
2020-07-14 19:00:35 +00:00
2021-02-22 16:17:48 +00:00
func outWalletFile * ( config : BeaconNodeConf ) : Option [ OutFile ] =
2020-07-17 20:59:50 +00:00
proc fail {. noReturn . } =
raiseAssert " outWalletName should be used only in the right context "
2021-02-22 16:17:48 +00:00
case config . cmd
2020-07-17 20:59:50 +00:00
of wallets :
2021-02-22 16:17:48 +00:00
case config . walletsCmd
of WalletsCmd . create : config . createdWalletFileFlag
of WalletsCmd . restore : config . restoredWalletFileFlag
2020-07-17 20:59:50 +00:00
of WalletsCmd . list : fail ( )
of deposits :
2021-04-06 22:12:07 +00:00
case config . depositsCmd
2021-04-08 11:35:58 +00:00
of DepositsCmd . createTestnetDeposits : config . newWalletFileFlag
2021-04-06 22:12:07 +00:00
else : fail ( )
2020-07-17 20:59:50 +00:00
else :
fail ( )
2020-06-23 19:11:07 +00:00
2021-11-30 01:20:21 +00:00
func databaseDir * ( config : AnyConf ) : string =
2021-02-22 16:17:48 +00:00
config . dataDir / " db "
2019-12-10 14:20:40 +00:00
2020-02-11 17:35:42 +00:00
template writeValue * ( writer : var JsonWriter ,
value : TypedInputFile | InputFile | InputDir | OutPath | OutDir | OutFile ) =
writer . writeValue ( string value )