diff --git a/relayer/chains/icon/icon_chain_processor.go b/relayer/chains/icon/icon_chain_processor.go index fa992af9d..cc2be0940 100644 --- a/relayer/chains/icon/icon_chain_processor.go +++ b/relayer/chains/icon/icon_chain_processor.go @@ -296,8 +296,6 @@ func (icp *IconChainProcessor) monitoring(ctx context.Context, persistence *quer ctxMonitorBlock, cancelMonitorBlock := context.WithCancel(ctx) reconnect() - ibcHeaderCache := make(processor.IBCHeaderCache) - icp.firstTime = true blockReq := &types.BlockRequest{ @@ -368,6 +366,7 @@ loop: icp.handleMessage(ctx, *m, ibcMessageCache) } + ibcHeaderCache := make(processor.IBCHeaderCache) ibcHeaderCache[uint64(br.Height)] = br.Header icp.log.Debug("Queried block ", zap.Int64("height", br.Height)) diff --git a/relayer/chains/wasm/wasm_chain_processor.go b/relayer/chains/wasm/wasm_chain_processor.go index 6b31871c4..a06a221f8 100644 --- a/relayer/chains/wasm/wasm_chain_processor.go +++ b/relayer/chains/wasm/wasm_chain_processor.go @@ -416,6 +416,7 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer var eg errgroup.Group var blockRes *ctypes.ResultBlockResults var lightBlock *types.LightBlock + var h provider.IBCHeader i := i eg.Go(func() (err error) { queryCtx, cancelQueryCtx := context.WithTimeout(ctx, blockResultsQueryTimeout) @@ -426,7 +427,7 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer eg.Go(func() (err error) { queryCtx, cancelQueryCtx := context.WithTimeout(ctx, queryTimeout) defer cancelQueryCtx() - latestHeader, lightBlock, err = ccp.chainProvider.QueryLightBlock(queryCtx, i) + h, lightBlock, err = ccp.chainProvider.QueryLightBlock(queryCtx, i) return err }) @@ -435,6 +436,15 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer break } + ccp.log.Debug( + "Queried block", + zap.Int64("height", i), + zap.Int64("latest", persistence.latestHeight), + zap.Int64("delta", persistence.latestHeight-i), + ) + + latestHeader = h + if err := ccp.Verify(ctx, lightBlock); err != nil { ccp.log.Warn("Failed to verify block", zap.Int64("height", blockRes.Height), zap.Error(err)) return err @@ -550,7 +560,7 @@ func (ccp *WasmChainProcessor) Verify(ctx context.Context, untrusted *types.Ligh untrusted.ValidatorSet, ccp.verifier.Header.SignedHeader, time.Now(), 0); err != nil { - return fmt.Errorf("Failed to verify Header: %v", err) + return fmt.Errorf("failed to verify Header: %v", err) } if !bytes.Equal(untrusted.Header.ValidatorsHash, ccp.verifier.Header.NextValidatorsHash) { diff --git a/relayer/processor/message_processor.go b/relayer/processor/message_processor.go index cd5bb40c7..645eee8c3 100644 --- a/relayer/processor/message_processor.go +++ b/relayer/processor/message_processor.go @@ -439,9 +439,12 @@ func (mp *messageProcessor) sendClientUpdate( msgs := []provider.RelayerMessage{mp.msgUpdateClient} callback := func(rtr *provider.RelayerTxResponse, err error) { - mp.log.Debug("Executing callback of sendClientUpdate", - zap.Any("response", rtr), - zap.Uint64("last_client_update_height", dst.lastClientUpdateHeight)) + if rtr != nil { + mp.log.Debug("Executing callback of sendClientUpdate", + zap.Any("response", rtr), + zap.Uint64("last_client_update_height", dst.lastClientUpdateHeight), + zap.Error(err)) + } if IsBTPLightClient(dst.clientState) { if src.BTPHeightQueue.Size() == 0 { return @@ -484,6 +487,7 @@ func (mp *messageProcessor) sendClientUpdate( zap.String("dst_client_id", dst.info.ClientID), zap.Error(err), ) + callback(nil, err) return } dst.log.Debug("Client update broadcast completed")