@@ -284,28 +284,32 @@ func CheckMissReport(
284
284
blockHeight int64 ,
285
285
gracePeriod int64 ,
286
286
) bool {
287
- // During the grace period, if the block time exceeds MaxGuaranteeBlockTime, it will be capped at MaxGuaranteeBlockTime.
288
- // This means that in cases of slow block time, the validator will not be deactivated
289
- // as long as the block height does not exceed the equivalent of assumed MaxGuaranteeBlockTime of block time.
290
- lastTime := lastUpdateTimestamp + gracePeriod
291
- lastBlock := lastUpdateBlock + gracePeriod / types .MaxGuaranteeBlockTime
292
-
293
- if valInfo .Status .Since .Unix ()+ gracePeriod > lastTime {
294
- lastTime = valInfo .Status .Since .Unix () + gracePeriod
287
+ // Calculate the deadline time and block height for the validator to report.
288
+ // During the grace period, if the block time exceeds ExpectedBlockTime, it will be capped at ExpectedBlockTime.
289
+ // This prevents validator deactivation due to slower block times, as long as the block height remains within the threshold.
290
+ deadlineTime := lastUpdateTimestamp + gracePeriod
291
+ deadlineBlock := lastUpdateBlock + gracePeriod / types .ExpectedBlockTime
292
+
293
+ // Extend deadline if the validator just became active.
294
+ if valInfo .Status .Since .Unix ()+ gracePeriod > deadlineTime {
295
+ deadlineTime = valInfo .Status .Since .Unix () + gracePeriod
295
296
}
296
297
298
+ // Extend deadline if the validator has a valid price within the feed interval.
297
299
if valPrice .SignalPriceStatus != types .SIGNAL_PRICE_STATUS_UNSPECIFIED {
298
- if valPrice .Timestamp + feed .Interval > lastTime {
299
- lastTime = valPrice .Timestamp + feed .Interval
300
+ // Extend deadline time based on the price timestamp.
301
+ if valPrice .Timestamp + feed .Interval > deadlineTime {
302
+ deadlineTime = valPrice .Timestamp + feed .Interval
300
303
}
301
304
302
- if valPrice .BlockHeight + feed .Interval / types .MaxGuaranteeBlockTime > lastBlock {
303
- lastBlock = valPrice .BlockHeight + feed .Interval / types .MaxGuaranteeBlockTime
305
+ // Extend deadline block based on the price block height.
306
+ if valPrice .BlockHeight + feed .Interval / types .ExpectedBlockTime > deadlineBlock {
307
+ deadlineBlock = valPrice .BlockHeight + feed .Interval / types .ExpectedBlockTime
304
308
}
305
309
}
306
310
307
- // Determine if the last action is too old, indicating a missed report
308
- return lastTime < blockTime .Unix () && lastBlock < blockHeight
311
+ // Determine if the validator has missed the report based on the deadline time and block height.
312
+ return deadlineTime < blockTime .Unix () && deadlineBlock < blockHeight
309
313
}
310
314
311
315
// checkHavePrice checks if a validator has a price feed within interval range.
0 commit comments