@@ -105,7 +105,8 @@ proc getValidator*(validators: auto,
105
105
Opt .some ValidatorAndIndex (index: ValidatorIndex (idx),
106
106
validator: validators[idx])
107
107
108
- proc addValidatorsFromWeb3Signer (node: BeaconNode , web3signerUrl: Web3SignerUrl , epoch: Epoch ) {.async .} =
108
+ proc addValidatorsFromWeb3Signer (node: BeaconNode , web3signerUrl: Web3SignerUrl ,
109
+ epoch: Epoch ) {.async .} =
109
110
let dynamicStores =
110
111
try :
111
112
let res = await queryValidatorsSource (web3signerUrl)
@@ -119,22 +120,22 @@ proc addValidatorsFromWeb3Signer(node: BeaconNode, web3signerUrl: Web3SignerUrl,
119
120
error = $ exc.name, reason = $ exc.msg
120
121
default (seq [KeystoreData ])
121
122
122
- for keystore in dynamicStores:
123
+ proc addValidatorProc ( keystore: KeystoreData ) =
123
124
let
124
- data =
125
- withState (node.dag.headState):
126
- getValidator (forkyState.data.validators.asSeq (), keystore.pubkey)
127
- index =
128
- if data.isSome ():
129
- Opt .some (data.get ().index)
130
- else :
131
- Opt .none (ValidatorIndex )
125
+ epoch = node.currentSlot ().epoch
126
+ index = Opt .none (ValidatorIndex )
132
127
feeRecipient =
133
128
node.consensusManager[].getFeeRecipient (keystore.pubkey, index, epoch)
134
- gasLimit = node.consensusManager[].getGasLimit (keystore.pubkey)
135
- v = node.attachedValidators[].addValidator (keystore, feeRecipient,
136
- gasLimit)
137
- v.updateValidator (data)
129
+ gasLimit =
130
+ node.consensusManager[].getGasLimit (keystore.pubkey)
131
+ discard node.attachedValidators[].addValidator (keystore, feeRecipient,
132
+ gasLimit)
133
+
134
+ debug " Validators source has been polled for validators" ,
135
+ keystores_found = len (dynamicStores),
136
+ web3signer_url = web3signerUrl.url
137
+ node.attachedValidators.updateDynamicValidators (
138
+ web3signerUrl, dynamicStores, node.keysFilter, addValidatorProc)
138
139
139
140
proc addValidators * (node: BeaconNode ) {.async .} =
140
141
info " Loading validators" , validatorsDir = node.config.validatorsDir (),
@@ -198,9 +199,8 @@ proc pollForDynamicValidators*(node: BeaconNode,
198
199
debug " Validators source has been polled for validators" ,
199
200
keystores_found = len (keystores),
200
201
web3signer_url = web3signerUrl.url
201
- node.attachedValidators.updateDynamicValidators (web3signerUrl,
202
- keystores,
203
- addValidatorProc)
202
+ node.attachedValidators.updateDynamicValidators (
203
+ web3signerUrl, keystores, node.keysFilter, addValidatorProc)
204
204
seconds (intervalInSeconds)
205
205
else :
206
206
# In case of error we going to repeat our call with much smaller
0 commit comments