From 309d8a0a8c4d4d2c48a0f5571b5bb41ab48ba8b5 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Tue, 2 Apr 2024 17:59:27 +0200 Subject: [PATCH] Add a check for checkpoint sync --- .../cli/test/utils/simulation/utils/syncing.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/cli/test/utils/simulation/utils/syncing.ts b/packages/cli/test/utils/simulation/utils/syncing.ts index a8938d6159c..bc6fd128b7f 100644 --- a/packages/cli/test/utils/simulation/utils/syncing.ts +++ b/packages/cli/test/utils/simulation/utils/syncing.ts @@ -54,12 +54,14 @@ export async function assertRangeSync(env: SimulationEnvironment): Promise } export async function assertCheckpointSync(env: SimulationEnvironment): Promise { - // First checkpoint finalized is at least 4 epochs - await waitForSlot("Waiting for 4th epoch to pass, to get first finalized checkpoint", { - env, - slot: env.clock.getFirstSlotOfEpoch(4), - nodes: [env.nodes[0]], - }); + if (env.clock.currentEpoch <= 4) { + // First checkpoint finalized is at least 4 epochs + await waitForSlot("Waiting for 4th epoch to pass, to get first finalized checkpoint", { + env, + slot: env.clock.getFirstSlotOfEpoch(4), + nodes: [env.nodes[0]], + }); + } const finalizedCheckpoint = await env.nodes[0].beacon.api.beacon.getStateFinalityCheckpoints("head"); ApiError.assert(finalizedCheckpoint);