diff --git a/yarn-project/validator-client/src/validator.integration.test.ts b/yarn-project/validator-client/src/validator.integration.test.ts index 29f11ec711e0..0670eed45eab 100644 --- a/yarn-project/validator-client/src/validator.integration.test.ts +++ b/yarn-project/validator-client/src/validator.integration.test.ts @@ -13,7 +13,7 @@ import { Fr } from '@aztec/foundation/curves/bn254'; import { EthAddress } from '@aztec/foundation/eth-address'; import { type Logger, createLogger } from '@aztec/foundation/log'; import type { Hex } from '@aztec/foundation/string'; -import { TestDateProvider } from '@aztec/foundation/timer'; +import { ManualDateProvider } from '@aztec/foundation/timer'; import { type KeyStore, KeystoreManager } from '@aztec/node-keystore'; import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree'; import type { P2P, PeerId } from '@aztec/p2p'; @@ -82,7 +82,7 @@ describe('ValidatorClient Integration', () => { let proposerPrivateKey: Hex<32>; let validatorSigner: Secp256k1Signer; let validatorPrivateKey: Hex<32>; - let dateProvider: TestDateProvider; + let dateProvider: ManualDateProvider; let txProvider: TestTxProvider; let keyStoreManager: KeystoreManager; let blobClient: MockProxy; @@ -373,7 +373,7 @@ describe('ValidatorClient Integration', () => { // Set up common dependencies logger = createLogger('validator:test'); rollupAddress = EthAddress.random(); - dateProvider = new TestDateProvider(); + dateProvider = new ManualDateProvider(); txProvider = new TestTxProvider(); blobClient = mock(); blobClient.canUpload.mockReturnValue(false); @@ -544,6 +544,10 @@ describe('ValidatorClient Integration', () => { // Only validate first 2 blocks await attestorValidateBlocks(blocks.slice(0, 2)); + // Advance past slot 1's attestation deadline so the validator's bounded wait for the + // never-synced terminal block (block 3) times out at once instead of polling the full window. + dateProvider.setTime(Number(getTimestampForSlot(SlotNumber(slotNumber + 1), l1Constants)) * 1000); + // Attestation should fail because block 3 wasn't validated // The validator will timeout waiting for block with matching archive const attestations = await attestor.validator.attestToCheckpointProposal(proposal, mockPeerId); @@ -575,6 +579,10 @@ describe('ValidatorClient Integration', () => { await attestorValidateBlocks(blocks); + // Advance past slot 1's attestation deadline so the validator's bounded wait for a block + // matching the (random) archive times out at once instead of polling the full window. + dateProvider.setTime(Number(getTimestampForSlot(SlotNumber(slotNumber + 1), l1Constants)) * 1000); + // Attestation should fail because archive doesn't match any block const attestations = await attestor.validator.attestToCheckpointProposal(badProposal, mockPeerId); expect(attestations).toBeUndefined();