Skip to content

Commit

Permalink
fix node build
Browse files Browse the repository at this point in the history
  • Loading branch information
dmanc committed May 3, 2024
1 parent a0260d7 commit 2533f74
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
33 changes: 18 additions & 15 deletions node/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ import (
"time"

"github.com/Layr-Labs/eigenda/common/pubip"
"github.com/Layr-Labs/eigenda/common/ratelimit"
"github.com/Layr-Labs/eigenda/common/store"
"github.com/prometheus/client_golang/prometheus"

"github.com/urfave/cli"

"github.com/Layr-Labs/eigenda/common"
"github.com/Layr-Labs/eigenda/common/ratelimit"
"github.com/Layr-Labs/eigenda/common/store"
"github.com/Layr-Labs/eigenda/node"
"github.com/Layr-Labs/eigenda/node/flags"
"github.com/Layr-Labs/eigenda/node/grpc"
Expand Down Expand Up @@ -56,18 +57,8 @@ func NodeMain(ctx *cli.Context) error {

pubIPProvider := pubip.ProviderOrDefault(config.PubIPProvider)

// Create the node.
node, err := node.NewNode(config, pubIPProvider, logger)
if err != nil {
return err
}

err = node.Start(context.Background())
if err != nil {
node.Logger.Error("could not start node", "error", err)
return err
}

// Rate limiter
reg := prometheus.NewRegistry()
globalParams := common.GlobalRateParams{
BucketSizes: []time.Duration{bucketDuration},
Multipliers: []float32{bucketMultiplier},
Expand All @@ -79,7 +70,19 @@ func NodeMain(ctx *cli.Context) error {
return err
}

ratelimiter := ratelimit.NewRateLimiter(globalParams, bucketStore, logger)
ratelimiter := ratelimit.NewRateLimiter(reg, globalParams, bucketStore, logger)

// Create the node.
node, err := node.NewNode(reg, config, pubIPProvider, logger)
if err != nil {
return err
}

err = node.Start(context.Background())
if err != nil {
node.Logger.Error("could not start node", "error", err)
return err
}

// Creates the GRPC server.
server := grpc.NewServer(config, node, logger, ratelimiter)
Expand Down
9 changes: 4 additions & 5 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,15 @@ type Node struct {
}

// NewNode creates a new Node with the provided config.
func NewNode(config *Config, pubIPProvider pubip.Provider, logger logging.Logger) (*Node, error) {
func NewNode(reg *prometheus.Registry, config *Config, pubIPProvider pubip.Provider, logger logging.Logger) (*Node, error) {
// Setup metrics
// sdkClients, err := buildSdkClients(config, logger)
// if err != nil {
// return nil, err
// }

promReg := prometheus.NewRegistry()
eigenMetrics := metrics.NewEigenMetrics(AppName, ":"+config.MetricsPort, promReg, logger.With("component", "EigenMetrics"))
rpcCallsCollector := rpccalls.NewCollector(AppName, promReg)
eigenMetrics := metrics.NewEigenMetrics(AppName, ":"+config.MetricsPort, reg, logger.With("component", "EigenMetrics"))
rpcCallsCollector := rpccalls.NewCollector(AppName, reg)

// Generate BLS keys
keyPair, err := core.MakeKeyPairFromString(config.PrivateBls)
Expand Down Expand Up @@ -108,7 +107,7 @@ func NewNode(config *Config, pubIPProvider pubip.Provider, logger logging.Logger
// Setup Node Api
nodeApi := nodeapi.NewNodeApi(AppName, SemVer, ":"+config.NodeApiPort, logger.With("component", "NodeApi"))

metrics := NewMetrics(eigenMetrics, promReg, logger, ":"+config.MetricsPort, config.ID, config.OnchainMetricsInterval, tx, cst)
metrics := NewMetrics(eigenMetrics, reg, logger, ":"+config.MetricsPort, config.ID, config.OnchainMetricsInterval, tx, cst)

// Make validator
v, err := verifier.NewVerifier(&config.EncoderConfig, false)
Expand Down

0 comments on commit 2533f74

Please sign in to comment.