Skip to content

Commit

Permalink
make fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
iStrike7 committed Dec 30, 2024
1 parent 35fdb07 commit fabcf20
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 12 deletions.
1 change: 0 additions & 1 deletion chainio/clients/avsregistry/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,3 @@ func (r *ChainReader) BlockNumber(
}
return curBlockNum, nil
}

46 changes: 35 additions & 11 deletions services/operatorsinfo/operatorsinfo_inmemory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package operatorsinfo
import (
"context"
"errors"
"fmt"
"math/big"
"sync"
"fmt"
"time"

blsapkreg "github.com/Layr-Labs/eigensdk-go/contracts/bindings/BLSApkRegistry"
Expand Down Expand Up @@ -35,10 +35,10 @@ type avsRegistryReader interface {
stopBlock *big.Int,
blockRange *big.Int,
) ([]types.OperatorAddr, []types.OperatorPubkeys, error)

BlockNumber(
ctx context.Context,
) (uint64, error)
) (uint64, error)
}

type avsRegistrySubscriber interface {
Expand Down Expand Up @@ -218,15 +218,21 @@ func (ops *OperatorsInfoServiceInMemory) startServiceInGoroutine(
if err != nil {
err = fmt.Errorf("BlockNumber failed: %w", err)
}
if err == nil{
if err == nil {
if curBlock < lookBackBlocks {
startBlock = 0
} else {
startBlock = curBlock - lookBackBlocks
}
// TODO
// This is duplicated. Solve this correctly maybe?
err = ops.queryPastRegisteredOperatorEventsAndFillDb(ctx, Opts{StartBlock:new(big.Int).SetUint64(startBlock), StopBlock:new(big.Int).SetUint64(curBlock)})
err = ops.queryPastRegisteredOperatorEventsAndFillDb(
ctx,
Opts{
StartBlock: new(big.Int).SetUint64(startBlock),
StopBlock: new(big.Int).SetUint64(curBlock),
},
)
if err != nil {
err = fmt.Errorf("queryPastRegisteredOperatorEventsAndFillDb failed: %w", err)
}
Expand All @@ -235,8 +241,14 @@ func (ops *OperatorsInfoServiceInMemory) startServiceInGoroutine(
}
}
}

ops.logger.Error("Failed to SubscribeToNewPubkeyRegistrations, retrying...", "err", err, "attempt", attempt+1)

ops.logger.Error(
"Failed to SubscribeToNewPubkeyRegistrations, retrying...",
"err",
err,
"attempt",
attempt+1,
)
select {
case <-ctx.Done():
ops.logger.Debugf("OperatorPubkeysServiceInMemory: Context cancelled, exiting, %v", ctx.Err())
Expand Down Expand Up @@ -283,15 +295,21 @@ func (ops *OperatorsInfoServiceInMemory) startServiceInGoroutine(
if err != nil {
err = fmt.Errorf("BlockNumber failed: %w", err)
}
if err == nil{
if err == nil {
if curBlock < lookBackBlocks {
startBlock = 0
} else {
startBlock = curBlock - lookBackBlocks
}
// TODO
// This is duplicated. Solve this correctly maybe?
err = ops.queryPastRegisteredOperatorEventsAndFillDb(ctx, Opts{StartBlock:new(big.Int).SetUint64(startBlock), StopBlock:new(big.Int).SetUint64(curBlock)})
err = ops.queryPastRegisteredOperatorEventsAndFillDb(
ctx,
Opts{
StartBlock: new(big.Int).SetUint64(startBlock),
StopBlock: new(big.Int).SetUint64(curBlock),
},
)
if err != nil {
err = fmt.Errorf("queryPastRegisteredOperatorEventsAndFillDb failed: %w", err)
}
Expand All @@ -300,8 +318,14 @@ func (ops *OperatorsInfoServiceInMemory) startServiceInGoroutine(
}
}
}

ops.logger.Error("Failed to SubscribeToOperatorSocketUpdates, retrying...", "err", err, "attempt", attempt+1)

ops.logger.Error(
"Failed to SubscribeToOperatorSocketUpdates, retrying...",
"err",
err,
"attempt",
attempt+1,
)
select {
case <-ctx.Done():
ops.logger.Debugf("OperatorPubkeysServiceInMemory: Context cancelled, exiting, %v", ctx.Err())
Expand Down

0 comments on commit fabcf20

Please sign in to comment.