diff --git a/src/libs/api.ts b/src/libs/api.ts index 9bef3c80..376b841b 100644 --- a/src/libs/api.ts +++ b/src/libs/api.ts @@ -190,4 +190,8 @@ export const DEFAULT: RequestRegistry = { url: '/ibc/core/connection/v1/connections/{connection_id}/client_state', adapter, }, + interchain_security_ccv_provider_validator_consumer_addr: { + url: '/interchain_security/ccv/provider/validator_consumer_addr?provider_address={provider_address}&chain_id={chain_id}', + adapter, + }, }; diff --git a/src/libs/client.ts b/src/libs/client.ts index aa73ae2e..4aae8cbe 100644 --- a/src/libs/client.ts +++ b/src/libs/client.ts @@ -326,4 +326,7 @@ export class CosmosRestClient extends BaseRestClient { port_id, }); } + async getInterchainSecurityValidatorRotatedKey(chain_id: string, provider_address: string) { + return this.request(this.registry.interchain_security_ccv_provider_validator_consumer_addr, {chain_id, provider_address}); + } } diff --git a/src/libs/registry.ts b/src/libs/registry.ts index 6696d12e..ce423071 100644 --- a/src/libs/registry.ts +++ b/src/libs/registry.ts @@ -149,6 +149,7 @@ export interface RequestRegistry extends AbstractRegistry { ibc_core_connection_connections: Request; ibc_core_connection_connections_connection_id: Request; ibc_core_connection_connections_connection_id_client_state: Request; + interchain_security_ccv_provider_validator_consumer_addr: Request<{consumer_address: string}> } export function adapter(source: any): T { diff --git a/src/modules/[chain]/consensus/index.vue b/src/modules/[chain]/consensus/index.vue index 9bd69cc4..5da77b5e 100644 --- a/src/modules/[chain]/consensus/index.vue +++ b/src/modules/[chain]/consensus/index.vue @@ -93,9 +93,9 @@ async function onChange () { } async function fetchPosition() { - let dumpurl = rpc.value.replace('consensus_state', 'dump_consensus_state'); + // let dumpurl = rpc.value.replace('consensus_state', 'dump_consensus_state'); try { - const response = await fetch(dumpurl); + const response = await fetch(rpc.value); if (!response.ok) { throw new Error(`HTTP error: ${response.status}`); } diff --git a/src/modules/[chain]/uptime/index.vue b/src/modules/[chain]/uptime/index.vue index b06c36af..6ad6a77f 100644 --- a/src/modules/[chain]/uptime/index.vue +++ b/src/modules/[chain]/uptime/index.vue @@ -9,7 +9,7 @@ import { } from '@/stores'; import UptimeBar from '@/components/UptimeBar.vue'; import type { Commit, SlashingParam, SigningInfo } from '@/types'; -import { consensusPubkeyToHexAddress, valconsToBase64 } from '@/libs'; +import { consensusPubkeyToHexAddress, pubKeyToValcons, valconsToBase64 } from '@/libs'; const props = defineProps(['chain']); @@ -25,7 +25,6 @@ const slashingParam = ref({} as SlashingParam); const signingInfo = ref({} as Record); -const filterOptout = ref(false); // filter validators by keywords const validators = computed(() => { if (keyword) @@ -36,26 +35,47 @@ const validators = computed(() => { }); const list = computed(() => { - const window = Number(slashingParam.value.signed_blocks_window || 0); - const vset = validators.value.map((v) => { - const signing = - signingInfo.value[consensusPubkeyToHexAddress(v.consensus_pubkey)]; - return { - v, - signing, - hex: toBase64(fromHex(consensusPubkeyToHexAddress(v.consensus_pubkey))), - uptime: - signing && window > 0 - ? (window - Number(signing.missed_blocks_counter)) / window - : undefined, - }; - }); - return filterOptout.value ? vset.filter((x) => x.signing) : vset; + if(chainStore.isConsumerChain) { + stakingStore.loadKeyRotationFromLocalstorage(baseStore.latest?.block?.header?.chain_id) + + const window = Number(slashingParam.value.signed_blocks_window || 0); + const vset = validators.value.map((v) => { + + const hexAddress = stakingStore.findRotatedHexAddress(v.consensus_pubkey) + const signing = + signingInfo.value[hexAddress]; + return { + v, + signing, + hex: toBase64(fromHex(hexAddress)), + uptime: + signing && window > 0 + ? (window - Number(signing.missed_blocks_counter)) / window + : undefined, + }; + }); + return vset; + } else { + const window = Number(slashingParam.value.signed_blocks_window || 0); + const vset = validators.value.map((v) => { + const signing = + signingInfo.value[consensusPubkeyToHexAddress(v.consensus_pubkey)]; + return { + v, + signing, + hex: toBase64(fromHex(consensusPubkeyToHexAddress(v.consensus_pubkey))), + uptime: + signing && window > 0 + ? (window - Number(signing.missed_blocks_counter)) / window + : undefined, + }; + }); + return vset; + } }); onMounted(() => { live.value = true; - baseStore.fetchLatest().then((l) => { let b = l; if ( @@ -113,6 +133,10 @@ const tab = ref('2'); function changeTab(v: string) { tab.value = v; } + +function fetchAllKeyRotation() { + stakingStore.fetchAllKeyRotation(baseStore.latest?.block?.header?.chain_id) +}