Skip to content

Commit

Permalink
bridge daemon does not require eth rpc endpoint flag and panics on st…
Browse files Browse the repository at this point in the history
…artup if flag is not set (#725)
  • Loading branch information
tqin7 authored Oct 30, 2023
1 parent 8261625 commit 17e3c37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 6 additions & 2 deletions protocol/daemons/bridge/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/dydxprotocol/v4-chain/protocol/daemons/bridge/api"
"github.com/dydxprotocol/v4-chain/protocol/daemons/bridge/client/types"
"github.com/dydxprotocol/v4-chain/protocol/daemons/constants"
"github.com/dydxprotocol/v4-chain/protocol/daemons/flags"
daemonflags "github.com/dydxprotocol/v4-chain/protocol/daemons/flags"
daemontypes "github.com/dydxprotocol/v4-chain/protocol/daemons/types"
libeth "github.com/dydxprotocol/v4-chain/protocol/lib/eth"
"github.com/dydxprotocol/v4-chain/protocol/lib/metrics"
Expand All @@ -26,7 +26,7 @@ import (
// Start begins a job that periodically runs the RunBridgeDaemonTaskLoop function.
func Start(
ctx context.Context,
flags flags.DaemonFlags,
flags daemonflags.DaemonFlags,
appFlags appflags.Flags,
logger log.Logger,
grpcClient daemontypes.GrpcClient,
Expand All @@ -36,6 +36,10 @@ func Start(
"Starting bridge daemon with flags",
"BridgeFlags", flags.Bridge,
)
// Panic if EthRpcEndpoint is empty.
if flags.Bridge.EthRpcEndpoint == "" {
return fmt.Errorf("flag %s is not set", daemonflags.FlagBridgeDaemonEthRpcEndpoint)
}

// Make a connection to the Cosmos gRPC query services.
queryConn, err := grpcClient.NewTcpConnection(ctx, appFlags.GrpcAddress)
Expand Down
4 changes: 0 additions & 4 deletions protocol/daemons/flags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ func AddDaemonFlagsToCmd(
df.Bridge.EthRpcEndpoint,
"Ethereum Node Rpc Endpoint",
)
// Require bridge daemon eth RPC endpoint flag.
if err := cmd.MarkFlagRequired(FlagBridgeDaemonEthRpcEndpoint); err != nil {
panic(err)
}

// Liquidation Daemon.
cmd.Flags().Bool(
Expand Down

0 comments on commit 17e3c37

Please sign in to comment.