Skip to content

Commit

Permalink
fix(logging): displays correct chain info when query IBC header fails (
Browse files Browse the repository at this point in the history
  • Loading branch information
AntiTyping authored Mar 14, 2024
1 parent c4eac28 commit 04a0df5
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions relayer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,9 @@ func MsgUpdateClient(
dstClientState, err = dst.ChainProvider.QueryClientState(ctx, dsth, dst.ClientID())
return err
}, retry.Context(ctx), RtyAtt, RtyDel, RtyErr, retry.OnRetry(func(n uint, err error) {
dst.log.Info(
dst.log.Error(
"Failed to query client state when updating clients",
zap.String("chain_id", dst.ChainID()),
zap.String("client_id", dst.ClientID()),
zap.Uint("attempt", n+1),
zap.Uint("max_attempts", RtyAttNum),
Expand All @@ -301,12 +302,20 @@ func MsgUpdateClient(
eg.Go(func() error {
return retry.Do(func() error {
var err error
src.log.Debug(
"Query IBC header",
zap.String("chain_id", src.ChainID()),
zap.String("client_id", src.ClientID()),
zap.Int64("height", srch),
)
srcHeader, err = src.ChainProvider.QueryIBCHeader(egCtx, srch)
return err
}, retry.Context(egCtx), RtyAtt, RtyDel, RtyErr, retry.OnRetry(func(n uint, err error) {
src.log.Info(
src.log.Error(
"Failed to query IBC header when building update client message",
zap.String("client_id", dst.ClientID()),
zap.String("chain_id", src.ChainID()),
zap.String("client_id", src.ClientID()),
zap.Int64("height", srch),
zap.Uint("attempt", n+1),
zap.Uint("max_attempts", RtyAttNum),
zap.Error(err),
Expand All @@ -316,12 +325,20 @@ func MsgUpdateClient(
eg.Go(func() error {
return retry.Do(func() error {
var err error
src.log.Debug(
"Query IBC header",
zap.String("chain_id", src.ChainID()),
zap.String("client_id", src.ClientID()),
zap.Int64("height", int64(dstClientState.GetLatestHeight().GetRevisionHeight())+1),
)
dstTrustedHeader, err = src.ChainProvider.QueryIBCHeader(egCtx, int64(dstClientState.GetLatestHeight().GetRevisionHeight())+1)
return err
}, retry.Context(egCtx), RtyAtt, RtyDel, RtyErr, retry.OnRetry(func(n uint, err error) {
src.log.Info(
src.log.Error(
"Failed to query IBC header when building update client message",
zap.String("client_id", dst.ClientID()),
zap.String("chain_id", src.ChainID()),
zap.String("client_id", src.ClientID()),
zap.Int64("height", int64(dstClientState.GetLatestHeight().GetRevisionHeight())+1),
zap.Uint("attempt", n+1),
zap.Uint("max_attempts", RtyAttNum),
zap.Error(err),
Expand Down

0 comments on commit 04a0df5

Please sign in to comment.