Skip to content

Commit

Permalink
added l1 syncer progress to metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
V-Staykov committed Aug 28, 2024
1 parent c58b892 commit baa3c15
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion zk/stages/stage_l1syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"time"

"github.com/VictoriaMetrics/metrics"
"github.com/gateway-fm/cdk-erigon-lib/kv"
"github.com/ledgerwatch/log/v3"

Expand Down Expand Up @@ -41,7 +42,11 @@ type IL1Syncer interface {
Stop()
}

var ErrStateRootMismatch = errors.New("state root mismatch")
var (
ErrStateRootMismatch = errors.New("state root mismatch")

l1VerificatiosProgressCounter = metrics.GetOrCreateCounter(`last_checked_l1_block`)
)

type L1SyncerCfg struct {
db kv.RwDB
Expand Down Expand Up @@ -172,6 +177,9 @@ Loop:
}

latestCheckedBlock := cfg.syncer.GetLastCheckedL1Block()

l1VerificatiosProgressCounter.Set(latestCheckedBlock)

if highestWrittenL1BlockNo > l1BlockProgress {
log.Info(fmt.Sprintf("[%s] Saving L1 syncer progress", logPrefix), "latestCheckedBlock", latestCheckedBlock, "newVerificationsCount", newVerificationsCount, "newSequencesCount", newSequencesCount, "highestWrittenL1BlockNo", highestWrittenL1BlockNo)

Expand Down

0 comments on commit baa3c15

Please sign in to comment.