1- import { INITIAL_L2_BLOCK_NUM } from '@aztec/constants' ;
21import { type Logger , createLogger } from '@aztec/foundation/log' ;
32import type { L2TipsKVStore } from '@aztec/kv-store/stores' ;
43import { L2BlockStream , type L2BlockStreamEvent , type L2BlockStreamEventHandler } from '@aztec/stdlib/block' ;
@@ -10,13 +9,11 @@ import type { SyncDataProvider } from '../storage/sync_data_provider/sync_data_p
109import type { TaggingDataProvider } from '../storage/tagging_data_provider/tagging_data_provider.js' ;
1110
1211/**
13- * The Synchronizer class manages the synchronization with the aztec node, allowing PXE to retrieve the
14- * latest block header and handle reorgs.
15- * It provides methods to trigger a sync and get the block number we are syncec to
16- * details, and fetch transactions by hash.
12+ * The Synchronizer class orchestrates synchronization between the PXE and Aztec node, maintaining an up-to-date
13+ * view of the L2 chain state. It handles block header retrieval, chain reorganizations, and provides an interface
14+ * for querying sync status.
1715 */
1816export class Synchronizer implements L2BlockStreamEventHandler {
19- private initialSyncBlockNumber = INITIAL_L2_BLOCK_NUM - 1 ;
2017 private log : Logger ;
2118 private isSyncing : Promise < void > | undefined ;
2219 protected readonly blockStream : L2BlockStream ;
@@ -80,7 +77,7 @@ export class Synchronizer implements L2BlockStreamEventHandler {
8077 }
8178
8279 /**
83- * Syncs PXE and the node by dowloading the metadata of the latest blocks, allowing simulations to use
80+ * Syncs PXE and the node by downloading the metadata of the latest blocks, allowing simulations to use
8481 * recent data (e.g. notes), and handling any reorgs that might have occurred.
8582 */
8683 public async sync ( ) {
@@ -115,7 +112,7 @@ export class Synchronizer implements L2BlockStreamEventHandler {
115112 await this . blockStream . sync ( ) ;
116113 }
117114
118- public async getSynchedBlockNumber ( ) {
119- return ( await this . syncDataProvider . getBlockNumber ( ) ) ?? this . initialSyncBlockNumber ;
115+ public getSynchedBlockNumber ( ) {
116+ return this . syncDataProvider . getBlockNumber ( ) ;
120117 }
121118}
0 commit comments