cosmos / interchain-security

Interchain Security is an open sourced IBC application which allows cosmos blockchains to lease their proof-of-stake security to one another.
https://cosmos.github.io/interchain-security/
Other
156 stars 126 forks source link

Transfer channel is not opened between consumer and provider chain #294

Closed stana-miric closed 2 years ago

stana-miric commented 2 years ago

During opening a channel between consumer and provider, in the consumer module in OnChanOpenAck function there is a code for initialization of a transfer channel used for the rewards that should be sent to the provider chain. The problem here is that only ChannelOpenInit is called, and transfer channel stays in INIT state (the handshake is never completed). The consumer module uses this channel to send a reward to the provider chain, but an error occurs with the following message: "packet failed basic validation: invalid destination channel ID: identifier cannot be blank: invalid identifier" This causes consumer chain halting.

mpoke commented 2 years ago

The problem here is that only ChannelOpenInit is called, and transfer channel stays in INIT state (the handshake is never completed).

A relayer should complete the handshake.

The ibcTransferKeeper.SendTransfer will not fail even if the channel is not OPEN yet (due to optimistic sends). However, the packets cannot be received by the destination chain before the channel is OPEN, see https://github.com/cosmos/ibc-go/blob/05c4bfbbebb20d1cc078ddf1d29dadc766d9251b/modules/core/04-channel/keeper/packet.go#L148

stana-miric commented 2 years ago

We got error in this line, and after debugging saw that destinationPort is not set, and later when it try to send packet it fails the basic validation because the counterparty port is not set. Also, we saw that the channel state at that moment was init.

Is there a way to ensure that relayer will finish the handshake, because in our case this does not happen? Should we call something on relayer explicitly, except creating a connection between consumer and provider chains and opening a channel between provider and consumer ports?

mpoke commented 2 years ago

To make it easier, we should assume that optimistic sends are not supported. This means that we should check here whether the transfer channel is open. If it's not, just exit the function.

jtremback commented 2 years ago

Closed by https://github.com/cosmos/interchain-security/pull/322, right @stana-ethernal ?

stana-miric commented 2 years ago

Closed by #322, right @stana-ethernal ?

yes