Skip to content

Commit

Permalink
Merge branch 'main' into feat/nil-pointer-during-update-188
Browse files Browse the repository at this point in the history
  • Loading branch information
viveksharmapoudel authored Nov 24, 2023
2 parents 7dd2224 + bb0a2e4 commit 26ed87b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
11 changes: 9 additions & 2 deletions relayer/chains/icon/icon_chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,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)
Expand Down Expand Up @@ -665,6 +665,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)
Expand All @@ -681,7 +688,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),
Expand Down
4 changes: 2 additions & 2 deletions relayer/chains/icon/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions relayer/chains/icon/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (icp *IconProvider) QueryBalanceWithAddress(ctx context.Context, addr strin
}
return sdk.Coins{sdk.Coin{
Denom: "ICX",
Amount: math.NewInt(balance.Int64()),
Amount: math.NewIntFromBigInt(balance),
}}, nil
}

Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions relayer/chains/wasm/wasm_chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,6 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer
persistence.latestHeight = status.SyncInfo.LatestBlockHeight
// ccp.chainProvider.setCometVersion(ccp.log, status.NodeInfo.Version)

ccp.log.Debug("Queried latest height",
zap.Int64("latest_height", persistence.latestHeight),
)

if ccp.metrics != nil {
ccp.CollectMetrics(ctx, persistence)
}
Expand Down

0 comments on commit 26ed87b

Please sign in to comment.