@@ -52,11 +52,11 @@ export const checkValidateIntention = async (
5252 ! validators ?. length ||
5353 validators . includes ( Util . formatAddress ( candidate ?. stash , config ) )
5454 ) {
55- await setValidateIntentionValidity ( candidate . stash , true ) ;
55+ await setValidateIntentionValidity ( candidate , true ) ;
5656 return true ;
5757 }
5858
59- await setValidateIntentionValidity ( candidate . stash , false ) ;
59+ await setValidateIntentionValidity ( candidate , false ) ;
6060 return false ;
6161 } catch ( e ) {
6262 logger . error ( `Error checking validate intention: ${ e } ` , constraintsLabel ) ;
@@ -74,9 +74,9 @@ export const checkAllValidateIntentions = async (
7474 const validators = await chaindata . getValidators ( ) ;
7575 for ( const candidate of candidates ) {
7676 if ( ! validators . includes ( Util . formatAddress ( candidate . stash , config ) ) ) {
77- await setValidateIntentionValidity ( candidate . stash , false ) ;
77+ await setValidateIntentionValidity ( candidate , false ) ;
7878 } else {
79- await setValidateIntentionValidity ( candidate . stash , true ) ;
79+ await setValidateIntentionValidity ( candidate , true ) ;
8080 }
8181 }
8282 return true ;
@@ -95,7 +95,7 @@ export const checkLatestClientVersion = async (
9595 const skipClientUpgrade = config . constraints ?. skipClientUpgrade || false ;
9696 if ( skipClientUpgrade || candidate ?. implementation === "Kagome Node" ) {
9797 // Skip the check if the node is a Kagome Client or if skipping client upgrade is enabled
98- await setLatestClientReleaseValidity ( candidate . stash , true ) ;
98+ await setLatestClientReleaseValidity ( candidate , true ) ;
9999 return true ;
100100 }
101101
@@ -145,34 +145,34 @@ export const checkLatestClientVersion = async (
145145
146146 // If cannot parse the version, set the release as invalid
147147 if ( ! nodeVersion || ! latestVersion ) {
148- await setLatestClientReleaseValidity ( candidate . stash , false ) ;
148+ await setLatestClientReleaseValidity ( candidate , false ) ;
149149 return false ;
150150 }
151151
152152 const isUpgraded = semver . gte ( nodeVersion , latestVersion ) ;
153153
154154 // If they are not upgraded, set the validity as invalid
155155 if ( ! isUpgraded ) {
156- await setLatestClientReleaseValidity ( candidate . stash , false ) ;
156+ await setLatestClientReleaseValidity ( candidate , false ) ;
157157 return false ;
158158 }
159159
160160 // If the current version is the latest release, set the release as valid
161- await setLatestClientReleaseValidity ( candidate . stash , true ) ;
161+ await setLatestClientReleaseValidity ( candidate , true ) ;
162162 return true ;
163163 } else {
164164 logger . info ( `Still in grace window of latest release` , constraintsLabel ) ;
165165
166166 // If not past the grace window, set the release as invalid
167- await setLatestClientReleaseValidity ( candidate . stash , true ) ;
167+ await setLatestClientReleaseValidity ( candidate , true ) ;
168168 return true ;
169169 }
170170 } catch ( e ) {
171171 logger . error (
172172 `Error checking latest client version: ${ e } ` ,
173173 constraintsLabel ,
174174 ) ;
175- await setLatestClientReleaseValidity ( candidate . stash , false ) ;
175+ await setLatestClientReleaseValidity ( candidate , false ) ;
176176 throw new Error ( "could not make validity check" ) ;
177177 }
178178} ;
@@ -185,14 +185,14 @@ export const checkConnectionTime = async (
185185 if ( ! config ?. constraints ?. skipConnectionTime ) {
186186 const now = new Date ( ) . getTime ( ) ;
187187 if ( now - candidate . discoveredAt < Constants . WEEK ) {
188- await setConnectionTimeInvalidity ( candidate . stash , false ) ;
188+ await setConnectionTimeInvalidity ( candidate , false ) ;
189189 return false ;
190190 } else {
191- await setConnectionTimeInvalidity ( candidate . stash , true ) ;
191+ await setConnectionTimeInvalidity ( candidate , true ) ;
192192 return true ;
193193 }
194194 } else {
195- await setConnectionTimeInvalidity ( candidate . stash , true ) ;
195+ await setConnectionTimeInvalidity ( candidate , true ) ;
196196 return true ;
197197 }
198198 } catch ( e ) {
@@ -211,15 +211,15 @@ export const checkIdentity = async (
211211 ) ;
212212 if ( ! hasIdentity ) {
213213 const invalidityString = `${ candidate . name } does not have an identity set.` ;
214- await setIdentityInvalidity ( candidate . stash , false , invalidityString ) ;
214+ await setIdentityInvalidity ( candidate , false , invalidityString ) ;
215215 return false ;
216216 }
217217 if ( ! verified ) {
218218 const invalidityString = `${ candidate . name } has an identity but is not verified by the registrar.` ;
219- await setIdentityInvalidity ( candidate . stash , false , invalidityString ) ;
219+ await setIdentityInvalidity ( candidate , false , invalidityString ) ;
220220 return false ;
221221 }
222- await setIdentityInvalidity ( candidate . stash , true ) ;
222+ await setIdentityInvalidity ( candidate , true ) ;
223223 return true ;
224224 } catch ( e ) {
225225 logger . error ( `Error checking identity: ${ e } ` , constraintsLabel ) ;
@@ -231,10 +231,10 @@ export const checkOffline = async (candidate: Candidate): Promise<boolean> => {
231231 try {
232232 const totalOffline = candidate . offlineAccumulated / Constants . WEEK ;
233233 if ( totalOffline > 0.02 ) {
234- await setOfflineAccumulatedInvalidity ( candidate . stash , false ) ;
234+ await setOfflineAccumulatedInvalidity ( candidate , false ) ;
235235 return false ;
236236 } else {
237- await setOfflineAccumulatedInvalidity ( candidate . stash , true ) ;
237+ await setOfflineAccumulatedInvalidity ( candidate , true ) ;
238238 return true ;
239239 }
240240 return true ;
@@ -260,10 +260,10 @@ export const checkCommission = async (
260260 } commission is set higher than the maximum allowed. Set: ${
261261 commission / Math . pow ( 10 , 7 )
262262 } % Allowed: ${ targetCommission / Math . pow ( 10 , 7 ) } %`;
263- await setCommissionInvalidity ( candidate . stash , false , invalidityString ) ;
263+ await setCommissionInvalidity ( candidate , false , invalidityString ) ;
264264 return false ;
265265 } else {
266- await setCommissionInvalidity ( candidate . stash , true ) ;
266+ await setCommissionInvalidity ( candidate , true ) ;
267267 return true ;
268268 }
269269 } catch ( e ) {
@@ -285,7 +285,7 @@ export const checkSelfStake = async (
285285 let invalidityString ;
286286 if ( err2 ) {
287287 invalidityString = `${ candidate . name } ${ err2 } ` ;
288- await setSelfStakeInvalidity ( candidate . stash , false , invalidityString ) ;
288+ await setSelfStakeInvalidity ( candidate , false , invalidityString ) ;
289289 return false ;
290290 }
291291 if ( parseInt ( bondedAmt . toString ( ) ) < targetSelfStake ) {
@@ -294,11 +294,11 @@ export const checkSelfStake = async (
294294 } has less than the minimum amount bonded: ${ parseInt (
295295 bondedAmt . toString ( ) ,
296296 ) } is bonded.`;
297- await setSelfStakeInvalidity ( candidate . stash , false , invalidityString ) ;
297+ await setSelfStakeInvalidity ( candidate , false , invalidityString ) ;
298298 return false ;
299299 }
300300 }
301- await setSelfStakeInvalidity ( candidate . stash , true ) ;
301+ await setSelfStakeInvalidity ( candidate , true ) ;
302302 return true ;
303303 } catch ( e ) {
304304 logger . error ( `Error checking self stake: ${ e } ` , constraintsLabel ) ;
@@ -322,10 +322,10 @@ export const checkUnclaimed = async (
322322 const invalidityString = `${ candidate . name } has unclaimed eras: ${
323323 candidate . unclaimedEras
324324 } prior to era: ${ threshold + 1 } `;
325- await setUnclaimedInvalidity ( candidate . stash , false , invalidityString ) ;
325+ await setUnclaimedInvalidity ( candidate , false , invalidityString ) ;
326326 return false ;
327327 } else {
328- await setUnclaimedInvalidity ( candidate . stash , true ) ;
328+ await setUnclaimedInvalidity ( candidate , true ) ;
329329 return true ;
330330 }
331331 } catch ( e ) {
@@ -343,10 +343,10 @@ export const checkBlocked = async (
343343 const isBlocked = await chaindata . getBlocked ( candidate . stash ) ;
344344 if ( isBlocked ) {
345345 const invalidityString = `${ candidate . name } blocks external nominations` ;
346- await setBlockedInvalidity ( candidate . stash , false , invalidityString ) ;
346+ await setBlockedInvalidity ( candidate , false , invalidityString ) ;
347347 return false ;
348348 } else {
349- await setBlockedInvalidity ( candidate . stash , true ) ;
349+ await setBlockedInvalidity ( candidate , true ) ;
350350 return true ;
351351 }
352352 } catch ( e ) {
@@ -371,14 +371,14 @@ export const checkProvider = async (
371371 label : "Constraints" ,
372372 } ,
373373 ) ;
374- await setProviderInvalidity ( candidate . stash , false ) ;
374+ await setProviderInvalidity ( candidate , false ) ;
375375 return false ;
376376 } else {
377- await setProviderInvalidity ( candidate . stash , true ) ;
377+ await setProviderInvalidity ( candidate , true ) ;
378378 return true ;
379379 }
380380 } else {
381- await setProviderInvalidity ( candidate . stash , true ) ;
381+ await setProviderInvalidity ( candidate , true ) ;
382382 return true ;
383383 }
384384 } catch ( e ) {
@@ -398,17 +398,17 @@ export const checkKusamaRank = async (
398398
399399 if ( ! ! res . data . invalidityReasons ) {
400400 const invalidityReason = `${ candidate . name } has a kusama node that is invalid: ${ res . data . invalidityReasons } ` ;
401- await setKusamaRankInvalidity ( candidate . stash , false , invalidityReason ) ;
401+ await setKusamaRankInvalidity ( candidate , false , invalidityReason ) ;
402402 return false ;
403403 }
404404
405405 if ( Number ( res . data . rank ) < Constants . KUSAMA_RANK_VALID_THRESHOLD ) {
406406 const invalidityReason = `${ candidate . name } has a Kusama stash with lower than 25 rank in the Kusama OTV programme: ${ res . data . rank } .` ;
407- await setKusamaRankInvalidity ( candidate . stash , false , invalidityReason ) ;
407+ await setKusamaRankInvalidity ( candidate , false , invalidityReason ) ;
408408 return false ;
409409 }
410410 }
411- await setKusamaRankInvalidity ( candidate . stash , true ) ;
411+ await setKusamaRankInvalidity ( candidate , true ) ;
412412 return true ;
413413 } catch ( e ) {
414414 logger . warn ( `Error trying to get kusama data...` ) ;
@@ -423,10 +423,10 @@ export const checkBeefyKeys = async (
423423 const isDummy = await queries . hasBeefyDummy ( candidate . stash ) ;
424424 if ( isDummy ) {
425425 const invalidityString = `${ candidate . name } has not set beefy keys` ;
426- await setBeefyKeysInvalidity ( candidate . stash , false , invalidityString ) ;
426+ await setBeefyKeysInvalidity ( candidate , false , invalidityString ) ;
427427 return false ;
428428 } else {
429- await setBeefyKeysInvalidity ( candidate . stash , true ) ;
429+ await setBeefyKeysInvalidity ( candidate , true ) ;
430430 return true ;
431431 }
432432 } catch ( e ) {
0 commit comments