Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(l1 follower): add periodic logs for L1 follower mode sync progress #1110

Merged
merged 3 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions rollup/da_syncer/da/calldata_blob_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions rollup/da_syncer/da_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions rollup/da_syncer/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
type DataSource interface {
NextData() (da.Entries, error)
L1Height() uint64
L1Finalized() uint64
}

type DataSourceFactory struct {
Expand Down
13 changes: 13 additions & 0 deletions rollup/da_syncer/syncing_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -92,6 +93,7 @@ func NewSyncingPipeline(ctx context.Context, blockchain *core.BlockChain, genesi
blockchain: blockchain,
blockQueue: blockQueue,
daSyncer: daSyncer,
daQueue: daQueue,
}, nil
}

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down