From d1caa1f61730551908ab2b969b972c7978909e87 Mon Sep 17 00:00:00 2001 From: Cayman Date: Wed, 7 Feb 2024 14:13:45 -0500 Subject: [PATCH] fix: fix regression in getCurrentSlotAround (#6407) --- packages/validator/src/util/clock.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/validator/src/util/clock.ts b/packages/validator/src/util/clock.ts index 837fb82809bd..ca29eacd41c2 100644 --- a/packages/validator/src/util/clock.ts +++ b/packages/validator/src/util/clock.ts @@ -138,7 +138,7 @@ export class Clock implements IClock { */ export function getCurrentSlotAround(config: ChainForkConfig, genesisTime: TimeSeconds): Slot { const diffInSeconds = Date.now() / 1000 - genesisTime; - const slotsSinceGenesis = Math.floor(diffInSeconds / config.SECONDS_PER_SLOT); + const slotsSinceGenesis = Math.round(diffInSeconds / config.SECONDS_PER_SLOT); return GENESIS_SLOT + slotsSinceGenesis; }