From c04df8fd987e7f5dda02dea4d8139970517f0364 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Thu, 12 Feb 2026 18:28:07 -0300 Subject: [PATCH] fix(validator): remove hardcoded 10s timeout for previous block syncing Now the validator times out trying to sync the previous block for validating a checkpoint at the beginning of the next slot, when the checkpoint is either dropped or checkpointed. --- yarn-project/validator-client/src/validator.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/yarn-project/validator-client/src/validator.ts b/yarn-project/validator-client/src/validator.ts index 682aaf6997ed..32a725fdc8f0 100644 --- a/yarn-project/validator-client/src/validator.ts +++ b/yarn-project/validator-client/src/validator.ts @@ -23,7 +23,7 @@ import { AuthRequest, AuthResponse, BlockProposalValidator, ReqRespSubProtocol } import { OffenseType, WANT_TO_SLASH_EVENT, type Watcher, type WatcherEmitter } from '@aztec/slasher'; import type { AztecAddress } from '@aztec/stdlib/aztec-address'; import type { CommitteeAttestationsAndSigners, L2Block, L2BlockSink, L2BlockSource } from '@aztec/stdlib/block'; -import { getEpochAtSlot } from '@aztec/stdlib/epoch-helpers'; +import { getEpochAtSlot, getTimestampForSlot } from '@aztec/stdlib/epoch-helpers'; import type { CreateCheckpointProposalLastBlockData, ITxProvider, @@ -595,7 +595,11 @@ export class ValidatorClient extends (EventEmitter as new () => WatcherEmitter) proposalInfo: LogData, ): Promise<{ isValid: true } | { isValid: false; reason: string }> { const slot = proposal.slotNumber; - const timeoutSeconds = 10; // TODO(palla/mbps): This should map to the timetable settings + + // Timeout block syncing at the start of the next slot + const config = this.checkpointsBuilder.getConfig(); + const nextSlotTimestampSeconds = Number(getTimestampForSlot(SlotNumber(slot + 1), config)); + const timeoutSeconds = Math.max(1, nextSlotTimestampSeconds - Math.floor(this.dateProvider.now() / 1000)); // Wait for last block to sync by archive let lastBlockHeader: BlockHeader | undefined;