diff --git a/relayer/chains/icon/icon_chain_processor.go b/relayer/chains/icon/icon_chain_processor.go index 1ce251ebe..fa992af9d 100644 --- a/relayer/chains/icon/icon_chain_processor.go +++ b/relayer/chains/icon/icon_chain_processor.go @@ -497,7 +497,7 @@ func (icp *IconChainProcessor) SnapshotHeight(height int64) { func (icp *IconChainProcessor) verifyBlock(ctx context.Context, ibcHeader provider.IBCHeader) error { header, ok := ibcHeader.(IconIBCHeader) if !ok { - return fmt.Errorf("Provided Header is not compatible with IBCHeader") + return fmt.Errorf("provided header is not compatible with IBCHeader") } if icp.firstTime { proofContext, err := icp.chainProvider.GetProofContextByHeight(int64(header.MainHeight) - 1) @@ -666,6 +666,13 @@ func (icp *IconChainProcessor) handlePathProcessorUpdate(ctx context.Context, ibcHeaderCache processor.IBCHeaderCache) error { chainID := icp.chainProvider.ChainId() + latestHeight, _ := icp.chainProvider.QueryLatestHeight(ctx) + + inSync := false + + if latestHeight != 0 && uint64(latestHeight)-latestHeader.Height() < 3 { + inSync = true + } for _, pp := range icp.pathProcessors { clientID := pp.RelevantClientID(chainID) @@ -682,7 +689,7 @@ func (icp *IconChainProcessor) handlePathProcessorUpdate(ctx context.Context, LatestBlock: icp.latestBlock, LatestHeader: latestHeader, IBCMessagesCache: messageCache, - InSync: true, + InSync: inSync, ClientState: clientState, ConnectionStateCache: icp.connectionStateCache.FilterForClient(clientID), ChannelStateCache: icp.channelStateCache.FilterForClient(clientID, icp.channelConnections, icp.connectionClients), diff --git a/relayer/chains/icon/provider.go b/relayer/chains/icon/provider.go index 45500d536..8cb9aed26 100644 --- a/relayer/chains/icon/provider.go +++ b/relayer/chains/icon/provider.go @@ -288,10 +288,10 @@ func (icp *IconProvider) ChannelProof(ctx context.Context, msg provider.ChannelI func (icp *IconProvider) ValidatePacket(msgTransfer provider.PacketInfo, latestBlock provider.LatestBlock) error { if msgTransfer.Sequence <= 0 { - return fmt.Errorf("Refuse to relay packet with sequence 0") + return fmt.Errorf("refuse to relay packet with sequence 0") } if len(msgTransfer.Data) == 0 { - return fmt.Errorf("Refuse to relay packet with empty data") + return fmt.Errorf("refuse to relay packet with empty data") } // This should not be possible, as it violates IBC spec if msgTransfer.TimeoutHeight.IsZero() { diff --git a/relayer/chains/icon/query.go b/relayer/chains/icon/query.go index 20b67b911..c5660fe8f 100644 --- a/relayer/chains/icon/query.go +++ b/relayer/chains/icon/query.go @@ -778,7 +778,7 @@ func (icp *IconProvider) QueryPacketReceipt(ctx context.Context, height int64, c return nil, err } - keyhash := common.Sha3keccak256(common.GetPacketReceiptCommitmentPath(portid, channelid, big.NewInt(height))) + keyhash := common.Sha3keccak256(common.GetPacketReceiptCommitmentKey(portid, channelid, big.NewInt(height))) proof, err := icp.QueryIconProof(ctx, height, keyhash) if err != nil {