fix uptime

This commit is contained in:
Pham Tu 2024-03-05 14:48:47 +07:00
parent 5968115ab9
commit 084e0d65db
No known key found for this signature in database
GPG Key ID: 7460FD99133ADA1C
2 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,7 @@
<script lang="ts" setup>
import { toHex } from '@cosmjs/encoding';
import type { Commit } from '@cosmjs/tendermint-rpc';
import { toBase64 } from '@injectivelabs/sdk-ts';
import { computed, type PropType } from 'vue';
const props = defineProps({
@ -12,9 +14,11 @@ const bars = computed(() => {
if (!props.blocks) return uptime;
props.blocks.filter(Boolean).forEach((element) => {
const has = element.signatures?.findIndex(
(sig) => sig.validatorAddress === props.validator
(sig) =>
sig.validatorAddress &&
toHex(sig.validatorAddress).toUpperCase() === props.validator
);
// console.log(has, props.validato, element)
uptime.push({
height: element.height,
color: has > -1 ? 'bg-green-500' : 'bg-red-500',

View File

@ -56,7 +56,7 @@ const list = computed(() => {
return {
v,
signing,
hex: toBase64(fromHex(hexAddress)),
hex: hexAddress,
uptime:
signing && window > 0
? (window - Number(signing.missedBlocksCounter)) / window
@ -72,7 +72,7 @@ const list = computed(() => {
return {
v,
signing,
hex: toBase64(fromHex(consensusPubkeyToHexAddress(v.consensusPubkey))),
hex: consensusPubkeyToHexAddress(v.consensusPubkey),
uptime:
signing && window > 0
? (window - Number(signing.missedBlocksCounter)) / window
@ -313,7 +313,10 @@ function fetchAllKeyRotation() {
:data-tip="`Window size: ${slashingParam.signedBlocksWindow}`"
><span class="ml-2 btn btn-error btn-xs">{{
slashingParam.minSignedPerWindow &&
format.percent(fromAscii(slashingParam.minSignedPerWindow))
format.percent(
fromAscii(slashingParam.minSignedPerWindow),
1e18
)
}}</span>
</span>
</td>