-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into carlos/#1359-bump-package-to-v4
- Loading branch information
Showing
13 changed files
with
298 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!-- | ||
order: 6 | ||
--> | ||
|
||
# For end users | ||
|
||
Learn how to incentivize IBC packets using the ICS29 Fee Middleware module. {synopsis} | ||
|
||
## Pre-requisite readings | ||
|
||
* [Fee Middleware](overview.md) {prereq} | ||
|
||
## Summary | ||
|
||
Different types of end users: | ||
|
||
- CLI users who want to manually incentivize IBC packets | ||
- Client developers | ||
|
||
|
||
The Fee Middleware module allows end users to add a 'tip' to each IBC packet which will incentivize relayer operators to relay packets between chains. gRPC endpoints are exposed for client developers as well as a simple CLI for manually incentivizing IBC packets. | ||
|
||
## CLI Users | ||
|
||
For an in depth guide on how to use the ICS29 Fee Middleware module using the CLI please take a look at the [wiki](https://github.com/cosmos/ibc-go/wiki/Fee-enabled-fungible-token-transfers#asynchronous-incentivization-of-a-fungible-token-transfer) on the `ibc-go` repo. | ||
|
||
## Client developers | ||
|
||
Client developers can read more about the relevant ICS29 message types in the [Escrowing and paying out fees section](../ics29-fee/msgs.md). | ||
|
||
[CosmJS](https://github.com/cosmos/cosmjs) is a useful client library for signing and broadcasting Cosmos SDK messages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- | ||
order: 5 | ||
--> | ||
|
||
# Events | ||
|
||
## `MsgPayPacketFee`, `MsgPayPacketFeeAsync` | ||
|
||
| Type | Attribute Key | Attribute Value | | ||
|-------------------------|-----------------|-----------------| | ||
| incentivized_ibc_packet | port_id | {portID} | | ||
| incentivized_ibc_packet | channel_id | {channelID} | | ||
| incentivized_ibc_packet | packet_sequence | {sequence} | | ||
| incentivized_ibc_packet | recv_fee | {recvFee} | | ||
| incentivized_ibc_packet | ack_fee | {ackFee} | | ||
| incentivized_ibc_packet | timeout_fee | {timeoutFee} | | ||
| message | module | fee-ibc | | ||
|
||
## `RegisterPayee` | ||
|
||
| Type | Attribute Key | Attribute Value | | ||
|----------------|------------|--------------------| | ||
| register_payee | relayer | {relayer} | | ||
| register_payee | payee | {payee} | | ||
| register_payee | channel_id | {channelID} | | ||
| message | module | fee-ibc | | ||
|
||
## `RegisterCounterpartyPayee` | ||
|
||
| Type | Attribute Key | Attribute Value | | ||
|-----------------------------|--------------------|---------------------| | ||
| register_counterparty_payee | relayer | {relayer} | | ||
| register_counterparty_payee | counterparty_payee | {counterpartyPayee} | | ||
| register_counterparty_payee | channel_id | {channelID} | | ||
| message | module | fee-ibc | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<!-- | ||
order: 4 | ||
--> | ||
|
||
# Fee distribution | ||
|
||
Learn about payee registration for the distribution of packet fees. The following document is intended for relayer operators. {synopsis} | ||
|
||
## Pre-requisite readings | ||
|
||
* [Fee Middleware](overview.md) {prereq} | ||
|
||
Packet fees are divided into 3 distinct amounts in order to compensate relayer operators for packet relaying on fee enabled IBC channels. | ||
|
||
- `RecvFee`: The sum of all packet receive fees distributed to a payee for successful execution of `MsgRecvPacket`. | ||
- `AckFee`: The sum of all packet acknowledgement fees distributed to a payee for successful execution of `MsgAcknowledgement`. | ||
- `TimeoutFee`: The sum of all packet timeout fees distributed to a payee for successful execution of `MsgTimeout`. | ||
|
||
## Register a payee address for forward relaying | ||
|
||
As mentioned in [ICS29 Concepts](../ics29-fee/overview.md#concepts), the forward relayer describes the actor who performs the submission of `MsgRecvPacket` on the destination chain. | ||
Fee distribution for incentivized packet relays takes place on the packet source chain. | ||
Relayer operators are expected to register a counterparty payee address, in order to be compensated accordingly with `RecvFee`s upon completion of a packet lifecycle. | ||
The counterparty payee address registered on the destination chain is encoded into the packet acknowledgement and communicated as such to the source chain for fee distribution. | ||
If a counterparty payee is not registered for the forward relayer on the destination chain, the escrowed fees will be refunded upon fee distribution. | ||
|
||
A transaction must be submitted to the destination chain including a `CounterpartyPayee` address of an account on the source chain. | ||
The transaction must be signed by the `Relayer`. | ||
|
||
```go | ||
type MsgRegisterCounterpartyPayee struct { | ||
// unique port identifier | ||
PortId string | ||
// unique channel identifier | ||
ChannelId string | ||
// the relayer address | ||
Relayer string | ||
// the counterparty payee address | ||
CounterpartyPayee string | ||
} | ||
``` | ||
|
||
This message is expected to fail if: | ||
|
||
- `PortId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators). | ||
- `ChannelId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators)). | ||
- `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/basics/accounts.md#Addresses)). | ||
- `CounterpartyPayee` is empty. | ||
|
||
See below for an example CLI command: | ||
|
||
``` | ||
simd tx ibc-fee register-counterparty-payee transfer channel-0 cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh osmo1v5y0tz01llxzf4c2afml8s3awue0ymju22wxx2 --from cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh | ||
``` | ||
|
||
## Register a payee address for reverse and timeout relaying | ||
|
||
As mentioned in [ICS29 Concepts](../ics29-fee/overview.md#concepts), the reverse relayer describes the actor who performs the submission of `MsgAcknowledgement` on the source chain. | ||
Similarly the timeout relayer describes the actor who performs the submission of `MsgTimeout` (or `MsgTimeoutOnClose`) on the source chain. | ||
Relayer operators may choose to register an optional payee address, in order to be compensated accordingly with `AckFee`s and `TimeoutFee`s upon completion of a packet life cycle. | ||
If a payee is not registered for the reverse or timeout relayer on the source chain, then fee distribution assumes the default behaviour, where fees are paid out to the relayer account which delivers `MsgAcknowledgement` or `MsgTimeout`/`MsgTimeoutOnClose`. | ||
|
||
A transaction must be submitted to the source chain including a `Payee` address of an account on the source chain. | ||
The transaction must be signed by the `Relayer`. | ||
|
||
```go | ||
type MsgRegisterPayee struct { | ||
// unique port identifier | ||
PortId string | ||
// unique channel identifier | ||
ChannelId string | ||
// the relayer address | ||
Relayer string | ||
// the payee address | ||
Payee string | ||
} | ||
``` | ||
|
||
This message is expected to fail if: | ||
|
||
- `PortId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators). | ||
- `ChannelId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators)). | ||
- `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/basics/accounts.md#Addresses)). | ||
- `Payee` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/basics/accounts.md#Addresses)). | ||
|
||
See below for an example CLI command: | ||
|
||
``` | ||
simd tx ibc-fee register-payee transfer channel-0 cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh cosmos153lf4zntqt33a4v0sm5cytrxyqn78q7kz8j8x5 --from cosmos1rsp837a4kvtgp2m4uqzdge0zzu6efqgucm0qdh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<!-- | ||
order: 3 | ||
--> | ||
|
||
# Escrowing fees | ||
|
||
The fee middleware module exposes two different ways to pay fees for relaying IBC packets: | ||
|
||
1. `MsgPayPacketFee`, which enables the escrowing of fees for a packet at the next sequence send and should be combined into one `MultiMsgTx` with the message that will be paid for. | ||
|
||
Note that the `Relayers` field has been set up to allow for an optional whitelist of relayers permitted to receive this fee, however, this feature has not yet been enabled at this time. | ||
|
||
``` | ||
type MsgPayPacketFee struct{ | ||
// fee encapsulates the recv, ack and timeout fees associated with an IBC packet | ||
Fee Fee | ||
// the source port unique identifier | ||
SourcePortId string | ||
// the source channel unique identifer | ||
SourceChannelId string | ||
// account address to refund fee if necessary | ||
Signer string | ||
// optional list of relayers permitted to the receive packet fee | ||
Relayers []string | ||
} | ||
``` | ||
The `Fee` message contained in this synchronous fee payment method configures different fees which will be paid out for `MsgRecvPacket`, `MsgAcknowledgement`, and `MsgTimeout`/`MsgTimeoutOnClose`. | ||
``` | ||
type Fee struct { | ||
RecvFee types.Coins | ||
AckFee types.Coins | ||
TimeoutFee types.Coin` | ||
} | ||
``` | ||
2. `MsgPayPacketFeeAsync`, which enables the asynchronous escrowing of fees for a specified packet: | ||
Note that a packet can be 'topped up' multiple times with additional fees of any coin denomination by broadcasting multiple `MsgPayPacketFeeAsync` messages. | ||
``` | ||
type MsgPayPacketFeeAsync struct { | ||
// unique packet identifier comprised of the channel ID, port ID and sequence | ||
PacketId channeltypes.PacketId | ||
// the packet fee associated with a particular IBC packet | ||
PacketFee PacketFee | ||
} | ||
``` | ||
where the `PacketFee` also specifies the `Fee` to be paid as well as the refund address for fees which are not paid out | ||
``` | ||
type PacketFee struct { | ||
Fee Fee | ||
RefundAddress string | ||
Relayers []]string | ||
} | ||
``` | ||
Please see our [wiki](https://github.com/cosmos/ibc-go/wiki/Fee-enabled-fungible-token-transfers) for example flows on how to use these messages to incentivise a token transfer channel using a CLI. | ||
# Paying out the escrowed fees | ||
In the case of a successful transaction, `RecvFee` will be paid out to the designated counterparty payee address which has been registered on the receiver chain and sent back with the `MsgAcknowledgement`, `AckFee` will be paid out to the relayer address which has submitted the `MsgAcknowledgement` on the sending chain (or the registered payee in case one has been registered for the relayer address), and `TimeoutFee` will be reimbursed to the account which escrowed the fee. In cases of timeout transactions, `RecvFee` and `AckFee` will be reimbursed. | ||
Please note that fee payments are built on the assumption that sender chains are the source of incentives — the chain that sends the packets is the same chain where fee payments will occur -- please see the [relayer operator section](../ics29-fee/fee-distribution.md) to understand the flow for registering payee and counterparty payee (fee receiving) addresses. | ||
# A locked fee middleware module | ||
The fee middleware module can become locked if the situation arises that the escrow account for the fees does not have sufficient funds to pay out the fees which have been escrowed for each packet. This situation indicates a severe bug. In this case, the fee module will be locked until manual intervention fixes the issue. | ||
A locked fee module will simply skip fee logic and continue on to the underlying packet flow. A channel with a locked fee module will temporarily function as a fee disabled channel, and the locking of a fee module will not affect the continued flow of packets over the channel. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.