Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func init() {

rootCmd.PersistentFlags().Bool("debug", false, `"true" or "false"`)
rootCmd.PersistentFlags().StringP("chain", "c", "mainnet", "The chain to use (mainnet, holesky, preprod")
rootCmd.PersistentFlags().Bool(config.IsL2, false, `"true" if this is an L2 network (like Base), "false" for L1 (like Ethereum mainnet)`)

rootCmd.PersistentFlags().String("ethereum.rpc-url", "", `e.g. "http://<hostname>:8545"`)
rootCmd.PersistentFlags().Int(config.EthereumRpcContractCallBatchSize, 25, `The number of contract calls to batch together when fetching data from the Ethereum node`)
Expand Down
3 changes: 3 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ type Config struct {
RestoreSnapshotConfig RestoreSnapshotConfig
RpcConfig RpcConfig
Chain Chain
IsL2 bool // Whether this is an L2 network (true) or L1 (false)
Rewards RewardsConfig
DataDogConfig DataDogConfig
PrometheusConfig PrometheusConfig
Expand Down Expand Up @@ -180,6 +181,7 @@ func StringWithDefaults(values ...string) string {

var (
Debug = "debug"
IsL2 = "is-l2"
DatabaseHost = "database.host"
DatabasePort = "database.port"
DatabaseUser = "database.user"
Expand Down Expand Up @@ -242,6 +244,7 @@ func NewConfig() *Config {
return &Config{
Debug: viper.GetBool(normalizeFlagName("debug")),
Chain: Chain(StringWithDefault(viper.GetString(normalizeFlagName("chain")), "holesky")),
IsL2: viper.GetBool(normalizeFlagName(IsL2)),

EthereumRpcConfig: EthereumRpcConfig{
BaseUrl: viper.GetString(normalizeFlagName(EthereumRpcBaseUrl)),
Expand Down
11 changes: 6 additions & 5 deletions pkg/contractCaller/sequentialContractCaller/contractCaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ package sequentialContractCaller

import (
"context"
"math/big"
"regexp"
"strings"
"sync"
"time"

"github.com/Layr-Labs/eigenlayer-contracts/pkg/bindings/IRewardsCoordinator"
"github.com/Layr-Labs/eigenlayer-rewards-proofs/pkg/chainClient"
"github.com/Layr-Labs/eigenlayer-rewards-proofs/pkg/services"
Expand All @@ -13,11 +19,6 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"go.uber.org/zap"
"math/big"
"regexp"
"strings"
"sync"
"time"
)

type SequentialContractCaller struct {
Expand Down
6 changes: 4 additions & 2 deletions pkg/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ func (p *Pipeline) RunForFetchedBlock(ctx context.Context, block *fetcher.Fetche
zap.Int64("indexTime", time.Since(blockFetchTime).Milliseconds()),
)

if block.Block.Number.Value()%3600 == 0 {
// Only process OperatorRestakedStrategies for L1 networks (not L2s like Base)
if block.Block.Number.Value()%3600 == 0 && !p.globalConfig.IsL2 {
p.Logger.Sugar().Infow("Indexing OperatorRestakedStrategies", zap.Uint64("blockNumber", block.Block.Number.Value()))
if err := p.Indexer.ProcessRestakedStrategiesForBlock(ctx, block.Block.Number.Value()); err != nil {
p.Logger.Sugar().Errorw("Failed to process restaked strategies", zap.Uint64("blockNumber", block.Block.Number.Value()), zap.Error(err))
Expand Down Expand Up @@ -375,7 +376,8 @@ func (p *Pipeline) RunForFetchedBlock(ctx context.Context, block *fetcher.Fetche
p.Logger.Sugar().Debugw("Checking for rewards to validate", zap.Uint64("blockNumber", blockNumber))

distributionRoots, err := p.stateManager.GetSubmittedDistributionRoots(blockNumber)
if err == nil && distributionRoots != nil {
// Only validate rewards for L1 networks (not L2s like Base) where RewardsCoordinator contracts exist
if err == nil && distributionRoots != nil && !p.globalConfig.IsL2 {
for _, rs := range distributionRoots {

rewardStartTime := time.Now()
Expand Down
5 changes: 3 additions & 2 deletions pkg/sidecar/blockIndexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package sidecar
import (
"context"
"fmt"
ddTracer "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"
"sync/atomic"
"time"

ddTracer "gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer"

"github.com/Layr-Labs/sidecar/internal/config"

"github.com/syndtr/goleveldb/leveldb/errors"
Expand Down Expand Up @@ -37,7 +38,7 @@ func (s *Sidecar) StartIndexing(ctx context.Context) {
}
}

const BLOCK_POLL_INTERVAL = 6 * time.Second
const BLOCK_POLL_INTERVAL = 100 * time.Millisecond

func (s *Sidecar) ProcessNewBlocks(ctx context.Context) error {
blockType := s.GlobalConfig.GetBlockType()
Expand Down