From 54bd75a2b3451439cb6907d51bd9ebfcf103fcf2 Mon Sep 17 00:00:00 2001 From: verkhohliad Date: Wed, 14 Aug 2024 12:05:36 +0100 Subject: [PATCH 1/2] handle incorrect validator registration message, fix finding next shutter validator in next epochs, update progress unit to seconds --- src/shared/ShutterTimer/ShutterTimer.tsx | 5 ++-- .../useGetShutterValidatorIndexes.ts | 25 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/shared/ShutterTimer/ShutterTimer.tsx b/src/shared/ShutterTimer/ShutterTimer.tsx index cd96eb9..5a8f5f6 100644 --- a/src/shared/ShutterTimer/ShutterTimer.tsx +++ b/src/shared/ShutterTimer/ShutterTimer.tsx @@ -49,7 +49,7 @@ export const ShutterTimer = () => { if (!match) { setTimeDifference(0); - setCurrentEpoch(getEpoch(chain.genesisTime) + 1); + setCurrentEpoch(currentEpoch + 1); clearInterval(interval); return; } @@ -73,7 +73,8 @@ export const ShutterTimer = () => { className="my-4" aria-label="Loading..." size="lg" - value={100 - timeDifference} + value={timeDifference} + formatOptions={{ style: "unit", unit: "second" }} color="warning" showValueLabel={true} /> diff --git a/src/shared/ShutterTimer/useGetShutterValidatorIndexes.ts b/src/shared/ShutterTimer/useGetShutterValidatorIndexes.ts index a168236..7060e00 100644 --- a/src/shared/ShutterTimer/useGetShutterValidatorIndexes.ts +++ b/src/shared/ShutterTimer/useGetShutterValidatorIndexes.ts @@ -36,19 +36,24 @@ export const useGetShutterValidatorIndexes = (chainId: number) => { let newLastBlock = lastBlockNumber; const indexes = logs?.reduce((acc, log) => { - const validatorIndex = extractValidatorIndex(log.message); - const subscriptionStatus = extractSubscriptionStatus(log.message); + try { + const validatorIndex = extractValidatorIndex(log.message); + const subscriptionStatus = extractSubscriptionStatus(log.message); - if (subscriptionStatus) { - acc.add(validatorIndex); - } else { - currentIndexes = currentIndexes.filter((index) => index !== validatorIndex); - acc.delete(validatorIndex); - } + if (subscriptionStatus) { + acc.add(validatorIndex); + } else { + currentIndexes = currentIndexes.filter((index) => index !== validatorIndex); + acc.delete(validatorIndex); + } - newLastBlock = Number(log.blockNumber); + newLastBlock = Number(log.blockNumber); - return acc; + return acc; + } catch (err) { + console.error('Failed to extract validator index from log', err); + return acc; + } }, new Set()); if (indexes && newLastBlock > lastBlockNumber) { From 5fb65e60e0ad0558758b7db0869b5073b2a467a7 Mon Sep 17 00:00:00 2001 From: verkhohliad Date: Wed, 14 Aug 2024 12:06:37 +0100 Subject: [PATCH 2/2] add theGraph secret to deployment script --- .github/workflows/dev_deploy.yml | 1 + .github/workflows/prod_deploy.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml index 8301b3d..5951e6e 100644 --- a/.github/workflows/dev_deploy.yml +++ b/.github/workflows/dev_deploy.yml @@ -13,6 +13,7 @@ concurrency: env: VITE_WALLET_CONNECT_PROJECT_ID: ${{ secrets.VITE_WALLET_CONNECT_PROJECT_ID }} + VITE_THE_GRAPH_API_KEY: ${{ secrets.VITE_THE_GRAPH_API_KEY }} jobs: deploy: diff --git a/.github/workflows/prod_deploy.yaml b/.github/workflows/prod_deploy.yaml index cb675f4..714b6cc 100644 --- a/.github/workflows/prod_deploy.yaml +++ b/.github/workflows/prod_deploy.yaml @@ -15,6 +15,7 @@ concurrency: env: VITE_WALLET_CONNECT_PROJECT_ID: ${{ secrets.VITE_WALLET_CONNECT_PROJECT_ID }} + VITE_THE_GRAPH_API_KEY: ${{ secrets.VITE_THE_GRAPH_API_KEY }} jobs: deploy: