From 4af30a4aafd3f38c26c20f4b565da001e932ca43 Mon Sep 17 00:00:00 2001 From: jonastheis <4181434+jonastheis@users.noreply.github.com> Date: Tue, 4 Feb 2025 15:53:47 +0800 Subject: [PATCH 1/3] add periodic logs for L1 follower mode sync progress --- rollup/da_syncer/da/calldata_blob_source.go | 4 ++++ rollup/da_syncer/da_queue.go | 4 ++++ rollup/da_syncer/data_source.go | 1 + rollup/da_syncer/syncing_pipeline.go | 13 +++++++++++++ 4 files changed, 22 insertions(+) diff --git a/rollup/da_syncer/da/calldata_blob_source.go b/rollup/da_syncer/da/calldata_blob_source.go index 5b665aa0160f..a17ebdb0fc15 100644 --- a/rollup/da_syncer/da/calldata_blob_source.go +++ b/rollup/da_syncer/da/calldata_blob_source.go @@ -85,6 +85,10 @@ func (ds *CalldataBlobSource) L1Height() uint64 { return ds.l1Height } +func (ds *CalldataBlobSource) L1Finalized() uint64 { + return ds.l1Finalized +} + func (ds *CalldataBlobSource) processRollupEventsToDA(rollupEvents l1.RollupEvents) (Entries, error) { var entries Entries var entry Entry diff --git a/rollup/da_syncer/da_queue.go b/rollup/da_syncer/da_queue.go index 3602947f51e2..49e9f8ebc310 100644 --- a/rollup/da_syncer/da_queue.go +++ b/rollup/da_syncer/da_queue.go @@ -69,6 +69,10 @@ func (dq *DAQueue) getNextData(ctx context.Context) error { return err } +func (dq *DAQueue) DataSource() DataSource { + return dq.dataSource +} + func (dq *DAQueue) Reset(height uint64) { dq.l1height = height dq.dataSource = nil diff --git a/rollup/da_syncer/data_source.go b/rollup/da_syncer/data_source.go index 048fec6bb3e2..c57750b43220 100644 --- a/rollup/da_syncer/data_source.go +++ b/rollup/da_syncer/data_source.go @@ -14,6 +14,7 @@ import ( type DataSource interface { NextData() (da.Entries, error) L1Height() uint64 + L1Finalized() uint64 } type DataSourceFactory struct { diff --git a/rollup/da_syncer/syncing_pipeline.go b/rollup/da_syncer/syncing_pipeline.go index 6ed84fe85186..3d95c674d8ae 100644 --- a/rollup/da_syncer/syncing_pipeline.go +++ b/rollup/da_syncer/syncing_pipeline.go @@ -39,6 +39,7 @@ type SyncingPipeline struct { blockchain *core.BlockChain blockQueue *BlockQueue daSyncer *DASyncer + daQueue *DAQueue } func NewSyncingPipeline(ctx context.Context, blockchain *core.BlockChain, genesisConfig *params.ChainConfig, db ethdb.Database, ethClient l1.Client, l1DeploymentBlock uint64, config Config) (*SyncingPipeline, error) { @@ -92,6 +93,7 @@ func NewSyncingPipeline(ctx context.Context, blockchain *core.BlockChain, genesi blockchain: blockchain, blockQueue: blockQueue, daSyncer: daSyncer, + daQueue: daQueue, }, nil } @@ -115,6 +117,9 @@ func (s *SyncingPipeline) Start() { } func (s *SyncingPipeline) mainLoop() { + progressTicker := time.NewTicker(1 * time.Minute) + defer progressTicker.Stop() + stepCh := make(chan struct{}, 1) var delayedStepCh <-chan time.Time var resetCounter int @@ -152,6 +157,14 @@ func (s *SyncingPipeline) mainLoop() { select { case <-s.ctx.Done(): return + case <-progressTicker.C: + currentBlock := s.blockchain.CurrentBlock() + dataSource := s.daQueue.DataSource() + if dataSource != nil { + log.Info("L1 sync progress", "L1 processed", dataSource.L1Height(), "L1 finalized", dataSource.L1Finalized(), "progress(%)", float64(dataSource.L1Height())/float64(dataSource.L1Finalized())*100, "L2 height", currentBlock.Number().Uint64(), "L2 hash", currentBlock.Hash()) + } else { + log.Info("L1 sync progress", "blockchain height", currentBlock.Number().Uint64(), "block hash", currentBlock.Hash()) + } case <-delayedStepCh: delayedStepCh = nil reqStep(false) From 23eb4287edfebaa3bf54c977ad3da70e903940b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Tue, 4 Feb 2025 12:26:21 +0100 Subject: [PATCH 2/3] print full hex string --- rollup/da_syncer/da_syncer.go | 2 +- rollup/da_syncer/syncing_pipeline.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rollup/da_syncer/da_syncer.go b/rollup/da_syncer/da_syncer.go index a60b73a3f045..6582f3376ebc 100644 --- a/rollup/da_syncer/da_syncer.go +++ b/rollup/da_syncer/da_syncer.go @@ -46,7 +46,7 @@ func (s *DASyncer) SyncOneBlock(block *da.PartialBlock) error { } if s.blockchain.CurrentBlock().Number().Uint64()%1000 == 0 { - log.Info("L1 sync progress", "blockchain height", s.blockchain.CurrentBlock().Number().Uint64(), "block hash", s.blockchain.CurrentBlock().Hash(), "root", s.blockchain.CurrentBlock().Root()) + log.Info("L1 sync progress", "blockchain height", s.blockchain.CurrentBlock().Number().Uint64(), "block hash", s.blockchain.CurrentBlock().Hash().Hex(), "root", s.blockchain.CurrentBlock().Root().Hex()) } return nil diff --git a/rollup/da_syncer/syncing_pipeline.go b/rollup/da_syncer/syncing_pipeline.go index 3d95c674d8ae..af9a1f685515 100644 --- a/rollup/da_syncer/syncing_pipeline.go +++ b/rollup/da_syncer/syncing_pipeline.go @@ -161,9 +161,9 @@ func (s *SyncingPipeline) mainLoop() { currentBlock := s.blockchain.CurrentBlock() dataSource := s.daQueue.DataSource() if dataSource != nil { - log.Info("L1 sync progress", "L1 processed", dataSource.L1Height(), "L1 finalized", dataSource.L1Finalized(), "progress(%)", float64(dataSource.L1Height())/float64(dataSource.L1Finalized())*100, "L2 height", currentBlock.Number().Uint64(), "L2 hash", currentBlock.Hash()) + log.Info("L1 sync progress", "L1 processed", dataSource.L1Height(), "L1 finalized", dataSource.L1Finalized(), "progress(%)", float64(dataSource.L1Height())/float64(dataSource.L1Finalized())*100, "L2 height", currentBlock.Number().Uint64(), "L2 hash", currentBlock.Hash().Hex()) } else { - log.Info("L1 sync progress", "blockchain height", currentBlock.Number().Uint64(), "block hash", currentBlock.Hash()) + log.Info("L1 sync progress", "blockchain height", currentBlock.Number().Uint64(), "block hash", currentBlock.Hash().Hex()) } case <-delayedStepCh: delayedStepCh = nil From f905b11430401522c9b8db8b987c1f39c21fb9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Tue, 4 Feb 2025 12:26:34 +0100 Subject: [PATCH 3/3] bump version --- params/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/params/version.go b/params/version.go index fce502c363af..330ab7c0ec9e 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 5 // Major version component of the current release VersionMinor = 8 // Minor version component of the current release - VersionPatch = 2 // Patch version component of the current release + VersionPatch = 3 // Patch version component of the current release VersionMeta = "mainnet" // Version metadata to append to the version string )