Skip to content

Commit

Permalink
minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
danyalprout committed Feb 20, 2024
1 parent 044d543 commit d99f0f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 9 additions & 0 deletions archiver/service/archiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strconv"
"time"

client "github.com/attestantio/go-eth2-client"
"github.com/attestantio/go-eth2-client/api"
v1 "github.com/attestantio/go-eth2-client/api/v1"
"github.com/base-org/blob-archiver/archiver/flags"
Expand All @@ -23,6 +24,11 @@ const (
backfillErrorRetryInterval = 5 * time.Second
)

type BeaconClient interface {
client.BlobSidecarsProvider
client.BeaconBlockHeadersProvider
}

func NewArchiver(l log.Logger, cfg flags.ArchiverConfig, dataStoreClient storage.DataStore, client BeaconClient, m metrics.Metricer) (*Archiver, error) {
return &Archiver{
log: l,
Expand Down Expand Up @@ -208,6 +214,9 @@ func (a *Archiver) processBlocksUntilKnownBlock(ctx context.Context) {
a.log.Info("live data refreshed", "startHash", start.Root.String(), "endHash", currentBlockId)
}

// rearchiveRange will rearchive all blocks in the range from the given start to end. It returns the start and end of the
// range that was successfully rearchived. On any persistent errors, it will halt archiving and return the range of blocks
// that were rearchived and the error that halted the process.
func (a *Archiver) rearchiveRange(from uint64, to uint64) (uint64, uint64, error) {
for i := from; i <= to; i++ {
id := strconv.FormatUint(i, 10)
Expand Down
6 changes: 0 additions & 6 deletions archiver/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"sync/atomic"

client "github.com/attestantio/go-eth2-client"
"github.com/base-org/blob-archiver/archiver/flags"
"github.com/base-org/blob-archiver/archiver/metrics"
"github.com/ethereum-optimism/optimism/op-service/httputil"
Expand All @@ -16,11 +15,6 @@ import (

var ErrAlreadyStopped = errors.New("already stopped")

type BeaconClient interface {
client.BlobSidecarsProvider
client.BeaconBlockHeadersProvider
}

func NewService(l log.Logger, cfg flags.ArchiverConfig, api *API, archiver *Archiver, m metrics.Metricer) (*ArchiverService, error) {
return &ArchiverService{
log: l,
Expand Down

0 comments on commit d99f0f4

Please sign in to comment.