diff --git a/components/RoundStatus/index.tsx b/components/RoundStatus/index.tsx
index aeaba3b5..59ed1781 100644
--- a/components/RoundStatus/index.tsx
+++ b/components/RoundStatus/index.tsx
@@ -37,32 +37,56 @@ const Index = ({
const currentRoundInfo = useCurrentRoundData();
+ const blocksSinceCurrentRoundStart = useMemo(
+ () =>
+ currentRoundInfo?.initialized
+ ? currentRoundInfo.currentL1Block - currentRoundInfo.startBlock
+ : 0,
+ [currentRoundInfo]
+ );
+ const isOverdue = useMemo(
+ () =>
+ Boolean(
+ protocol && blocksSinceCurrentRoundStart >= +protocol.roundLength
+ ),
+ [protocol, blocksSinceCurrentRoundStart]
+ );
const blocksRemaining = useMemo(
() =>
- currentRoundInfo?.initialized && protocol
- ? +protocol.roundLength -
- (+Number(currentRoundInfo.currentL1Block) -
- +Number(currentRoundInfo.startBlock))
+ protocol
+ ? Math.max(+protocol.roundLength - blocksSinceCurrentRoundStart, 0)
: 0,
- [protocol, currentRoundInfo]
+ [protocol, blocksSinceCurrentRoundStart]
);
const timeRemaining = useMemo(
() => AVERAGE_L1_BLOCK_TIME * blocksRemaining,
[blocksRemaining]
);
- const blocksSinceCurrentRoundStart = useMemo(
+ const blocksOverdue = useMemo(
() =>
- currentRoundInfo?.initialized
- ? +Number(currentRoundInfo.currentL1Block) -
- +Number(currentRoundInfo.startBlock)
+ protocol
+ ? Math.max(blocksSinceCurrentRoundStart - +protocol.roundLength, 0)
: 0,
- [currentRoundInfo]
+ [protocol, blocksSinceCurrentRoundStart]
+ );
+ const timeOverdue = useMemo(
+ () => AVERAGE_L1_BLOCK_TIME * blocksOverdue,
+ [blocksOverdue]
+ );
+ const blocksSinceCurrentRoundStartDisplay = useMemo(
+ () =>
+ protocol
+ ? Math.min(blocksSinceCurrentRoundStart, +protocol.roundLength)
+ : blocksSinceCurrentRoundStart,
+ [protocol, blocksSinceCurrentRoundStart]
);
-
const percentage = useMemo(
() =>
protocol
- ? (blocksSinceCurrentRoundStart / +protocol.roundLength) * 100
+ ? Math.min(
+ (blocksSinceCurrentRoundStart / +protocol.roundLength) * 100,
+ 100
+ )
: 0,
[blocksSinceCurrentRoundStart, protocol]
);
@@ -219,7 +243,7 @@ const Index = ({
>
- {blocksSinceCurrentRoundStart}
+ {blocksSinceCurrentRoundStartDisplay}
of {protocol.roundLength} blocks
@@ -227,37 +251,55 @@ const Index = ({
-
-
- There are{" "}
-
- {blocksRemaining} blocks
- {" "}
- and approximately{" "}
-
- {dayjs().add(timeRemaining, "seconds").fromNow(true)}
- {" "}
- remaining until the current round ends and round{" "}
-
- #{+Number(currentRoundInfo.id) + 1}
- {" "}
- begins.
-
+
+ {isOverdue ? (
+
+ Round{" "}
+
+ #{currentRoundInfo.id}
+ {" "}
+ ended approximately{" "}
+
+ {dayjs().subtract(timeOverdue, "seconds").fromNow(true)} ago
+
+ . Awaiting an orchestrator to start round{" "}
+
+ #{currentRoundInfo.id + 1}
+
+ .
+
+ ) : (
+
+ There are{" "}
+
+ {blocksRemaining} blocks
+ {" "}
+ and approximately{" "}
+
+ {dayjs().add(timeRemaining, "seconds").fromNow(true)}
+ {" "}
+ remaining until the current round ends and round{" "}
+
+ #{currentRoundInfo.id + 1}
+ {" "}
+ begins.
+
+ )}