Skip to content

Commit

Permalink
Add a check for checkpoint sync
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarhussain committed Apr 2, 2024
1 parent 09b081e commit 309d8a0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/cli/test/utils/simulation/utils/syncing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,14 @@ export async function assertRangeSync(env: SimulationEnvironment): Promise<void>
}

export async function assertCheckpointSync(env: SimulationEnvironment): Promise<void> {
// 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);
Expand Down

0 comments on commit 309d8a0

Please sign in to comment.