From 97a83e9c783996c136be67cb8ce37c1cedf5308e Mon Sep 17 00:00:00 2001 From: colin axner <25233464+colin-axner@users.noreply.github.com> Date: Tue, 21 Jul 2020 18:56:14 +0200 Subject: [PATCH] Update IBC events docs and code (#6798) * update msgs type from opaque * update spec for createclient * update events spec for handshake cals * update packet events for spec and code * add relayer events doc * update ibc-transfer events * fix build * small fix from self review * update channel msgs types * acknowledgement_packet -> acknowledge_packet * Apply suggestions from code review Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * fix spec issues for ibc and ibc-transfer * add golang relayer link Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> --- docs/ibc/README.md | 3 +- docs/ibc/relayer.md | 45 ++++ x/ibc-transfer/handler.go | 11 +- x/ibc-transfer/module.go | 2 +- x/ibc-transfer/spec/01_concepts.md | 5 + x/ibc-transfer/spec/02_state.md | 5 + x/ibc-transfer/spec/03_state_transitions.md | 5 + x/ibc-transfer/spec/04_messages.md | 5 + x/ibc-transfer/spec/05_events.md | 45 ++++ x/ibc-transfer/spec/README.md | 22 ++ x/ibc-transfer/types/events.go | 1 + x/ibc/04-channel/handler.go | 14 +- x/ibc/04-channel/keeper/packet.go | 15 ++ x/ibc/04-channel/keeper/timeout.go | 10 + x/ibc/04-channel/types/events.go | 1 + x/ibc/04-channel/types/msgs.go | 6 +- x/ibc/04-channel/types/msgs_test.go | 2 +- x/ibc/spec/03_state_transitions.md | 6 + x/ibc/spec/06_events.md | 246 +++++++++++++------- x/ibc/spec/README.md | 8 +- 20 files changed, 355 insertions(+), 102 deletions(-) create mode 100644 docs/ibc/relayer.md create mode 100644 x/ibc-transfer/spec/01_concepts.md create mode 100644 x/ibc-transfer/spec/02_state.md create mode 100644 x/ibc-transfer/spec/03_state_transitions.md create mode 100644 x/ibc-transfer/spec/04_messages.md create mode 100644 x/ibc-transfer/spec/05_events.md create mode 100644 x/ibc-transfer/spec/README.md create mode 100644 x/ibc/spec/03_state_transitions.md diff --git a/docs/ibc/README.md b/docs/ibc/README.md index a33648d43..22061db94 100644 --- a/docs/ibc/README.md +++ b/docs/ibc/README.md @@ -1,7 +1,7 @@ # IBC @@ -11,6 +11,7 @@ This repository contains reference documentation for the IBC protocol integratio 1. [Overview](./overview.md) 2. [Integration](./integration.md) 3. [Customization](./custom.md) +4. [Relayer](./relayer.md) After reading about IBC, head on to the [Building Modules documentation](../building-modules/README.md) to learn more about the process of building modules. diff --git a/docs/ibc/relayer.md b/docs/ibc/relayer.md new file mode 100644 index 000000000..423a32077 --- /dev/null +++ b/docs/ibc/relayer.md @@ -0,0 +1,45 @@ + + +# Relayer + +## Pre-requisites Readings + +- [IBC Overview](./overview.md) {prereq} +- [Events](../core/events.md) {prereq} + +## Events + +Events are emitted for every transaction processed by the base application to indicate the execution +of some logic clients may want to be aware of. This is extremely useful when relaying IBC packets. +Any message that uses IBC will emit events for the corresponding TAO logic executed as defined in +the [IBC events spec](https://github.com/cosmos/cosmos-sdk/tree/master/x/ibc/spec/06_events.md). + +In the SDK, it can be assumed that for every message there is an event emitted with the type `message`, +attribute key `action`, and an attribute value representing the type of message sent +(`channel_open_init` would be the attribute value for `MsgChannelOpenInit`). If a relayer queries +for transaction events, it can split message events using this event Type/Attribute Key pair. + +The Event Type `message` with the Attribute Key `module` may be emitted multiple times for a single +message due to application callbacks. It can be assumed that any TAO logic executed will result in +a module event emission with the attribute value `ibc_` (02-client emits `ibc_client`). + +### Subscribing with Tendermint + +Calling the Tendermint RPC method `Subscribe` via [Tendermint's Websocket](https://docs.tendermint.com/master/rpc/) will return events using +Tendermint's internal representation of them. Instead of receiving back a list of events as they +were emitted, Tendermint will return the type `map[string][]string` which maps a string in the +form `.` to `attribute_value`. This causes extraction of the event +ordering to be non-trivial, but still possible. + +A relayer should use the `message.action` key to extract the number of messages in the transaction +and the type of IBC transactions sent. For every IBC transaction within the string array for +`message.action`, the necessary information should be extracted from the other event fields. If +`send_packet` appears at index 2 in the value for `message.action`, a relayer will need to use the +value at index 2 of the key `send_packet.packet_sequence`. This process should be repeated for each +piece of information needed to relay a packet. + +## Example Implementations + +- [Golang Relayer](https://github.com/iqlusioninc/relayer) diff --git a/x/ibc-transfer/handler.go b/x/ibc-transfer/handler.go index 6699faa33..08c3df9dd 100644 --- a/x/ibc-transfer/handler.go +++ b/x/ibc-transfer/handler.go @@ -31,14 +31,17 @@ func handleMsgTransfer(ctx sdk.Context, k keeper.Keeper, msg *types.MsgTransfer) k.Logger(ctx).Info("IBC transfer: %s from %s to %s", msg.Amount, msg.Sender, msg.Receiver) - ctx.EventManager().EmitEvent( + ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + types.EventTypeTransfer, sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.String()), sdk.NewAttribute(types.AttributeKeyReceiver, msg.Receiver), ), - ) + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + ), + }) return &sdk.Result{ Events: ctx.EventManager().Events().ToABCIEvents(), diff --git a/x/ibc-transfer/module.go b/x/ibc-transfer/module.go index ce256d5d6..0c73c0898 100644 --- a/x/ibc-transfer/module.go +++ b/x/ibc-transfer/module.go @@ -373,9 +373,9 @@ func (am AppModule) OnTimeoutPacket( ctx.EventManager().EmitEvent( sdk.NewEvent( types.EventTypeTimeout, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), sdk.NewAttribute(types.AttributeKeyRefundReceiver, data.Sender), sdk.NewAttribute(types.AttributeKeyRefundValue, data.Amount.String()), - sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), ), ) diff --git a/x/ibc-transfer/spec/01_concepts.md b/x/ibc-transfer/spec/01_concepts.md new file mode 100644 index 000000000..31cbdc546 --- /dev/null +++ b/x/ibc-transfer/spec/01_concepts.md @@ -0,0 +1,5 @@ + + +# Concepts diff --git a/x/ibc-transfer/spec/02_state.md b/x/ibc-transfer/spec/02_state.md new file mode 100644 index 000000000..b57ac80f2 --- /dev/null +++ b/x/ibc-transfer/spec/02_state.md @@ -0,0 +1,5 @@ + + +# State diff --git a/x/ibc-transfer/spec/03_state_transitions.md b/x/ibc-transfer/spec/03_state_transitions.md new file mode 100644 index 000000000..4782e38a4 --- /dev/null +++ b/x/ibc-transfer/spec/03_state_transitions.md @@ -0,0 +1,5 @@ + + +# State Transitions diff --git a/x/ibc-transfer/spec/04_messages.md b/x/ibc-transfer/spec/04_messages.md new file mode 100644 index 000000000..f644c71a6 --- /dev/null +++ b/x/ibc-transfer/spec/04_messages.md @@ -0,0 +1,5 @@ + + +# Messages diff --git a/x/ibc-transfer/spec/05_events.md b/x/ibc-transfer/spec/05_events.md new file mode 100644 index 000000000..8c4fa93f6 --- /dev/null +++ b/x/ibc-transfer/spec/05_events.md @@ -0,0 +1,45 @@ + + +# Events + +## MsgTransfer + +| Type | Attribute Key | Attribute Value | +|--------------|---------------|-----------------| +| ibc_transfer | sender | {sender} | +| ibc_transfer | receiver | {receiver} | +| message | action | transfer | +| message | module | transfer | + +## OnRecvPacket callback + +| Type | Attribute Key | Attribute Value | +|-----------------------|---------------|-----------------| +| fungible_token_packet | module | transfer | +| fungible_token_packet | receiver | {receiver} | +| fungible_token_packet | value | {amount} | + +## OnAcknowledgePacket callback + +| Type | Attribute Key | Attribute Value | +|-----------------------|---------------|-----------------| +| fungible_token_packet | module | transfer | +| fungible_token_packet | receiver | {receiver} | +| fungible_token_packet | value | {amount} | +| fungible_token_packet | success | {ackSuccess} | + +## OnTimeoutPacket callback + +| Type | Attribute Key | Attribute Value | +|-----------------------|-----------------|-----------------| +| fungible_token_packet | module | transfer | +| fungible_token_packet | refund_receiver | {receiver} | +| fungible_token_packet | value | {amount} | + + + + + + diff --git a/x/ibc-transfer/spec/README.md b/x/ibc-transfer/spec/README.md new file mode 100644 index 000000000..e79d25fff --- /dev/null +++ b/x/ibc-transfer/spec/README.md @@ -0,0 +1,22 @@ + + +# `ibc-transfer` + +## Abstract + +This paper defines the implementation of the ICS20 protocol on the Cosmos SDK. + +For the general specification please refer to the [ICS20 Specification](https://github.com/cosmos/ics/tree/master/spec/ics-020-fungible-token-transfer). + +## Contents + +1. **[Concepts](01_concepts.md)** +2. **[State](02_state.md)** +3. **[State Transitions](03_state_transitions.md)** +4. **[Messages](04_messages.md)** +5. **[Events](05_events.md)** diff --git a/x/ibc-transfer/types/events.go b/x/ibc-transfer/types/events.go index f66958de6..f9f27f4f2 100644 --- a/x/ibc-transfer/types/events.go +++ b/x/ibc-transfer/types/events.go @@ -4,6 +4,7 @@ package types const ( EventTypeTimeout = "timeout" EventTypePacket = "fungible_token_packet" + EventTypeTransfer = "ibc_transfer" EventTypeChannelClose = "channel_closed" AttributeKeyReceiver = "receiver" diff --git a/x/ibc/04-channel/handler.go b/x/ibc/04-channel/handler.go index a21838e40..f3c408f97 100644 --- a/x/ibc/04-channel/handler.go +++ b/x/ibc/04-channel/handler.go @@ -1,8 +1,6 @@ package channel import ( - "strings" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" @@ -27,7 +25,7 @@ func HandleMsgChannelOpenInit(ctx sdk.Context, k keeper.Keeper, portCap *capabil sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID), sdk.NewAttribute(types.AttributeCounterpartyPortID, msg.Channel.Counterparty.PortID), sdk.NewAttribute(types.AttributeCounterpartyChannelID, msg.Channel.Counterparty.ChannelID), - sdk.NewAttribute(types.AttributeKeyConnectionID, msg.Channel.ConnectionHops[0]), // TODO: iterate + sdk.NewAttribute(types.AttributeKeyConnectionID, msg.Channel.ConnectionHops[0]), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -56,7 +54,7 @@ func HandleMsgChannelOpenTry(ctx sdk.Context, k keeper.Keeper, portCap *capabili sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID), sdk.NewAttribute(types.AttributeCounterpartyPortID, msg.Channel.Counterparty.PortID), sdk.NewAttribute(types.AttributeCounterpartyChannelID, msg.Channel.Counterparty.ChannelID), - sdk.NewAttribute(types.AttributeKeyConnectionID, msg.Channel.ConnectionHops[0]), // TODO: iterate + sdk.NewAttribute(types.AttributeKeyConnectionID, msg.Channel.ConnectionHops[0]), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -85,9 +83,9 @@ func HandleMsgChannelOpenAck(ctx sdk.Context, k keeper.Keeper, channelCap *capab types.EventTypeChannelOpenAck, sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID), sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID), - sdk.NewAttribute(types.AttributeKeyConnectionID, strings.Join(channel.ConnectionHops, ", ")), sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID), sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -114,9 +112,9 @@ func HandleMsgChannelOpenConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *c types.EventTypeChannelOpenConfirm, sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID), sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID), - sdk.NewAttribute(types.AttributeKeyConnectionID, strings.Join(channel.ConnectionHops, ", ")), sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID), sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -143,9 +141,9 @@ func HandleMsgChannelCloseInit(ctx sdk.Context, k keeper.Keeper, channelCap *cap types.EventTypeChannelCloseInit, sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID), sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID), - sdk.NewAttribute(types.AttributeKeyConnectionID, strings.Join(channel.ConnectionHops, ", ")), sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID), sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), ), sdk.NewEvent( sdk.EventTypeMessage, @@ -172,9 +170,9 @@ func HandleMsgChannelCloseConfirm(ctx sdk.Context, k keeper.Keeper, channelCap * types.EventTypeChannelCloseConfirm, sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID), sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID), - sdk.NewAttribute(types.AttributeKeyConnectionID, strings.Join(channel.ConnectionHops, ", ")), sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID), sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID), + sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]), ), sdk.NewEvent( sdk.EventTypeMessage, diff --git a/x/ibc/04-channel/keeper/packet.go b/x/ibc/04-channel/keeper/packet.go index 49fce70c4..832f0d7ef 100644 --- a/x/ibc/04-channel/keeper/packet.go +++ b/x/ibc/04-channel/keeper/packet.go @@ -128,6 +128,11 @@ func (k Keeper) SendPacket( sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()), sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()), sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()), + sdk.NewAttribute(types.AttributeKeyChannelOrdering, channel.Ordering.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), ), }) @@ -313,6 +318,11 @@ func (k Keeper) PacketExecuted( sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()), sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()), sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()), + sdk.NewAttribute(types.AttributeKeyChannelOrdering, channel.Ordering.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), ), }) @@ -469,6 +479,11 @@ func (k Keeper) AcknowledgementExecuted( sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()), sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()), sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()), + sdk.NewAttribute(types.AttributeKeyChannelOrdering, channel.Ordering.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), ), }) diff --git a/x/ibc/04-channel/keeper/timeout.go b/x/ibc/04-channel/keeper/timeout.go index 917e1f9d2..81f2d7c56 100644 --- a/x/ibc/04-channel/keeper/timeout.go +++ b/x/ibc/04-channel/keeper/timeout.go @@ -158,6 +158,11 @@ func (k Keeper) TimeoutExecuted( sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()), sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()), sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()), + sdk.NewAttribute(types.AttributeKeyChannelOrdering, channel.Ordering.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), ), }) @@ -276,6 +281,11 @@ func (k Keeper) TimeoutOnClose( sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()), sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()), sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()), + sdk.NewAttribute(types.AttributeKeyChannelOrdering, channel.Ordering.String()), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), ), }) diff --git a/x/ibc/04-channel/types/events.go b/x/ibc/04-channel/types/events.go index 187c9ece5..bd01adeee 100644 --- a/x/ibc/04-channel/types/events.go +++ b/x/ibc/04-channel/types/events.go @@ -28,6 +28,7 @@ const ( AttributeKeySrcChannel = "packet_src_channel" AttributeKeyDstPort = "packet_dst_port" AttributeKeyDstChannel = "packet_dst_channel" + AttributeKeyChannelOrdering = "packet_channel_ordering" ) // IBC channel events vars diff --git a/x/ibc/04-channel/types/msgs.go b/x/ibc/04-channel/types/msgs.go index 243b95fb8..82ae49104 100644 --- a/x/ibc/04-channel/types/msgs.go +++ b/x/ibc/04-channel/types/msgs.go @@ -386,7 +386,7 @@ func (msg MsgPacket) GetSigners() []sdk.AccAddress { // Type implements sdk.Msg func (msg MsgPacket) Type() string { - return "ics04/opaque" + return "recv_packet" } var _ sdk.Msg = &MsgTimeout{} @@ -437,7 +437,7 @@ func (msg MsgTimeout) GetSigners() []sdk.AccAddress { // Type implements sdk.Msg func (msg MsgTimeout) Type() string { - return "ics04/timeout" + return "timeout_packet" } var _ sdk.Msg = &MsgAcknowledgement{} @@ -489,5 +489,5 @@ func (msg MsgAcknowledgement) GetSigners() []sdk.AccAddress { // Type implements sdk.Msg func (msg MsgAcknowledgement) Type() string { - return "ics04/opaque" + return "acknowledge_packet" } diff --git a/x/ibc/04-channel/types/msgs_test.go b/x/ibc/04-channel/types/msgs_test.go index d737eaf4f..452701d2a 100644 --- a/x/ibc/04-channel/types/msgs_test.go +++ b/x/ibc/04-channel/types/msgs_test.go @@ -375,7 +375,7 @@ func (suite *MsgTestSuite) TestMsgChannelCloseConfirm() { func (suite *MsgTestSuite) TestMsgPacketType() { msg := types.NewMsgPacket(packet, suite.proof, 1, addr1) - suite.Equal("ics04/opaque", msg.Type()) + suite.Equal("recv_packet", msg.Type()) } // TestMsgPacketValidation tests ValidateBasic for MsgPacket diff --git a/x/ibc/spec/03_state_transitions.md b/x/ibc/spec/03_state_transitions.md new file mode 100644 index 000000000..dc70ea002 --- /dev/null +++ b/x/ibc/spec/03_state_transitions.md @@ -0,0 +1,6 @@ + + +# State Transitions + diff --git a/x/ibc/spec/06_events.md b/x/ibc/spec/06_events.md index e333e8af0..240ba3675 100644 --- a/x/ibc/spec/06_events.md +++ b/x/ibc/spec/06_events.md @@ -4,79 +4,94 @@ order: 6 # Events -The IBC module emits the following events: +The IBC module emits the following events. It can be expected that the type `message`, +with an attirbute key of `action` will represent the first event for each message +being processed as emitted by the SDK's baseapp. Each IBC TAO message will +also emit its module name in the format 'ibc_sub-modulename'. + +All the events for the Channel handshakes, `SendPacket`, `RecvPacket`, `AcknowledgePacket`, +`TimeoutPacket` and `TimeoutOnClose` will emit additional events not specified here due to +callbacks to IBC applications. ## ICS 02 - Client ### MsgCreateClient -| Type | Attribute Key | Attribute Value | -|---------------|---------------|-----------------| -| create_client | client_id | {clientID} | -| message | module | ibc_client | -| message | action | create_client | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|---------------|------------------|-------------------| +| create_client | client_id | {clientID} | +| create_client | client_type | {clientType} | +| create_client | consensus_height | {consensusHeight} | +| message | action | create_client | +| message | module | ibc_client | ### MsgUpdateClient -| Type | Attribute Key | Attribute Value | -|---------------|---------------|-----------------| -| update_client | client_id | {clientID} | -| message | module | ibc_client | -| message | action | update_client | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|---------------|------------------|-------------------| +| update_client | client_id | {clientID} | +| update_client | client_type | {clientType} | +| update_client | consensus_height | {consensusHeight} | +| message | action | update_client | +| message | module | ibc_client | ### MsgSubmitMisbehaviour -| Type | Attribute Key | Attribute Value | -|---------------------|---------------|---------------------| -| client_misbehaviour | client_id | {clientID} | -| message | module | evidence | -| message | action | client_misbehaviour | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|---------------------|------------------|---------------------| +| client_misbehaviour | client_id | {clientID} | +| client_misbehaviour | client_type | {clientType} | +| client_misbehaviour | consensus_height | {consensusHeight} | +| message | action | client_misbehaviour | +| message | module | evidence | +| message | sender | {senderAddress} | +| submit_evidence | evidence_hash | {evidenceHash} | ## ICS 03 - Connection ### MsgConnectionOpenInit -| Type | Attribute Key | Attribute Value | -|----------------------|------------------------|-------------------------| -| connection_open_init | connection_id | {connectionID} | -| connection_open_init | client_id | {clientID} | -| connection_open_init | counterparty_client_id | {counterparty.clientID} | -| message | module | ibc_connection | -| message | action | connection_open_init | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|----------------------|----------------------------|-----------------------------| +| connection_open_init | connection_id | {connectionID} | +| connection_open_init | client_id | {clientID} | +| connection_open_init | counterparty_client_id | {counterparty.clientID} | +| connection_open_init | counterparty_connection_id | {counterparty.connectionID} | +| message | action | connection_open_init | +| message | module | ibc_connection | ### MsgConnectionOpenTry -| Type | Attribute Key | Attribute Value | -|---------------------|---------------|---------------------| -| connection_open_try | connection_id | {connectionID} | -| connection_open_try | client_id | {clientID} | -| message | module | ibc_connection | -| message | action | connection_open_try | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|---------------------|----------------------------|-----------------------------| +| connection_open_try | connection_id | {connectionID} | +| connection_open_try | client_id | {clientID} | +| connection_open_try | counterparty_client_id | {counterparty.clientID | +| connection_open_try | counterparty_connection_id | {counterparty.connectionID} | +| message | action | connection_open_try | +| message | module | ibc_connection | ### MsgConnectionOpenAck -| Type | Attribute Key | Attribute Value | -|----------------------|------------------------|-------------------------| -| connection_open_ack | connection_id | {connectionID} | -| connection_open_ack | client_id | {clientID} | -| connection_open_init | counterparty_client_id | {counterparty.clientID} | -| message | module | ibc_connection | -| message | action | connection_open_ack | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|----------------------|----------------------------|-----------------------------| +| connection_open_ack | connection_id | {connectionID} | +| connection_open_ack | client_id | {clientID} | +| connection_open_ack | counterparty_client_id | {counterparty.clientID} | +| connection_open_ack | counterparty_connection_id | {counterparty.connectionID} | +| message | module | ibc_connection | +| message | action | connection_open_ack | ### MsgConnectionOpenConfirm -| Type | Attribute Key | Attribute Value | -|-------------------------|---------------|-------------------------| -| connection_open_confirm | connection_id | {connectionID} | -| message | module | ibc_connection | -| message | action | connection_open_confirm | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|-------------------------|----------------------------|-----------------------------| +| connection_open_confirm | connection_id | {connectionID} | +| connection_open_confirm | client_id | {clientID} | +| connection_open_confirm | counterparty_client_id | {counterparty.clientID} | +| connection_open_confirm | counterparty_connection_id | {counterparty.connectionID} | +| message | action | connection_open_confirm | +| message | module | ibc_connection | ## ICS 04 - Channel @@ -89,9 +104,8 @@ The IBC module emits the following events: | channel_open_init | counterparty_port_id | {channel.counterparty.portID} | | channel_open_init | counterparty_channel_id | {channel.counterparty.channelID} | | channel_open_init | connection_id | {channel.connectionHops} | -| message | module | ibc_channel | | message | action | channel_open_init | -| message | sender | {signer} | +| message | module | ibc_channel | ### MsgChannelOpenTry @@ -102,46 +116,118 @@ The IBC module emits the following events: | channel_open_try | counterparty_port_id | {channel.counterparty.portID} | | channel_open_try | counterparty_channel_id | {channel.counterparty.channelID} | | channel_open_try | connection_id | {channel.connectionHops} | -| message | module | ibc_channel | | message | action | channel_open_try | -| message | sender | {signer} | +| message | module | ibc_channel | ### MsgChannelOpenAck -| Type | Attribute Key | Attribute Value | -|------------------|---------------|------------------| -| channel_open_ack | port_id | {portID} | -| channel_open_ack | channel_id | {channelID} | -| message | module | ibc_channel | -| message | action | channel_open_ack | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|------------------|-------------------------|----------------------------------| +| channel_open_ack | port_id | {portID} | +| channel_open_ack | channel_id | {channelID} | +| channel_open_ack | counterparty_port_id | {channel.counterparty.portID} | +| channel_open_ack | counterparty_channel_id | {channel.counterparty.channelID} | +| channel_open_ack | connection_id | {channel.connectionHops} | +| message | action | channel_open_ack | +| message | module | ibc_channel | ### MsgChannelOpenConfirm -| Type | Attribute Key | Attribute Value | -|----------------------|---------------|----------------------| -| channel_open_confirm | port_id | {portID} | -| channel_open_confirm | channel_id | {channelID} | -| message | module | ibc_channel | -| message | action | channel_open_confirm | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|----------------------|-------------------------|----------------------------------| +| channel_open_confirm | port_id | {portID} | +| channel_open_confirm | channel_id | {channelID} | +| channel_open_confirm | counterparty_port_id | {channel.counterparty.portID} | +| channel_open_confirm | counterparty_channel_id | {channel.counterparty.channelID} | +| channel_open_confirm | connection_id | {channel.connectionHops} | +| message | module | ibc_channel | +| message | action | channel_open_confirm | ### MsgChannelCloseInit -| Type | Attribute Key | Attribute Value | -|--------------------|---------------|--------------------| -| channel_close_init | port_id | {portID} | -| channel_close_init | channel_id | {channelID} | -| message | module | ibc_channel | -| message | action | channel_close_init | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|--------------------|-------------------------|----------------------------------| +| channel_close_init | port_id | {portID} | +| channel_close_init | channel_id | {channelID} | +| channel_close_init | counterparty_port_id | {channel.counterparty.portID} | +| channel_close_init | counterparty_channel_id | {channel.counterparty.channelID} | +| channel_close_init | connection_id | {channel.connectionHops} | +| message | action | channel_close_init | +| message | module | ibc_channel | ### MsgChannelCloseConfirm -| Type | Attribute Key | Attribute Value | -|-----------------------|---------------|-----------------------| -| channel_close_confirm | port_id | {portID} | -| channel_close_confirm | channel_id | {channelID} | -| message | module | ibc_channel | -| message | action | channel_close_confirm | -| message | sender | {signer} | +| Type | Attribute Key | Attribute Value | +|-----------------------|-------------------------|----------------------------------| +| channel_close_confirm | port_id | {portID} | +| channel_close_confirm | channel_id | {channelID} | +| channel_close_confirm | counterparty_port_id | {channel.counterparty.portID} | +| channel_close_confirm | counterparty_channel_id | {channel.counterparty.channelID} | +| channel_close_confirm | connection_id | {channel.connectionHops} | +| message | action | channel_close_confirm | +| message | module | ibc_channel | + +### SendPacket (application module call) + +| Type | Attribute Key | Attribute Value | +|-------------|--------------------------|----------------------------------| +| send_packet | packet_data | {data} | +| send_packet | packet_timeout_height | {timeoutHeight} | +| send_packet | packet_timeout_timestamp | {timeoutTimestamp} | +| send_packet | packet_sequence | {sequence} | +| send_packet | packet_src_port | {sourcePort} | +| send_packet | packet_src_channel | {sourceChannel} | +| send_packet | packet_dst_port | {destinationPort} | +| send_packet | packet_dst_channel | {destinationChannel} | +| send_packet | packet_channel_ordering | {channel.Ordering} | +| message | action | application-module-defined-field | +| message | module | ibc-channel | + +### RecvPacket + +| Type | Attribute Key | Attribute Value | +|-------------|--------------------------|----------------------| +| recv_packet | packet_data | {data} | +| recv_packet | packet_ack | {acknowledgement} | +| recv_packet | packet_timeout_height | {timeoutHeight} | +| recv_packet | packet_timeout_timestamp | {timeoutTimestamp} | +| recv_packet | packet_sequence | {sequence} | +| recv_packet | packet_src_port | {sourcePort} | +| recv_packet | packet_src_channel | {sourceChannel} | +| recv_packet | packet_dst_port | {destinationPort} | +| recv_packet | packet_dst_channel | {destinationChannel} | +| recv_packet | packet_channel_ordering | {channel.Ordering} | +| message | action | recv_packet | +| message | module | ibc-channel | + +### AcknowledgePacket + +| Type | Attribute Key | Attribute Value | +|--------------------|--------------------------|----------------------| +| acknowledge_packet | packet_timeout_height | {timeoutHeight} | +| acknowledge_packet | packet_timeout_timestamp | {timeoutTimestamp} | +| acknowledge_packet | packet_sequence | {sequence} | +| acknowledge_packet | packet_src_port | {sourcePort} | +| acknowledge_packet | packet_src_channel | {sourceChannel} | +| acknowledge_packet | packet_dst_port | {destinationPort} | +| acknowledge_packet | packet_dst_channel | {destinationChannel} | +| acknowledge_packet | packet_channel_ordering | {channel.Ordering} | +| message | action | acknowledge_packet | +| message | module | ibc-channel | + +### TimeoutPacket & TimeoutOnClose + +| Type | Attribute Key | Attribute Value | +|----------------|--------------------------|----------------------| +| timeout_packet | packet_timeout_height | {timeoutHeight} | +| timeout_packet | packet_timeout_timestamp | {timeoutTimestamp} | +| timeout_packet | packet_sequence | {sequence} | +| timeout_packet | packet_src_port | {sourcePort} | +| timeout_packet | packet_src_channel | {sourceChannel} | +| timeout_packet | packet_dst_port | {destinationPort} | +| timeout_packet | packet_dst_channel | {destinationChannel} | +| timeout_packet | packet_channel_ordering | {channel.Ordering} | +| message | action | timeout_packet | +| message | module | ibc-channel | + + diff --git a/x/ibc/spec/README.md b/x/ibc/spec/README.md index 6207665ae..7e8350c99 100644 --- a/x/ibc/spec/README.md +++ b/x/ibc/spec/README.md @@ -19,10 +19,10 @@ For the general specification please refer to the [Interchain Standards](https:/ 1. **[Concepts](01_concepts.md)** 2. **[State](02_state.md)** -3. **[State Transitions](02_state_transitions.md)** -4. **[Messages](03_messages.md)** -5. **[Callbacks](06_callbacks.md)** -6. **[Events](07_events.md)** +3. **[State Transitions](03_state_transitions.md)** +4. **[Messages](04_messages.md)** +5. **[Callbacks](05_callbacks.md)** +6. **[Events](06_events.md)** ## Implementation Details