diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index 27cec20d1..50afde191 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -163,7 +163,7 @@ type validatorsSource* {. desc: "Remote Web3Signer URL that will be used as a source of validators" - name: "validators-source"}: string + name: "validators-source"}: Option[string] secretsDirFlag* {. desc: "A directory containing validator keystore passwords" @@ -881,7 +881,7 @@ type validatorsSource* {. desc: "Remote Web3Signer URL that will be used as a source of validators" - name: "validators-source"}: string + name: "validators-source"}: Option[string] secretsDirFlag* {. desc: "A directory containing validator keystore passwords" diff --git a/beacon_chain/validators/keystore_management.nim b/beacon_chain/validators/keystore_management.nim index 2ecb41242..b91b650e4 100644 --- a/beacon_chain/validators/keystore_management.nim +++ b/beacon_chain/validators/keystore_management.nim @@ -630,24 +630,27 @@ proc existsKeystore(keystoreDir: string, proc queryValidatorsSource*(config: AnyConf): Future[seq[KeystoreData]] {. async.} = var keystores: seq[KeystoreData] - if len(config.validatorsSource) == 0: + if config.validatorsSource.isNone() or + len(config.validatorsSource.get()) == 0: return keystores + let vsource = config.validatorsSource.get() + logScope: + validators_source = vsource + let httpFlags: HttpClientFlags = {} prestoFlags = {RestClientFlag.CommaSeparatedArray} socketFlags = {SocketFlags.TcpNoDelay} client = block: - let res = RestClientRef.new(config.validatorsSource, prestoFlags, + let res = RestClientRef.new(vsource, prestoFlags, httpFlags, socketFlags = socketFlags) if res.isErr(): # TODO keep trying in case of temporary network failure - warn "Unable to resolve validator's source distributed signer " & - "address", remote_url = config.validatorsSource + warn "Unable to resolve validator's source distributed signer address" return keystores - else: - res.get() + res.get() keys = try: let response = await getKeysPlain(client) @@ -681,7 +684,7 @@ proc queryValidatorsSource*(config: AnyConf): Future[seq[KeystoreData]] {. handle: FileLockHandle(opened: false), pubkey: pubkey, remotes: @[RemoteSignerInfo( - url: HttpHostUri(parseUri(config.validatorsSource)), + url: HttpHostUri(parseUri(vsource)), pubkey: pubkey)], flags: {RemoteKeystoreFlag.DynamicKeystore}, remoteType: RemoteSignerType.Web3Signer))