File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -320,13 +320,17 @@ export class WaitingTimeService {
320
320
const requests = this . queueInfo . getRequests ( ) ;
321
321
const requestTimestamp = request . timestamp . toNumber ( ) * 1000 ;
322
322
const queueStETH = calculateUnfinalizedEthToRequestId ( requests , request ) ;
323
+ const currentFrame = this . genesisTimeService . getFrameOfEpoch ( this . genesisTimeService . getCurrentEpoch ( ) ) ;
323
324
324
325
let currentType = type ;
325
326
let ms = this . genesisTimeService . timeToWithdrawalFrame ( frame , requestTimestamp ) ;
326
327
let finalizationIn = validateTimeResponseWithFallback ( ms ) + GAP_AFTER_REPORT ;
327
328
const isInPast = requestTimestamp + ms - Date . now ( ) < 0 ;
328
329
329
330
if ( isInPast ) {
331
+ this . logger . warn (
332
+ `Request with id ${ request . id } was calculated with finalisation in past (finalizationIn=${ finalizationIn } ) and going to be recalculated` ,
333
+ ) ;
330
334
// if calculation wrong points to past then validators is not excited in time
331
335
// we need recalculate
332
336
const recalculatedResult = await this . calculateWithdrawalFrame ( {
@@ -338,10 +342,17 @@ export class WaitingTimeService {
338
342
} ) ;
339
343
340
344
ms = this . genesisTimeService . timeToWithdrawalFrame ( recalculatedResult . frame , requestTimestamp ) ;
341
- finalizationIn = validateTimeResponseWithFallback ( ms ) + GAP_AFTER_REPORT ;
342
345
currentType = recalculatedResult . type ;
343
346
}
344
347
348
+ // temporary fallback for negative results, can be deleted after validator balances computation improvements
349
+ if ( ms < 0 ) {
350
+ this . logger . warn (
351
+ `Request with id ${ request . id } was recalculated and finalisation still in points to past (recalculated finalizationIn=${ ms } ). Fallback to next frame` ,
352
+ ) ;
353
+ finalizationIn = this . genesisTimeService . timeToWithdrawalFrame ( currentFrame + 1 , requestTimestamp ) ;
354
+ }
355
+
345
356
return {
346
357
type : currentType ,
347
358
finalizationIn,
You can’t perform that action at this time.
0 commit comments