-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into QA-441-make-allure-reports-public
- Loading branch information
Showing
21 changed files
with
349 additions
and
834 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<template> | ||
<SystemAlert v-if="isIndexerDelayed"> | ||
<span | ||
v-if="latestTPS > MIN_TPS_TO_SHOW_HEAVY_LOAD_ALERT" | ||
v-html="t('systemAlert.indexerDelayedDueToHeavyLoad', { indexerDelayInHours })" | ||
/> | ||
<span v-else v-html="t('systemAlert.indexerDelayed', { indexerDelayInHours })" /> | ||
</SystemAlert> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { computed, ref } from "vue"; | ||
import { useI18n } from "vue-i18n"; | ||
import SystemAlert from "@/components/common/SystemAlert.vue"; | ||
import useBlocks from "@/composables/useBlocks"; | ||
import useContext from "@/composables/useContext"; | ||
import type { types } from "zksync-web3"; | ||
const { t } = useI18n(); | ||
const context = useContext(); | ||
const MIN_DELAY_TO_SHOW_ALERT = 900_000; // 15 mins | ||
const MIN_TPS_TO_SHOW_HEAVY_LOAD_ALERT = 70; | ||
const provider = context.getL2Provider(); | ||
const latestBlock = ref<types.Block | null>(null); | ||
(async () => { | ||
const block = await provider.getBlock("latest"); | ||
latestBlock.value = block; | ||
})(); | ||
const { load: getLatestIndexedBlocks, data: latestIndexedBlocks } = useBlocks(context); | ||
getLatestIndexedBlocks(1); | ||
const indexerDelay = computed(() => { | ||
if (!latestBlock.value?.number || !latestIndexedBlocks.value?.length) { | ||
return 0; | ||
} | ||
const latestBlockDate = new Date(latestBlock.value.timestamp * 1000); | ||
const latestIndexedBlockDate = new Date(latestIndexedBlocks.value[0].timestamp); | ||
const delay = latestBlockDate.getTime() - latestIndexedBlockDate.getTime(); | ||
return delay; | ||
}); | ||
const indexerDelayInHours = computed(() => (indexerDelay.value / (1000 * 60 * 60)).toFixed(1)); | ||
const isIndexerDelayed = computed(() => { | ||
if (indexerDelay.value > MIN_DELAY_TO_SHOW_ALERT) { | ||
return true; | ||
} | ||
return false; | ||
}); | ||
const latestTPS = computed(() => { | ||
if (!latestIndexedBlocks.value?.length) { | ||
return 0; | ||
} | ||
const numberOfTransactions = latestIndexedBlocks.value.reduce((acc, block) => acc + block.size, 0); | ||
const latestBlockDate = new Date(latestIndexedBlocks.value[0].timestamp); | ||
const firstBlockDate = new Date(latestIndexedBlocks.value[latestIndexedBlocks.value.length - 1].timestamp); | ||
const numberOfSeconds = Math.floor((latestBlockDate.getTime() - firstBlockDate.getTime()) / 1000); | ||
const tps = numberOfSeconds ? numberOfTransactions / numberOfSeconds : 0; | ||
return tps; | ||
}); | ||
</script> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<div class="system-alert"> | ||
<IconError class="icon" color="#FFC81A" /> | ||
<span class="system-alert-body"> | ||
<slot /> | ||
</span> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import IconError from "@/components/icons/IconError.vue"; | ||
</script> | ||
|
||
<style scoped lang="scss"> | ||
.system-alert { | ||
@apply flex items-center text-white rounded-2xl border border-amber-400/50 bg-amber-400/10 mb-6 py-3 px-4; | ||
.system-alert-body { | ||
@apply ml-3 w-full; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.