ORDERED 或 UNORDERED 通道。
使用 ORDERED 通道时,从控制链向主机链发送数据包时的交易顺序会被保持。
使用 UNORDERED 通道时,从控制链向主机链发送数据包时,不保证交易顺序会被保持。如果在 MsgRegisterInterchainAccount 中未指定排序方式,则新建 ICA 通道的默认排序为 UNORDERED。
使用 ORDERED 通道的一个限制是:当数据包超时时,通道会被关闭。
当通道关闭时,控制链需要能够重新获得对此通道上已注册跨链账户的访问权限。Active Channels 就是为此提供支持的功能。
当使用 MsgRegisterInterchainAccount 注册一个 Interchain Account 时,会在特定端口上创建一个新通道。在 OnChanOpenAck 和 OnChanOpenConfirm 阶段(分别发生在控制链和主机链上),该跨链账户对应的 Active Channel 会被存储到状态中。
如果此前设置的 Active Channel 已处于 CLOSED 状态,则可以使用相同的控制链 portID 创建一个新通道。可以通过发送新的 MsgChannelOpenInit 消息,以编程方式初始化该通道创建,如下所示:
Active Channel 处于 CLOSED 状态,任何 relayer 操作员都可以为该跨链账户发起新的通道握手。具体做法是:在控制链上,使用与该跨链账户关联的相同 portID 发起通道握手。
需要特别注意的是,一旦某个跨链账户已经打开了一个通道,在当前设置的 Active Channel 变为 CLOSED 之前,不能为该账户再打开新的通道。
未来改进
未来版本的 ICS-27 协议和 Interchain Accounts 模块很可能会采用一种新的通道类型:它既能提供数据包顺序保证,又不会在数据包超时时关闭通道,从而彻底消除对Active Channels 的需求。
以下问题列表将提供实现这一目标所需的基础设施:
- IBC 通道升级
- 在 04-channel 中实现
ORDERED_ALLOW_TIMEOUT逻辑 - 在 03-connection 中将
ORDERED_ALLOW_TIMEOUT添加为受支持的排序方式 - 允许 ICA 通道以
ORDERED_ALLOW_TIMEOUT方式打开
The Interchain Accounts module uses either ORDERED or UNORDERED channels. When using
ORDERED channels, the order of transactions when sending packets from a controller to a host chain is maintained.
When using UNORDERED channels, there is no guarantee that the order of transactions when sending packets from the controller to the host chain is maintained. If no ordering is specified in MsgRegisterInterchainAccount, then the default ordering for new ICA channels is UNORDERED.
A limitation when using ORDERED channels is that when a packet times out the channel will be closed.In the case of a channel closing, a controller chain needs to be able to regain access to the interchain account registered on this channel.
Active Channels enable this functionality.
When an Interchain Account is registered using MsgRegisterInterchainAccount, a new channel is created on a particular port. During the OnChanOpenAck and OnChanOpenConfirm steps (on controller & host chain respectively) the Active Channel for this interchain account is stored in state.
It is possible to create a new channel using the same controller chain portID if the previously set Active Channel is now in a CLOSED state. This channel creation can be initialized programmatically by sending a new MsgChannelOpenInit message like so:
Active Channel is in a CLOSED state. This is done by initiating the channel handshake on the controller chain using the same portID associated with the interchain account in question.
It is important to note that once a channel has been opened for a given interchain account, new channels can not be opened for this account until the currently set Active Channel is set to CLOSED.
Future improvements
Future versions of the ICS-27 protocol and the Interchain Accounts module will likely use a new channel type that provides ordering of packets without the channel closing in the event of a packet timing out, thus removing the need forActive Channels entirely.
The following is a list of issues which will provide the infrastructure to make this possible: