Remove validator_duties dependency from validator_client. (#4244)
This commit is contained in:
parent
a47cf5aa2c
commit
9fd4e7405e
|
@ -10,7 +10,7 @@ import chronos, chronicles, confutils,
|
|||
import ".."/spec/[keystore, crypto]
|
||||
import ".."/spec/eth2_apis/rest_keymanager_types
|
||||
import ".."/validators/[slashing_protection, keystore_management,
|
||||
validator_pool, validator_duties]
|
||||
validator_pool]
|
||||
import ".."/rpc/rest_utils
|
||||
|
||||
export rest_utils, results
|
||||
|
|
|
@ -101,29 +101,6 @@ proc findValidator*(validators: auto, pubkey: ValidatorPubKey): Opt[ValidatorInd
|
|||
else:
|
||||
Opt.some idx.ValidatorIndex
|
||||
|
||||
# TODO: This should probably be moved to the validator_pool module
|
||||
proc addRemoteValidator*(pool: var ValidatorPool,
|
||||
keystore: KeystoreData,
|
||||
index: Opt[ValidatorIndex],
|
||||
feeRecipient: Eth1Address,
|
||||
slot: Slot) =
|
||||
var clients: seq[(RestClientRef, RemoteSignerInfo)]
|
||||
let httpFlags =
|
||||
block:
|
||||
var res: set[HttpClientFlag]
|
||||
if RemoteKeystoreFlag.IgnoreSSLVerification in keystore.flags:
|
||||
res.incl({HttpClientFlag.NoVerifyHost,
|
||||
HttpClientFlag.NoVerifyServerName})
|
||||
res
|
||||
let prestoFlags = {RestClientFlag.CommaSeparatedArray}
|
||||
for remote in keystore.remotes:
|
||||
let client = RestClientRef.new($remote.url, prestoFlags, httpFlags)
|
||||
if client.isErr():
|
||||
warn "Unable to resolve distributed signer address",
|
||||
remote_url = $remote.url, validator = $remote.pubkey
|
||||
clients.add((client.get(), remote))
|
||||
pool.addRemoteValidator(keystore, clients, index, feeRecipient, slot)
|
||||
|
||||
proc addValidators*(node: BeaconNode) =
|
||||
debug "Loading validators", validatorsDir = node.config.validatorsDir()
|
||||
let slot = node.currentSlot()
|
||||
|
|
|
@ -177,6 +177,28 @@ proc close*(pool: var ValidatorPool) =
|
|||
notice "Could not unlock validator's keystore file",
|
||||
pubkey = validator.pubkey, validator = shortLog(validator)
|
||||
|
||||
proc addRemoteValidator*(pool: var ValidatorPool,
|
||||
keystore: KeystoreData,
|
||||
index: Opt[ValidatorIndex],
|
||||
feeRecipient: Eth1Address,
|
||||
slot: Slot) =
|
||||
var clients: seq[(RestClientRef, RemoteSignerInfo)]
|
||||
let httpFlags =
|
||||
block:
|
||||
var res: set[HttpClientFlag]
|
||||
if RemoteKeystoreFlag.IgnoreSSLVerification in keystore.flags:
|
||||
res.incl({HttpClientFlag.NoVerifyHost,
|
||||
HttpClientFlag.NoVerifyServerName})
|
||||
res
|
||||
let prestoFlags = {RestClientFlag.CommaSeparatedArray}
|
||||
for remote in keystore.remotes:
|
||||
let client = RestClientRef.new($remote.url, prestoFlags, httpFlags)
|
||||
if client.isErr():
|
||||
warn "Unable to resolve distributed signer address",
|
||||
remote_url = $remote.url, validator = $remote.pubkey
|
||||
clients.add((client.get(), remote))
|
||||
pool.addRemoteValidator(keystore, clients, index, feeRecipient, slot)
|
||||
|
||||
iterator publicKeys*(pool: ValidatorPool): ValidatorPubKey =
|
||||
for item in pool.validators.keys():
|
||||
yield item
|
||||
|
@ -438,3 +460,4 @@ proc getBuilderSignature*(v: AttachedValidator, fork: Fork,
|
|||
let request = Web3SignerRequest.init(
|
||||
fork, ZERO_HASH, validatorRegistration)
|
||||
await v.signData(request)
|
||||
|
||||
|
|
Loading…
Reference in New Issue