Skip to content

Commit

Permalink
Fix config
Browse files Browse the repository at this point in the history
  • Loading branch information
pschork committed Oct 1, 2024
1 parent 9d1d5eb commit 5a3f2e2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
15 changes: 11 additions & 4 deletions common/geth/cli.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package geth

import (
"fmt"

"github.com/Layr-Labs/eigenda/common"
"github.com/urfave/cli"
)
Expand Down Expand Up @@ -65,10 +67,12 @@ func ReadEthClientConfig(ctx *cli.Context) EthClientConfig {
cfg.NumConfirmations = ctx.GlobalInt(numConfirmationsFlagName)
cfg.NumRetries = ctx.GlobalInt(numRetriesFlagName)

fallbackRPCURL := ctx.GlobalStringSlice(rpcFallbackUrlFlagName)
fallbackRPCURL := ctx.GlobalString(rpcFallbackUrlFlagName)
fmt.Println("FALLBACK_URL", fallbackRPCURL)
if len(fallbackRPCURL) > 0 {
cfg.RPCURLs = append(cfg.RPCURLs, fallbackRPCURL...)
cfg.RPCURLs = append(cfg.RPCURLs, []string{fallbackRPCURL}...)
}
fmt.Println("RPCURLS", cfg.RPCURLs)

return cfg
}
Expand All @@ -81,9 +85,12 @@ func ReadEthClientConfigRPCOnly(ctx *cli.Context) EthClientConfig {
cfg.NumConfirmations = ctx.GlobalInt(numConfirmationsFlagName)
cfg.NumRetries = ctx.GlobalInt(numRetriesFlagName)

fallbackRPCURL := ctx.GlobalStringSlice(rpcFallbackUrlFlagName)
fallbackRPCURL := ctx.GlobalString(rpcFallbackUrlFlagName)
fmt.Println("FALLBACK_URL", fallbackRPCURL)
if len(fallbackRPCURL) > 0 {
cfg.RPCURLs = append(cfg.RPCURLs, fallbackRPCURL...)
cfg.RPCURLs = append(cfg.RPCURLs, []string{fallbackRPCURL}...)
}
fmt.Println("RPCURLS", cfg.RPCURLs)

return cfg
}
4 changes: 4 additions & 0 deletions common/geth/multihoming_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ var _ dacommon.EthClient = (*MultiHomingClient)(nil)
func NewMultiHomingClient(config EthClientConfig, senderAddress gethcommon.Address, logger logging.Logger) (*MultiHomingClient, error) {
rpcUrls := config.RPCURLs

if len(config.RPCURLs) > 1 {
logger.Info("Fallback chain RPC enabled")
}

FailoverController, err := NewFailoverController(logger, rpcUrls)
if err != nil {
return nil, err
Expand Down
4 changes: 0 additions & 4 deletions disperser/cmd/apiserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ func RunDisperserServer(ctx *cli.Context) error {
return err
}

if len(config.EthClientConfig.RPCURLs) > 1 {
logger.Info("Fallback chain RPC enabled")
}

client, err := geth.NewMultiHomingClient(config.EthClientConfig, gethcommon.Address{}, logger)
if err != nil {
logger.Error("Cannot create chain.Client", "err", err)
Expand Down
6 changes: 0 additions & 6 deletions disperser/cmd/batcher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,12 @@ func RunBatcher(ctx *cli.Context) error {
if err != nil {
return fmt.Errorf("failed to get public key from KMS: %w", err)
}

if len(config.EthClientConfig.RPCURLs) > 1 {
logger.Info("Fallback chain RPC enabled")
}

addr := crypto.PubkeyToAddress(*pubKey)
client, err = geth.NewMultiHomingClient(config.EthClientConfig, addr, logger)
if err != nil {
logger.Error("Cannot create chain.Client", "err", err)
return err
}

chainID, err := client.ChainID(context.Background())
if err != nil {
return fmt.Errorf("failed to get chain ID: %w", err)
Expand Down
4 changes: 0 additions & 4 deletions disperser/cmd/dataapi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ func RunDataApi(ctx *cli.Context) error {
logger.Info("Enabled metrics for Data Access API", "socket", httpSocket)
}

if len(config.EthClientConfig.RPCURLs) > 1 {
logger.Info("Fallback chain RPC enabled")
}

// Setup channel to listen for termination signals
quit := make(chan os.Signal, 1)
// catch SIGINT (Ctrl+C) and SIGTERM (e.g., from `kill`)
Expand Down

0 comments on commit 5a3f2e2

Please sign in to comment.