Changelog
- 23-04-2021: Change status to “deprecated”
- 23-05-2020: Provide sample Go code and more details
- 18-05-2020: Initial Draft
Status
deprecatedContext
The current “naive” IBC Relayer strategy currently establishes a single predetermined IBC channel atop a single connection between two clients (each potentially of a different chain). This strategy then detects packets to be relayed by watching forsend_packet and recv_packet events matching that channel, and sends the necessary transactions to relay those packets.
We wish to expand this “naive” strategy to a “passive” one which detects and relays both channel handshake messages and packets on a given connection, without the need to know each channel in advance of relaying it.
In order to accomplish this, we propose adding more comprehensive events to expose channel metadata for each transaction sent from the x/ibc/core/04-channel/keeper/handshake.go and x/ibc/core/04-channel/keeper/packet.go modules.
Here is an example of what would be in ChanOpenInit:
channel_meta.src_connection is the only event key that needs to be indexed for a passive relayer to function.
Handling Channel Open Attempts
In the case of the passive relayer, when one chain sends aChanOpenInit, the relayer should inform the other chain of this open attempt and allow that chain to decide how (and if) it continues the handshake. Once both chains have actively approved the channel opening, then the rest of the handshake can happen as it does with the current “naive” relayer.
To implement this behavior, we propose replacing the cbs.OnChanOpenTry callback with a new cbs.OnAttemptChanOpenTry callback which explicitly handles the MsgChannelOpenTry, usually by resulting in a call to keeper.ChanOpenTry. The typical implementation, in x/ibc-transfer/module.go would be compatible with the current “naive” relayer, as follows:
x/ibc/handler.go:
x/ibc/handler.go and the port’s module (to explicitly negotiate versions, etc) is that we do not wish to constrain the app module to have to finish handling the MsgChannelOpenTry during this transaction or even this block.
Decision
- Expose events to allow “passive” connection relayers.
- Enable application-initiated channels via such passive relayers.
- Allow port modules to control how to handle open-try messages.
Consequences
Positive
Makes channels into a complete application-level abstraction. Applications have full control over initiating and accepting channels, rather than expecting a relayer to tell them when to do so. A passive relayer does not have to know what kind of channel (version string, ordering constraints, firewalling logic) the application supports. These are negotiated directly between applications.Negative
Increased event size for IBC messages.Neutral
More IBC events are exposed.References
- The Agoric VM’s IBC handler currently accommodates
attemptChanOpenTry