mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
feat(l1 follower): add periodic logs for L1 follower mode sync progress (#1110)
* add periodic logs for L1 follower mode sync progress * print full hex string * bump version --------- Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
This commit is contained in:
parent
d2f19ff58e
commit
8ecaeec8b8
6 changed files with 24 additions and 2 deletions
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 5 // Major version component of the current release
|
VersionMajor = 5 // Major version component of the current release
|
||||||
VersionMinor = 8 // Minor 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
|
VersionMeta = "mainnet" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,10 @@ func (ds *CalldataBlobSource) L1Height() uint64 {
|
||||||
return ds.l1Height
|
return ds.l1Height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ds *CalldataBlobSource) L1Finalized() uint64 {
|
||||||
|
return ds.l1Finalized
|
||||||
|
}
|
||||||
|
|
||||||
func (ds *CalldataBlobSource) processRollupEventsToDA(rollupEvents l1.RollupEvents) (Entries, error) {
|
func (ds *CalldataBlobSource) processRollupEventsToDA(rollupEvents l1.RollupEvents) (Entries, error) {
|
||||||
var entries Entries
|
var entries Entries
|
||||||
var entry Entry
|
var entry Entry
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,10 @@ func (dq *DAQueue) getNextData(ctx context.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (dq *DAQueue) DataSource() DataSource {
|
||||||
|
return dq.dataSource
|
||||||
|
}
|
||||||
|
|
||||||
func (dq *DAQueue) Reset(height uint64) {
|
func (dq *DAQueue) Reset(height uint64) {
|
||||||
dq.l1height = height
|
dq.l1height = height
|
||||||
dq.dataSource = nil
|
dq.dataSource = nil
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ func (s *DASyncer) SyncOneBlock(block *da.PartialBlock) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.blockchain.CurrentBlock().Number().Uint64()%1000 == 0 {
|
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
|
return nil
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import (
|
||||||
type DataSource interface {
|
type DataSource interface {
|
||||||
NextData() (da.Entries, error)
|
NextData() (da.Entries, error)
|
||||||
L1Height() uint64
|
L1Height() uint64
|
||||||
|
L1Finalized() uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
type DataSourceFactory struct {
|
type DataSourceFactory struct {
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ type SyncingPipeline struct {
|
||||||
blockchain *core.BlockChain
|
blockchain *core.BlockChain
|
||||||
blockQueue *BlockQueue
|
blockQueue *BlockQueue
|
||||||
daSyncer *DASyncer
|
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) {
|
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,
|
blockchain: blockchain,
|
||||||
blockQueue: blockQueue,
|
blockQueue: blockQueue,
|
||||||
daSyncer: daSyncer,
|
daSyncer: daSyncer,
|
||||||
|
daQueue: daQueue,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,6 +117,9 @@ func (s *SyncingPipeline) Start() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SyncingPipeline) mainLoop() {
|
func (s *SyncingPipeline) mainLoop() {
|
||||||
|
progressTicker := time.NewTicker(1 * time.Minute)
|
||||||
|
defer progressTicker.Stop()
|
||||||
|
|
||||||
stepCh := make(chan struct{}, 1)
|
stepCh := make(chan struct{}, 1)
|
||||||
var delayedStepCh <-chan time.Time
|
var delayedStepCh <-chan time.Time
|
||||||
var resetCounter int
|
var resetCounter int
|
||||||
|
|
@ -152,6 +157,14 @@ func (s *SyncingPipeline) mainLoop() {
|
||||||
select {
|
select {
|
||||||
case <-s.ctx.Done():
|
case <-s.ctx.Done():
|
||||||
return
|
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().Hex())
|
||||||
|
} else {
|
||||||
|
log.Info("L1 sync progress", "blockchain height", currentBlock.Number().Uint64(), "block hash", currentBlock.Hash().Hex())
|
||||||
|
}
|
||||||
case <-delayedStepCh:
|
case <-delayedStepCh:
|
||||||
delayedStepCh = nil
|
delayedStepCh = nil
|
||||||
reqStep(false)
|
reqStep(false)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue