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:
co-authored by
Federico Kunze
parent
9ee14ee985
commit
97a83e9c78
+2
-1
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
order: false
|
||||
parent:
|
||||
order: 4
|
||||
order: 5
|
||||
-->
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -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)
|
||||
Reference in New Issue
Block a user