Skip to content

Commit

Permalink
fix comment and error message
Browse files Browse the repository at this point in the history
  • Loading branch information
nkitlabs committed Jan 2, 2025
1 parent ebac0ba commit de60ca0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions relayer/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func NewApp(
return &app
}

// Initialize the application.
// Init initialize the application.
func (a *App) Init(ctx context.Context) error {
if a.Config == nil {
if err := a.LoadConfigFile(); err != nil {
Expand All @@ -83,12 +83,12 @@ func (a *App) Init(ctx context.Context) error {
return nil
}

// initialize target chain clients.
// initialize target chain clients
if err := a.initTargetChains(); err != nil {
return err
}

// initialize band chain client
// initialize BandChain client
if err := a.initBandClient(); err != nil {
return err
}
Expand All @@ -100,7 +100,7 @@ func (a *App) Init(ctx context.Context) error {
func (a *App) initBandClient() error {
a.BandClient = band.NewClient(cosmosclient.Context{}, nil, a.Log, a.Config.BandChain.RpcEndpoints)

// connect to band chain, if error occurs, log the error as debug and continue
// connect to BandChain, if error occurs, log the error as debug and continue
if err := a.BandClient.Connect(uint(a.Config.BandChain.Timeout)); err != nil {
a.Log.Error("Cannot connect to BandChain", zap.Error(err))
return err
Expand All @@ -109,13 +109,13 @@ func (a *App) initBandClient() error {
return nil
}

// InitLogger initializes the logger with the given log level.
// initLogger initializes the logger with the given log level.
func (a *App) initLogger(configLogLevel string) error {
// Assign log level based on the following priority:
// 1. debug flag
// 2. log-level flag from viper
// 3. log-level from configuration object.
// 4. given log level from the input.
// 3. log-level from configuration object
// 4. given log level from the input
logLevel := configLogLevel
logLevelViper := a.Viper.GetString("log-level")

Expand All @@ -141,7 +141,7 @@ func (a *App) initLogger(configLogLevel string) error {
return nil
}

// InitTargetChains initializes the target chains.
// initTargetChains initializes the target chains.
func (a *App) initTargetChains() error {
a.targetChains = make(chains.ChainProviders)

Expand Down Expand Up @@ -641,7 +641,7 @@ func (a *App) Start(ctx context.Context, tunnelIDs []uint64) error {

// Relay relays the packet from the source chain to the destination chain.
func (a *App) Relay(ctx context.Context, tunnelID uint64) error {
a.Log.Debug("Query tunnel info on band chain", zap.Uint64("tunnel_id", tunnelID))
a.Log.Debug("Query tunnel info on BandChain", zap.Uint64("tunnel_id", tunnelID))
tunnel, err := a.BandClient.GetTunnel(ctx, tunnelID)
if err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions relayer/band/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Client interface {
// Connect will establish connection to rpc endpoints
Connect(timeout uint) error

// GetTunnels returns all tunnel in band chain.
// GetTunnels returns all tunnel in BandChain.
GetTunnels(ctx context.Context) ([]types.Tunnel, error)
}

Expand Down Expand Up @@ -68,7 +68,7 @@ func NewClient(ctx cosmosclient.Context, queryClient *QueryClient, log *zap.Logg
}
}

// Connect connects to the Band chain using the provided RPC endpoints.
// Connect connects to the BandChain using the provided RPC endpoints.
func (c *client) Connect(timeout uint) error {
// Return if there are no RPC endpoints
if len(c.RpcEndpoints) == 0 {
Expand All @@ -93,12 +93,12 @@ func (c *client) Connect(timeout uint) error {
c.Context = ctx
c.QueryClient = NewQueryClient(tunneltypes.NewQueryClient(ctx), bandtsstypes.NewQueryClient(ctx))

c.Log.Info("Connected to Band chain", zap.String("endpoint", rpcEndpoint))
c.Log.Info("Connected to BandChain", zap.String("endpoint", rpcEndpoint))

return nil
}

return fmt.Errorf("failed to connect to Band Chain")
return fmt.Errorf("failed to connect to BandChain")
}

// GetTunnel gets tunnel info from band client
Expand Down Expand Up @@ -194,11 +194,11 @@ func (c *client) GetTunnelPacket(ctx context.Context, tunnelID uint64, sequence
), nil
}

// GetTunnels returns every tss-route tunnels in band chain.
// GetTunnels returns every tss-route tunnels in BandChain.
func (c *client) GetTunnels(ctx context.Context) ([]types.Tunnel, error) {
// check connection to bandchain
if c.QueryClient == nil {
return nil, fmt.Errorf("cannot connect to bandchain")
return nil, fmt.Errorf("cannot connect to BandChain")
}

tunnels := make([]types.Tunnel, 0)
Expand Down
2 changes: 1 addition & 1 deletion relayer/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (s *Scheduler) SyncTunnels(ctx context.Context) {
s.Log.Info("Start syncing new tunnels")
tunnels, err := s.BandClient.GetTunnels(ctx)
if err != nil {
s.Log.Error("Failed to fetch tunnels from Band Chain", zap.Error(err))
s.Log.Error("Failed to fetch tunnels from BandChain", zap.Error(err))
return
}
oldTunnelCount := len(s.TunnelRelayers)
Expand Down

0 comments on commit de60ca0

Please sign in to comment.