REST parameter defaults (#3689)

* add default BN for VC
* unify "default" beacon node across commands
* clean up validator exit docs
This commit is contained in:
Jacek Sieka 2022-06-01 12:47:52 +02:00 committed by GitHub
parent 09663e00d8
commit 6a0433cb08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 25 deletions

View File

@ -46,6 +46,7 @@ const
defaultListenAddress* = (static ValidIpAddress.init("0.0.0.0")) defaultListenAddress* = (static ValidIpAddress.init("0.0.0.0"))
defaultAdminListenAddress* = (static ValidIpAddress.init("127.0.0.1")) defaultAdminListenAddress* = (static ValidIpAddress.init("127.0.0.1"))
defaultSigningNodeRequestTimeout* = 60 defaultSigningNodeRequestTimeout* = 60
defaultBeaconNode* = "http://127.0.0.1:" & $DefaultEth2RestPort
when defined(windows): when defined(windows):
{.pragma: windowsOnly.} {.pragma: windowsOnly.}
@ -637,7 +638,9 @@ type
restUrlForExit* {. restUrlForExit* {.
desc: "URL of the beacon node REST service" desc: "URL of the beacon node REST service"
name: "rest-url" }: Option[Uri] defaultValue: defaultBeaconNode
defaultValueDesc: "http://127.0.0.1:5052"
name: "rest-url" }: string
of BNStartUpCmd.record: of BNStartUpCmd.record:
case recordCmd* {.command.}: RecordCmd case recordCmd* {.command.}: RecordCmd
@ -696,7 +699,8 @@ type
of BNStartUpCmd.trustedNodeSync: of BNStartUpCmd.trustedNodeSync:
trustedNodeUrl* {. trustedNodeUrl* {.
desc: "URL of the REST API to sync from" desc: "URL of the REST API to sync from"
defaultValue: "http://localhost:5052" defaultValue: defaultBeaconNode
defaultValueDesc: "http://127.0.0.1:5052"
name: "trusted-node-url" name: "trusted-node-url"
.}: string .}: string
@ -788,6 +792,8 @@ type
beaconNodes* {. beaconNodes* {.
desc: "URL addresses to one or more beacon node HTTP REST APIs", desc: "URL addresses to one or more beacon node HTTP REST APIs",
defaultValue: @[defaultBeaconNode]
defaultValueDesc: "http://127.0.0.1:5052"
name: "beacon-node" }: seq[string] name: "beacon-node" }: seq[string]
SigningNodeConf* = object SigningNodeConf* = object

View File

@ -110,22 +110,8 @@ proc askForExitConfirmation(): ClientExitAction =
proc restValidatorExit(config: BeaconNodeConf) {.async.} = proc restValidatorExit(config: BeaconNodeConf) {.async.} =
let let
address = if isNone(config.restUrlForExit): client = RestClientRef.new(config.restUrlForExit).valueOr:
resolveTAddress("127.0.0.1", Port(DefaultEth2RestPort))[0] raise (ref RestError)(msg: $error)
else:
let taseq = try:
resolveTAddress($config.restUrlForExit.get().hostname &
":" &
$config.restUrlForExit.get().port)
except CatchableError as err:
fatal "Failed to resolve address", err = err.msg
quit 1
if len(taseq) == 1:
taseq[0]
else:
taseq[1]
client = RestClientRef.new(address)
stateIdHead = StateIdent(kind: StateQueryKind.Named, stateIdHead = StateIdent(kind: StateQueryKind.Named,
value: StateIdentType.Head) value: StateIdentType.Head)

View File

@ -184,6 +184,7 @@ programMain:
servers servers
if len(beaconNodes) == 0: if len(beaconNodes) == 0:
# This should not happen, thanks to defaults in `conf.nim`
fatal "Not enough beacon nodes in command line" fatal "Not enough beacon nodes in command line"
quit 1 quit 1

View File

@ -1,9 +1,12 @@
# Perform a voluntary exit # Perform a voluntary exit
Voluntary exits allow validators to permanently stop performing their duties, and eventually recover the deposit.
Exits are subject to a wait period that depends on the length of the exit queue. While a validator is exiting, it still must perform its duties in order not to lose funds to inactivity penalities.
> ⚠️ Voluntary exits are **irreversible**. You won't be able to validate again with the same key. And you won't be able to withdraw your stake until the Eth1 and Eth2 merge. *Note that voluntary exits won't be processed if the chain isn't finalising.* > ⚠️ Voluntary exits are **irreversible**. You won't be able to validate again with the same key. And you won't be able to withdraw your stake until the Eth1 and Eth2 merge. *Note that voluntary exits won't be processed if the chain isn't finalising.*
To perform a voluntary exit, make sure your beacon node is running with the `--rpc`option enabled (e.g. `./run-mainnet-beacon-node.sh --rpc`), then run: To perform a voluntary exit, make sure your beacon node is running with the `--rest`option enabled (e.g. `./run-mainnet-beacon-node.sh --rest`), then run:
**Prater** **Prater**
@ -26,6 +29,6 @@ build/nimbus_beacon_node deposits exit \
## `rest-url` parameter ## `rest-url` parameter
As of `v1.7.0` the `deposits exit` command can accept a `--rest-url` parameter. This means you can issue exits with any [REST API](./rest-api.md) compatible beacon node > **Note:** This feature is available from `v1.7.0` onwards - earlier versions relied on the now removed [JSON-RPC API](./api.md).
The `--rest-url` parameter can be used to point the exit command to a specific node for publishing the request, as long as it's compatible with the [REST API](./rest-api.md).