incorrect bridge estimations fix

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2026-02-10 20:35:12 +03:00
parent 87ebb9beff
commit 056177c34b
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
3 changed files with 6 additions and 4 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "ghost-dao-interface", "name": "ghost-dao-interface",
"private": true, "private": true,
"version": "0.5.5", "version": "0.5.7",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@ -252,10 +252,10 @@ const Bridge = ({ chainId, address, config, connect }) => {
if (commit.disabled || blockNumber < blocksInFourHours) { if (commit.disabled || blockNumber < blocksInFourHours) {
continue; continue;
} }
certainty += (commit?.lastStoredBlock ?? 0n) - (blockNumber - blocksInFourHours); certainty += (commit?.lastStoredBlock ?? 0n) + BigInt(finalityDelay) - (blockNumber - blocksInFourHours);
} }
return Math.max(Number(certainty * 100n / (blocksInFourHours * BigInt(length))), 0); return Math.max(Number(certainty * 100n / (blocksInFourHours * BigInt(length))), 0);
}, [latestCommits, blockNumber]); }, [latestCommits, blockNumber, finalityDelay]);
const timeToNextEpoch = useMemo(() => { const timeToNextEpoch = useMemo(() => {
if (!currentSession || !genesisSlot || !currentSlot) { if (!currentSession || !genesisSlot || !currentSlot) {
@ -343,6 +343,7 @@ const Bridge = ({ chainId, address, config, connect }) => {
transactionEta={slowestEvmBlock ? Number(slowestEvmBlock) : undefined} transactionEta={slowestEvmBlock ? Number(slowestEvmBlock) : undefined}
timeToNextEpoch={timeToNextEpoch ? Number(timeToNextEpoch) : undefined} timeToNextEpoch={timeToNextEpoch ? Number(timeToNextEpoch) : undefined}
isSmallScreen={isSmallScreen} isSmallScreen={isSmallScreen}
maxDelay={14400 + finalityDelay * Number(networkAvgBlockSpeed(chainId))}
/> />
</Paper> </Paper>
</Grid> </Grid>

View File

@ -12,6 +12,7 @@ export const BridgeHeader = ({
bridgeStability, bridgeStability,
transactionEta, transactionEta,
timeToNextEpoch, timeToNextEpoch,
maxDelay,
isSmallScreen isSmallScreen
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
@ -92,7 +93,7 @@ export const BridgeHeader = ({
<Grid item xs={isSmallScreen ? 12 : 4}> <Grid item xs={isSmallScreen ? 12 : 4}>
<Metric <Metric
isLoading={transactionEta === undefined} isLoading={transactionEta === undefined}
metric={transactionEta > 14400 ? "∞" : formatTime(transactionEta)} metric={transactionEta > maxDelay ? "∞" : formatTime(transactionEta)}
label="Max Bridge ETA" label="Max Bridge ETA"
tooltip="Maximum estimated time for finalizing bridge transactions based on the latest update." tooltip="Maximum estimated time for finalizing bridge transactions based on the latest update."
/> />