From de60ca0624a0fb01abcc77e82c494eefbb463787 Mon Sep 17 00:00:00 2001 From: nkitlabs Date: Thu, 2 Jan 2025 11:49:13 +0700 Subject: [PATCH] fix comment and error message --- relayer/app.go | 18 +++++++++--------- relayer/band/client.go | 12 ++++++------ relayer/scheduler.go | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/relayer/app.go b/relayer/app.go index 411e5c6..8299605 100644 --- a/relayer/app.go +++ b/relayer/app.go @@ -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 { @@ -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 } @@ -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 @@ -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") @@ -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) @@ -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 diff --git a/relayer/band/client.go b/relayer/band/client.go index c06e1fe..05d5043 100644 --- a/relayer/band/client.go +++ b/relayer/band/client.go @@ -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) } @@ -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 { @@ -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 @@ -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) diff --git a/relayer/scheduler.go b/relayer/scheduler.go index 1b9ac4e..422b074 100644 --- a/relayer/scheduler.go +++ b/relayer/scheduler.go @@ -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)