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>
This commit is contained in:
parent
9ee14ee985
commit
97a83e9c78
|
@ -1,7 +1,7 @@
|
||||||
<!--
|
<!--
|
||||||
order: false
|
order: false
|
||||||
parent:
|
parent:
|
||||||
order: 4
|
order: 5
|
||||||
-->
|
-->
|
||||||
|
|
||||||
# IBC
|
# IBC
|
||||||
|
@ -11,6 +11,7 @@ This repository contains reference documentation for the IBC protocol integratio
|
||||||
1. [Overview](./overview.md)
|
1. [Overview](./overview.md)
|
||||||
2. [Integration](./integration.md)
|
2. [Integration](./integration.md)
|
||||||
3. [Customization](./custom.md)
|
3. [Customization](./custom.md)
|
||||||
|
4. [Relayer](./relayer.md)
|
||||||
|
|
||||||
After reading about IBC, head on to the [Building Modules
|
After reading about IBC, head on to the [Building Modules
|
||||||
documentation](../building-modules/README.md) to learn more about the process of building modules.
|
documentation](../building-modules/README.md) to learn more about the process of building modules.
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
<!--
|
||||||
|
order: 4
|
||||||
|
-->
|
||||||
|
|
||||||
|
# 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_<submodulename>` (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 `<event_type>.<attribute_key>` 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)
|
|
@ -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)
|
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.NewEvent(
|
||||||
sdk.EventTypeMessage,
|
types.EventTypeTransfer,
|
||||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
|
||||||
sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.String()),
|
sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender.String()),
|
||||||
sdk.NewAttribute(types.AttributeKeyReceiver, msg.Receiver),
|
sdk.NewAttribute(types.AttributeKeyReceiver, msg.Receiver),
|
||||||
),
|
),
|
||||||
)
|
sdk.NewEvent(
|
||||||
|
sdk.EventTypeMessage,
|
||||||
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
return &sdk.Result{
|
return &sdk.Result{
|
||||||
Events: ctx.EventManager().Events().ToABCIEvents(),
|
Events: ctx.EventManager().Events().ToABCIEvents(),
|
||||||
|
|
|
@ -373,9 +373,9 @@ func (am AppModule) OnTimeoutPacket(
|
||||||
ctx.EventManager().EmitEvent(
|
ctx.EventManager().EmitEvent(
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
types.EventTypeTimeout,
|
types.EventTypeTimeout,
|
||||||
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
||||||
sdk.NewAttribute(types.AttributeKeyRefundReceiver, data.Sender),
|
sdk.NewAttribute(types.AttributeKeyRefundReceiver, data.Sender),
|
||||||
sdk.NewAttribute(types.AttributeKeyRefundValue, data.Amount.String()),
|
sdk.NewAttribute(types.AttributeKeyRefundValue, data.Amount.String()),
|
||||||
sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!--
|
||||||
|
order: 1
|
||||||
|
-->
|
||||||
|
|
||||||
|
# Concepts
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!--
|
||||||
|
order: 2
|
||||||
|
-->
|
||||||
|
|
||||||
|
# State
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!--
|
||||||
|
order: 3
|
||||||
|
-->
|
||||||
|
|
||||||
|
# State Transitions
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!--
|
||||||
|
order: 4
|
||||||
|
-->
|
||||||
|
|
||||||
|
# Messages
|
|
@ -0,0 +1,45 @@
|
||||||
|
<!--
|
||||||
|
order: 5
|
||||||
|
-->
|
||||||
|
|
||||||
|
# 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} |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!--
|
||||||
|
order: 0
|
||||||
|
title: IBC Fungible Token Transfer
|
||||||
|
parent:
|
||||||
|
title: "ibc-transfer"
|
||||||
|
-->
|
||||||
|
|
||||||
|
# `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)**
|
|
@ -4,6 +4,7 @@ package types
|
||||||
const (
|
const (
|
||||||
EventTypeTimeout = "timeout"
|
EventTypeTimeout = "timeout"
|
||||||
EventTypePacket = "fungible_token_packet"
|
EventTypePacket = "fungible_token_packet"
|
||||||
|
EventTypeTransfer = "ibc_transfer"
|
||||||
EventTypeChannelClose = "channel_closed"
|
EventTypeChannelClose = "channel_closed"
|
||||||
|
|
||||||
AttributeKeyReceiver = "receiver"
|
AttributeKeyReceiver = "receiver"
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package channel
|
package channel
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
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.AttributeKeyChannelID, msg.ChannelID),
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyPortID, msg.Channel.Counterparty.PortID),
|
sdk.NewAttribute(types.AttributeCounterpartyPortID, msg.Channel.Counterparty.PortID),
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyChannelID, msg.Channel.Counterparty.ChannelID),
|
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.NewEvent(
|
||||||
sdk.EventTypeMessage,
|
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.AttributeKeyChannelID, msg.ChannelID),
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyPortID, msg.Channel.Counterparty.PortID),
|
sdk.NewAttribute(types.AttributeCounterpartyPortID, msg.Channel.Counterparty.PortID),
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyChannelID, msg.Channel.Counterparty.ChannelID),
|
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.NewEvent(
|
||||||
sdk.EventTypeMessage,
|
sdk.EventTypeMessage,
|
||||||
|
@ -85,9 +83,9 @@ func HandleMsgChannelOpenAck(ctx sdk.Context, k keeper.Keeper, channelCap *capab
|
||||||
types.EventTypeChannelOpenAck,
|
types.EventTypeChannelOpenAck,
|
||||||
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID),
|
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID),
|
||||||
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID),
|
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID),
|
||||||
sdk.NewAttribute(types.AttributeKeyConnectionID, strings.Join(channel.ConnectionHops, ", ")),
|
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID),
|
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID),
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID),
|
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID),
|
||||||
|
sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]),
|
||||||
),
|
),
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
sdk.EventTypeMessage,
|
sdk.EventTypeMessage,
|
||||||
|
@ -114,9 +112,9 @@ func HandleMsgChannelOpenConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *c
|
||||||
types.EventTypeChannelOpenConfirm,
|
types.EventTypeChannelOpenConfirm,
|
||||||
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID),
|
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID),
|
||||||
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID),
|
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID),
|
||||||
sdk.NewAttribute(types.AttributeKeyConnectionID, strings.Join(channel.ConnectionHops, ", ")),
|
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID),
|
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID),
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID),
|
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID),
|
||||||
|
sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]),
|
||||||
),
|
),
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
sdk.EventTypeMessage,
|
sdk.EventTypeMessage,
|
||||||
|
@ -143,9 +141,9 @@ func HandleMsgChannelCloseInit(ctx sdk.Context, k keeper.Keeper, channelCap *cap
|
||||||
types.EventTypeChannelCloseInit,
|
types.EventTypeChannelCloseInit,
|
||||||
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID),
|
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID),
|
||||||
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID),
|
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID),
|
||||||
sdk.NewAttribute(types.AttributeKeyConnectionID, strings.Join(channel.ConnectionHops, ", ")),
|
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID),
|
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID),
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID),
|
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID),
|
||||||
|
sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]),
|
||||||
),
|
),
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
sdk.EventTypeMessage,
|
sdk.EventTypeMessage,
|
||||||
|
@ -172,9 +170,9 @@ func HandleMsgChannelCloseConfirm(ctx sdk.Context, k keeper.Keeper, channelCap *
|
||||||
types.EventTypeChannelCloseConfirm,
|
types.EventTypeChannelCloseConfirm,
|
||||||
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID),
|
sdk.NewAttribute(types.AttributeKeyPortID, msg.PortID),
|
||||||
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID),
|
sdk.NewAttribute(types.AttributeKeyChannelID, msg.ChannelID),
|
||||||
sdk.NewAttribute(types.AttributeKeyConnectionID, strings.Join(channel.ConnectionHops, ", ")),
|
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID),
|
sdk.NewAttribute(types.AttributeCounterpartyPortID, channel.Counterparty.PortID),
|
||||||
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID),
|
sdk.NewAttribute(types.AttributeCounterpartyChannelID, channel.Counterparty.ChannelID),
|
||||||
|
sdk.NewAttribute(types.AttributeKeyConnectionID, channel.ConnectionHops[0]),
|
||||||
),
|
),
|
||||||
sdk.NewEvent(
|
sdk.NewEvent(
|
||||||
sdk.EventTypeMessage,
|
sdk.EventTypeMessage,
|
||||||
|
|
|
@ -128,6 +128,11 @@ func (k Keeper) SendPacket(
|
||||||
sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()),
|
sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()),
|
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.AttributeKeySrcChannel, packet.GetSourceChannel()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()),
|
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.AttributeKeySrcChannel, packet.GetSourceChannel()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()),
|
sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()),
|
||||||
|
sdk.NewAttribute(types.AttributeKeyChannelOrdering, channel.Ordering.String()),
|
||||||
|
),
|
||||||
|
sdk.NewEvent(
|
||||||
|
sdk.EventTypeMessage,
|
||||||
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,11 @@ func (k Keeper) TimeoutExecuted(
|
||||||
sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()),
|
sdk.NewAttribute(types.AttributeKeySrcChannel, packet.GetSourceChannel()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()),
|
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.AttributeKeySrcChannel, packet.GetSourceChannel()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
sdk.NewAttribute(types.AttributeKeyDstPort, packet.GetDestPort()),
|
||||||
sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()),
|
sdk.NewAttribute(types.AttributeKeyDstChannel, packet.GetDestChannel()),
|
||||||
|
sdk.NewAttribute(types.AttributeKeyChannelOrdering, channel.Ordering.String()),
|
||||||
|
),
|
||||||
|
sdk.NewEvent(
|
||||||
|
sdk.EventTypeMessage,
|
||||||
|
sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory),
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ const (
|
||||||
AttributeKeySrcChannel = "packet_src_channel"
|
AttributeKeySrcChannel = "packet_src_channel"
|
||||||
AttributeKeyDstPort = "packet_dst_port"
|
AttributeKeyDstPort = "packet_dst_port"
|
||||||
AttributeKeyDstChannel = "packet_dst_channel"
|
AttributeKeyDstChannel = "packet_dst_channel"
|
||||||
|
AttributeKeyChannelOrdering = "packet_channel_ordering"
|
||||||
)
|
)
|
||||||
|
|
||||||
// IBC channel events vars
|
// IBC channel events vars
|
||||||
|
|
|
@ -386,7 +386,7 @@ func (msg MsgPacket) GetSigners() []sdk.AccAddress {
|
||||||
|
|
||||||
// Type implements sdk.Msg
|
// Type implements sdk.Msg
|
||||||
func (msg MsgPacket) Type() string {
|
func (msg MsgPacket) Type() string {
|
||||||
return "ics04/opaque"
|
return "recv_packet"
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ sdk.Msg = &MsgTimeout{}
|
var _ sdk.Msg = &MsgTimeout{}
|
||||||
|
@ -437,7 +437,7 @@ func (msg MsgTimeout) GetSigners() []sdk.AccAddress {
|
||||||
|
|
||||||
// Type implements sdk.Msg
|
// Type implements sdk.Msg
|
||||||
func (msg MsgTimeout) Type() string {
|
func (msg MsgTimeout) Type() string {
|
||||||
return "ics04/timeout"
|
return "timeout_packet"
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ sdk.Msg = &MsgAcknowledgement{}
|
var _ sdk.Msg = &MsgAcknowledgement{}
|
||||||
|
@ -489,5 +489,5 @@ func (msg MsgAcknowledgement) GetSigners() []sdk.AccAddress {
|
||||||
|
|
||||||
// Type implements sdk.Msg
|
// Type implements sdk.Msg
|
||||||
func (msg MsgAcknowledgement) Type() string {
|
func (msg MsgAcknowledgement) Type() string {
|
||||||
return "ics04/opaque"
|
return "acknowledge_packet"
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,7 +375,7 @@ func (suite *MsgTestSuite) TestMsgChannelCloseConfirm() {
|
||||||
func (suite *MsgTestSuite) TestMsgPacketType() {
|
func (suite *MsgTestSuite) TestMsgPacketType() {
|
||||||
msg := types.NewMsgPacket(packet, suite.proof, 1, addr1)
|
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
|
// TestMsgPacketValidation tests ValidateBasic for MsgPacket
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<!--
|
||||||
|
order: 3
|
||||||
|
-->
|
||||||
|
|
||||||
|
# State Transitions
|
||||||
|
|
|
@ -4,79 +4,94 @@ order: 6
|
||||||
|
|
||||||
# Events
|
# 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
|
## ICS 02 - Client
|
||||||
|
|
||||||
### MsgCreateClient
|
### MsgCreateClient
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|---------------|---------------|-----------------|
|
|---------------|------------------|-------------------|
|
||||||
| create_client | client_id | {clientID} |
|
| create_client | client_id | {clientID} |
|
||||||
| message | module | ibc_client |
|
| create_client | client_type | {clientType} |
|
||||||
|
| create_client | consensus_height | {consensusHeight} |
|
||||||
| message | action | create_client |
|
| message | action | create_client |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_client |
|
||||||
|
|
||||||
### MsgUpdateClient
|
### MsgUpdateClient
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|---------------|---------------|-----------------|
|
|---------------|------------------|-------------------|
|
||||||
| update_client | client_id | {clientID} |
|
| update_client | client_id | {clientID} |
|
||||||
| message | module | ibc_client |
|
| update_client | client_type | {clientType} |
|
||||||
|
| update_client | consensus_height | {consensusHeight} |
|
||||||
| message | action | update_client |
|
| message | action | update_client |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_client |
|
||||||
|
|
||||||
### MsgSubmitMisbehaviour
|
### MsgSubmitMisbehaviour
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|---------------------|---------------|---------------------|
|
|---------------------|------------------|---------------------|
|
||||||
| client_misbehaviour | client_id | {clientID} |
|
| client_misbehaviour | client_id | {clientID} |
|
||||||
| message | module | evidence |
|
| client_misbehaviour | client_type | {clientType} |
|
||||||
|
| client_misbehaviour | consensus_height | {consensusHeight} |
|
||||||
| message | action | client_misbehaviour |
|
| message | action | client_misbehaviour |
|
||||||
| message | sender | {signer} |
|
| message | module | evidence |
|
||||||
|
| message | sender | {senderAddress} |
|
||||||
|
| submit_evidence | evidence_hash | {evidenceHash} |
|
||||||
|
|
||||||
## ICS 03 - Connection
|
## ICS 03 - Connection
|
||||||
|
|
||||||
### MsgConnectionOpenInit
|
### MsgConnectionOpenInit
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|----------------------|------------------------|-------------------------|
|
|----------------------|----------------------------|-----------------------------|
|
||||||
| connection_open_init | connection_id | {connectionID} |
|
| connection_open_init | connection_id | {connectionID} |
|
||||||
| connection_open_init | client_id | {clientID} |
|
| connection_open_init | client_id | {clientID} |
|
||||||
| connection_open_init | counterparty_client_id | {counterparty.clientID} |
|
| connection_open_init | counterparty_client_id | {counterparty.clientID} |
|
||||||
| message | module | ibc_connection |
|
| connection_open_init | counterparty_connection_id | {counterparty.connectionID} |
|
||||||
| message | action | connection_open_init |
|
| message | action | connection_open_init |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_connection |
|
||||||
|
|
||||||
### MsgConnectionOpenTry
|
### MsgConnectionOpenTry
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|---------------------|---------------|---------------------|
|
|---------------------|----------------------------|-----------------------------|
|
||||||
| connection_open_try | connection_id | {connectionID} |
|
| connection_open_try | connection_id | {connectionID} |
|
||||||
| connection_open_try | client_id | {clientID} |
|
| connection_open_try | client_id | {clientID} |
|
||||||
| message | module | ibc_connection |
|
| connection_open_try | counterparty_client_id | {counterparty.clientID |
|
||||||
|
| connection_open_try | counterparty_connection_id | {counterparty.connectionID} |
|
||||||
| message | action | connection_open_try |
|
| message | action | connection_open_try |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_connection |
|
||||||
|
|
||||||
### MsgConnectionOpenAck
|
### MsgConnectionOpenAck
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|----------------------|------------------------|-------------------------|
|
|----------------------|----------------------------|-----------------------------|
|
||||||
| connection_open_ack | connection_id | {connectionID} |
|
| connection_open_ack | connection_id | {connectionID} |
|
||||||
| connection_open_ack | client_id | {clientID} |
|
| connection_open_ack | client_id | {clientID} |
|
||||||
| connection_open_init | counterparty_client_id | {counterparty.clientID} |
|
| connection_open_ack | counterparty_client_id | {counterparty.clientID} |
|
||||||
|
| connection_open_ack | counterparty_connection_id | {counterparty.connectionID} |
|
||||||
| message | module | ibc_connection |
|
| message | module | ibc_connection |
|
||||||
| message | action | connection_open_ack |
|
| message | action | connection_open_ack |
|
||||||
| message | sender | {signer} |
|
|
||||||
|
|
||||||
### MsgConnectionOpenConfirm
|
### MsgConnectionOpenConfirm
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|-------------------------|---------------|-------------------------|
|
|-------------------------|----------------------------|-----------------------------|
|
||||||
| connection_open_confirm | connection_id | {connectionID} |
|
| connection_open_confirm | connection_id | {connectionID} |
|
||||||
| message | module | ibc_connection |
|
| 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 | action | connection_open_confirm |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_connection |
|
||||||
|
|
||||||
## ICS 04 - Channel
|
## 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_port_id | {channel.counterparty.portID} |
|
||||||
| channel_open_init | counterparty_channel_id | {channel.counterparty.channelID} |
|
| channel_open_init | counterparty_channel_id | {channel.counterparty.channelID} |
|
||||||
| channel_open_init | connection_id | {channel.connectionHops} |
|
| channel_open_init | connection_id | {channel.connectionHops} |
|
||||||
| message | module | ibc_channel |
|
|
||||||
| message | action | channel_open_init |
|
| message | action | channel_open_init |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_channel |
|
||||||
|
|
||||||
### MsgChannelOpenTry
|
### 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_port_id | {channel.counterparty.portID} |
|
||||||
| channel_open_try | counterparty_channel_id | {channel.counterparty.channelID} |
|
| channel_open_try | counterparty_channel_id | {channel.counterparty.channelID} |
|
||||||
| channel_open_try | connection_id | {channel.connectionHops} |
|
| channel_open_try | connection_id | {channel.connectionHops} |
|
||||||
| message | module | ibc_channel |
|
|
||||||
| message | action | channel_open_try |
|
| message | action | channel_open_try |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_channel |
|
||||||
|
|
||||||
### MsgChannelOpenAck
|
### MsgChannelOpenAck
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|------------------|---------------|------------------|
|
|------------------|-------------------------|----------------------------------|
|
||||||
| channel_open_ack | port_id | {portID} |
|
| channel_open_ack | port_id | {portID} |
|
||||||
| channel_open_ack | channel_id | {channelID} |
|
| channel_open_ack | channel_id | {channelID} |
|
||||||
| message | module | ibc_channel |
|
| 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 | action | channel_open_ack |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_channel |
|
||||||
|
|
||||||
### MsgChannelOpenConfirm
|
### MsgChannelOpenConfirm
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|----------------------|---------------|----------------------|
|
|----------------------|-------------------------|----------------------------------|
|
||||||
| channel_open_confirm | port_id | {portID} |
|
| channel_open_confirm | port_id | {portID} |
|
||||||
| channel_open_confirm | channel_id | {channelID} |
|
| 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 | module | ibc_channel |
|
||||||
| message | action | channel_open_confirm |
|
| message | action | channel_open_confirm |
|
||||||
| message | sender | {signer} |
|
|
||||||
|
|
||||||
### MsgChannelCloseInit
|
### MsgChannelCloseInit
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|--------------------|---------------|--------------------|
|
|--------------------|-------------------------|----------------------------------|
|
||||||
| channel_close_init | port_id | {portID} |
|
| channel_close_init | port_id | {portID} |
|
||||||
| channel_close_init | channel_id | {channelID} |
|
| channel_close_init | channel_id | {channelID} |
|
||||||
| message | module | ibc_channel |
|
| 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 | action | channel_close_init |
|
||||||
| message | sender | {signer} |
|
| message | module | ibc_channel |
|
||||||
|
|
||||||
### MsgChannelCloseConfirm
|
### MsgChannelCloseConfirm
|
||||||
|
|
||||||
| Type | Attribute Key | Attribute Value |
|
| Type | Attribute Key | Attribute Value |
|
||||||
|-----------------------|---------------|-----------------------|
|
|-----------------------|-------------------------|----------------------------------|
|
||||||
| channel_close_confirm | port_id | {portID} |
|
| channel_close_confirm | port_id | {portID} |
|
||||||
| channel_close_confirm | channel_id | {channelID} |
|
| channel_close_confirm | channel_id | {channelID} |
|
||||||
| message | module | ibc_channel |
|
| 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 | action | channel_close_confirm |
|
||||||
| message | sender | {signer} |
|
| 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 |
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ For the general specification please refer to the [Interchain Standards](https:/
|
||||||
|
|
||||||
1. **[Concepts](01_concepts.md)**
|
1. **[Concepts](01_concepts.md)**
|
||||||
2. **[State](02_state.md)**
|
2. **[State](02_state.md)**
|
||||||
3. **[State Transitions](02_state_transitions.md)**
|
3. **[State Transitions](03_state_transitions.md)**
|
||||||
4. **[Messages](03_messages.md)**
|
4. **[Messages](04_messages.md)**
|
||||||
5. **[Callbacks](06_callbacks.md)**
|
5. **[Callbacks](05_callbacks.md)**
|
||||||
6. **[Events](07_events.md)**
|
6. **[Events](06_events.md)**
|
||||||
|
|
||||||
## Implementation Details
|
## Implementation Details
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue