Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions yarn-project/validator-client/src/validator.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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<BlobClientInterface>;
Expand Down Expand Up @@ -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<BlobClientInterface>();
blobClient.canUpload.mockReturnValue(false);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
Loading