Skip to content

Commit

Permalink
Merge pull request #14 from base-org/improve-logging
Browse files Browse the repository at this point in the history
Log backfill complete when hit genesis block
  • Loading branch information
danyalprout authored Mar 13, 2024
2 parents 539dd71 + 347362b commit 90de93d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions archiver/service/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,18 @@ func (a *Archiver) persistBlobsForBlockToS3(ctx context.Context, blockIdentifier
func (a *Archiver) backfillBlobs(ctx context.Context, latest *v1.BeaconBlockHeader) {
current, alreadyExists, err := latest, false, error(nil)

defer func() {
a.log.Info("backfill complete", "endHash", current.Root.String(), "startHash", latest.Root.String())
}()

for !alreadyExists {
previous := current

if common.Hash(current.Root) == a.cfg.OriginBlock {
a.log.Info("reached origin block", "hash", current.Root.String())
return
}

previous := current
current, alreadyExists, err = a.persistBlobsForBlockToS3(ctx, previous.Header.Message.ParentRoot.String(), false)
if err != nil {
a.log.Error("failed to persist blobs for block, will retry", "err", err, "hash", previous.Header.Message.ParentRoot.String())
Expand All @@ -157,8 +162,6 @@ func (a *Archiver) backfillBlobs(ctx context.Context, latest *v1.BeaconBlockHead
a.metrics.RecordProcessedBlock(metrics.BlockSourceBackfill)
}
}

a.log.Info("backfill complete", "endHash", current.Root.String(), "startHash", latest.Root.String())
}

// trackLatestBlocks will poll the beacon node for the latest blocks and persist blobs for them.
Expand Down

0 comments on commit 90de93d

Please sign in to comment.