From 71351cd0bcfb687d90fe6df87cc92eb81313a6f0 Mon Sep 17 00:00:00 2001 From: satyakwok <119509589+satyakwok@users.noreply.github.com> Date: Thu, 25 Jun 2026 11:18:21 +0200 Subject: [PATCH] fix(scan): show real block cadence, not the windowed perf average The block time stat read the chain-performance bucket average, which is windowed by the selected range and inflated by past stalls: it showed ~1.8s on the 1h bucket while testnet was producing ~0.5s blocks. Compute it from the latest blocks instead, falling back to the perf value only when there are not enough blocks to measure. --- apps/scan/app/[locale]/HomeContent.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/scan/app/[locale]/HomeContent.tsx b/apps/scan/app/[locale]/HomeContent.tsx index 91e07e3..9d8b3b5 100644 --- a/apps/scan/app/[locale]/HomeContent.tsx +++ b/apps/scan/app/[locale]/HomeContent.tsx @@ -125,9 +125,16 @@ export function HomeContent({ initial }: { initial: HomeBundle }) { const { data: chainStatus } = useChainStatus(network, initial.status); const latestPerf = performance?.points?.[performance.points.length - 1]; - const blockTime = latestPerf?.block_time_sec - ? `${latestPerf.block_time_sec.toFixed(1)}s` - : (blocks ? computeBlockTime(blocks.map((b) => b.timestamp as unknown as number | string)) : CHAIN_TARGET_BLOCK_TIME); + // Show the actual recent block cadence from the latest blocks. The + // chain-performance bucket average is windowed (range-dependent) and gets + // inflated by past stalls: it read ~1.8s on a 1h bucket while testnet was + // genuinely producing ~0.5s blocks. Fall back to the perf value, then the + // target, only when we don't have enough blocks to measure. + const blockTime = blocks && blocks.length >= 2 + ? computeBlockTime(blocks.map((b) => b.timestamp as unknown as number | string)) + : latestPerf?.block_time_sec + ? `${latestPerf.block_time_sec.toFixed(1)}s` + : CHAIN_TARGET_BLOCK_TIME; const totalTxValue = stats?.total_transactions != null ? formatNumber(stats.total_transactions) : estimateTotalTransactions(stats?.total_blocks, blocks);