From aa7a7b30b37cf18d14d06027f33fb154b163088e Mon Sep 17 00:00:00 2001 From: will pankiewicz Date: Tue, 5 Mar 2024 13:58:43 +0100 Subject: [PATCH] update client check --- packages/common/src/constants.ts | 4 ++-- packages/common/src/constraints/ScoreCandidates.ts | 4 +++- packages/common/src/constraints/ValidityChecks.ts | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/common/src/constants.ts b/packages/common/src/constants.ts index 361da31fe..f23d496d5 100644 --- a/packages/common/src/constants.ts +++ b/packages/common/src/constants.ts @@ -103,8 +103,8 @@ export const TIME_DELAY_BLOCKS = 10850; // The number of blocks after a time delay proxy call was announced that we want to cancel the tx. Should be 36 hours export const CANCEL_THRESHOLD = 21700; -// Monitor Cron job for checking if clients have upgraded. This runs ever 15 minutes by default -export const MONITOR_CRON = "0 */15 * * * *"; +// Monitor Cron job for checking if clients have upgraded. This runs ever 3 minutes by default +export const MONITOR_CRON = "0 */3 * * * *"; // Clear Offline Time Cron Job. This runs once every sunday by default // export const CLEAR_OFFLINE_CRON = "0 0 0 * * 0"; diff --git a/packages/common/src/constraints/ScoreCandidates.ts b/packages/common/src/constraints/ScoreCandidates.ts index 7cf9a2f69..e9216f1d0 100644 --- a/packages/common/src/constraints/ScoreCandidates.ts +++ b/packages/common/src/constraints/ScoreCandidates.ts @@ -210,7 +210,9 @@ export const scoreCandidate = async ( const nominatorStakeScore = scaledNominatorStake * constraints.WEIGHT_CONFIG.NOMINATIONS_WEIGHT; - const isAlternativeClient = candidate?.implementation != "Parity Polkadot"; + const isAlternativeClient = candidate?.implementation + ? candidate?.implementation != "Parity Polkadot" + : false; const clientScore = isAlternativeClient ? constraints.WEIGHT_CONFIG.CLIENT_WEIGHT : 0; diff --git a/packages/common/src/constraints/ValidityChecks.ts b/packages/common/src/constraints/ValidityChecks.ts index 95444bb5f..b66f8e112 100644 --- a/packages/common/src/constraints/ValidityChecks.ts +++ b/packages/common/src/constraints/ValidityChecks.ts @@ -89,7 +89,7 @@ export const checkLatestClientVersion = async ( ): Promise => { try { const skipClientUpgrade = config.constraints?.skipClientUpgrade || false; - if (skipClientUpgrade!) { + if (!skipClientUpgrade) { if (candidate?.implementation == "Kagome Node") { await setLatestClientReleaseValidity(candidate.stash, true); return true; @@ -126,7 +126,6 @@ export const checkLatestClientVersion = async ( await setLatestClientReleaseValidity(candidate.stash, true); return true; } - return true; } catch (e) { logger.error( `Error checking latest client version: ${e}`,