Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: ics27 v6 documentation updates #2561

Merged
merged 14 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,29 +203,29 @@ module.exports = {
path: "/apps/interchain-accounts/overview.html",
},
{
title: "Authentication Modules",
title: "Integration",
directory: false,
path: "/apps/interchain-accounts/auth-modules.html",
path: "/apps/interchain-accounts/integration.html",
},
{
title: "Active Channels",
title: "Messages",
directory: false,
path: "/apps/interchain-accounts/active-channels.html",
path: "/apps/interchain-accounts/messages.html",
},
{
title: "Integration",
title: "Parameters",
directory: false,
path: "/apps/interchain-accounts/integration.html",
path: "/apps/interchain-accounts/parameters.html",
},
{
title: "Parameters",
title: "Active Channels",
directory: false,
path: "/apps/interchain-accounts/parameters.html",
path: "/apps/interchain-accounts/active-channels.html",
},
{
title: "Transactions",
title: "Authentication Modules",
directory: false,
path: "/apps/interchain-accounts/transactions.html",
path: "/apps/interchain-accounts/auth-modules.html",
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions docs/apps/interchain-accounts/active-channels.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
order: 3
order: 5
-->

# Understanding Active Channels
Expand All @@ -9,7 +9,7 @@ The Interchain Accounts module uses [ORDERED channels](https://github.com/cosmos
In the case of a channel closing, a controller chain needs to be able to regain access to the interchain account registered on this channel. `Active Channels` enable this functionality. Future versions of the ICS-27 protocol and the Interchain Accounts module will likely use a new
Copy link

@anthonyra anthonyra Oct 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the note at the end here still valid, "Future versions of ICS-27 protocol and the Interchain Accounts module will likely use a new channel type that provides ordering of packets without the channel closing on timing out, thus removing the need for Active Channels entirely." The link for Ordered Channels suggests there's a possible flag to allow that channel to remain open ordered_allow_timeout channels. I apologize if I misunderstood the reference document. I'm new to IBC and ICA

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @anthonyra, thanks for raising this. To answer your question:

Yes, the note here is still valid. The current implementation in ibc-go/v6 still remains to use ORDERED channels. IBC core has yet to be updated to accommodate the ORDERED_ALLOW_TIMEOUT channel type, but when this work is implemented we will be sure to leverage it in ICA.

Please see:

This will also likely require Channel Upgrades - #1599 to make this all happen!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! I'll take a peek at all of those to get a better understanding. I wonder if the document linked should have references to those as well to indicate a work in progress? Thank you for the guidance!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think @anthonyra 's suggestion could make sense, to add a link to the WIP tracking issues for order timeouts and channel upgrades. but this can also be added later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Thanks for the feedback @anthonyra and @charleenfei :)

channel type that provides ordering of packets without the channel closing on timing out, thus removing the need for `Active Channels` entirely.

When an Interchain Account is registered using the `RegisterInterchainAccount` API, a new channel is created on a particular port. During the `OnChanOpenAck` and `OnChanOpenConfirm` steps (controller & host chain) the `Active Channel` for this interchain account
When an Interchain Account is registered using `MsgRegisterInterchainAccount`, a new channel is created on a particular port. During the `OnChanOpenAck` and `OnChanOpenConfirm` steps (controller & host chain) the `Active Channel` for this interchain account
is stored in state.

It is possible to create a new channel using the same controller chain portID if the previously set `Active Channel` is now in a `CLOSED` state. This channel creation can be initialized programatically by sending a new `MsgChannelOpenInit` message like so:
Expand Down
8 changes: 7 additions & 1 deletion docs/apps/interchain-accounts/auth-modules.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<!--
order: 2
order: 6
-->

# Building an authentication module

### Deprecation Notice
colin-axner marked this conversation as resolved.
Show resolved Hide resolved

**This document is deprecated and will be removed in future releases**.

Authentication modules play the role of the `Base Application` as described in [ICS30 IBC Middleware](https://github.com/cosmos/ibc/tree/master/spec/app/ics-030-middleware), and enable application developers to perform custom logic when working with the Interchain Accounts controller API. {synopsis}

The controller submodule is used for account registration and packet sending.
Expand Down Expand Up @@ -145,6 +149,8 @@ func (im IBCModule) OnRecvPacket(
}
```

### Legacy API

## `RegisterInterchainAccount`

The authentication module can begin registering interchain accounts by calling `RegisterInterchainAccount`:
Expand Down
2 changes: 1 addition & 1 deletion docs/apps/interchain-accounts/integration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
order: 3
order: 2
-->

# Integration
Expand Down
74 changes: 74 additions & 0 deletions docs/apps/interchain-accounts/messages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<!--
order: 3
-->

# Messages

## `MsgRegisterInterchainAccount`

An Interchain Accounts channel handshake can be initated using `MsgRegisterInterchainAccount`:

```go
type MsgRegisterInterchainAccount struct {
Owner string
ConnectionID string
Version string
}
```

This message is expected to fail if:

- `Owner` is an empty string.
- `ConnectionID` 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)).

This message will construct a new `MsgChannelOpenInit` on chain and route it to the core IBC message server to initiate the opening step of the channel handshake.

The controller module will generate a new port identifier and claim the associated port capability. The caller is expected to provide an appropriate application version string. For example, this may be an ICS27 JSON encoded `Metadata` type or an ICS29 JSON encoded `Metadata` type with a nested application version.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add some links to the each of the Metadata types mentioned here? Just to make it easier for the reader to see the differences?

If the `Version` string omitted the application will construct a default version string in the `OnChanOpenInit` handshake callback.
damiannolan marked this conversation as resolved.
Show resolved Hide resolved

```go
type MsgRegisterInterchainAccountResponse struct {
ChannelID string
}
```

The `ChannelID` is return in the message response.


## `MsgSendTx`

An Interchain Accounts transaction can be executed on a remote host chain by sending a `MsgSendTx` from the corresponding controller chain:

```go
type MsgSendTx struct {
Owner string
ConnectionID string
PacketData InterchainAccountPacketData
RelativeTimeout uint64
}
```

This message is expected to fail if:

- `Owner` is an empty string.
- `ConnectionID` 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)).
- `PacketData` contains an `UNSPECIFIED` type enum, the length of `Data` bytes is zero or the `Memo` field exceeds `256` characters in length.
damiannolan marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we talk somewhere (maybe in a CLI section) about the cli to construct the packet data? Otherwise it might be difficult for users to know that it is available.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And maybe it's also worth explaining how to use the query for packet events to see what happened with the message(s) executed on the host?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

- `RelativeTimeout` is zero.

This message will create a new IBC packet with the provided `PacketData` and send it via the channel associated with the `Owner` and `ConnectionID`.
The `PacketData` is expected to contain a list of serialized `[]sdk.Msg` in the form of `CosmosTx`. Please note the signer field of each `sdk.Msg` must be the interchain account address.
When the packet is relayed to the host chain, the `PacketData` is unmarshalled and the messages are authenticated and executed.

```go
type MsgSendTxResponse struct {
Sequence uint64
}
```

The packet `Sequence` is returned in the message response.

### Atomicity

As the Interchain Accounts module supports the execution of multiple transactions using the Cosmos SDK `Msg` interface, it provides the same atomicity guarantees as Cosmos SDK-based applications, leveraging the [`CacheMultiStore`](https://docs.cosmos.network/main/core/store.html#cachemultistore) architecture provided by the [`Context`](https://docs.cosmos.network/main/core/context.html) type.

This provides atomic execution of transactions when using Interchain Accounts, where state changes are only committed if all `Msg`s succeed.
Comment on lines +120 to +124
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this section from the transactions.md file and removed it since the other points were regarding auth modules

25 changes: 9 additions & 16 deletions docs/apps/interchain-accounts/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,28 @@ order: 1

# Overview

Learn about what the Interchain Accounts module is, and how to build custom modules that utilize Interchain Accounts functionality {synopsis}

Learn about what the Interchain Accounts module is {synopsis}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've trimmed down the Overview doc quiet a bit. A lot of it had referenced authentication modules


## What is the Interchain Accounts module?

Interchain Accounts is the Cosmos SDK implementation of the ICS-27 protocol, which enables cross-chain account management built upon IBC. Chains using the Interchain Accounts module can programmatically create accounts on other chains and control these accounts via IBC transactions.

Interchain Accounts exposes a simple-to-use API which means IBC application developers do not require an in-depth knowledge of the underlying low-level details of IBC or the ICS-27 protocol.
Interchain Accounts is the Cosmos SDK implementation of the ICS-27 protocol, which enables cross-chain account management built upon IBC.

Developers looking to build upon Interchain Accounts must write custom logic in their own IBC application module, called authentication modules.
- How does an interchain account differ from a regular account?

- How is an interchain account different than a regular account?

Regular accounts use a private key to sign transactions on-chain. Interchain Accounts are instead controlled programmatically by separate chains via IBC transactions. Interchain Accounts are implemented as sub-accounts of the interchain accounts module account.
Regular accounts use a private key to sign transactions. Interchain Accounts are instead controlled programmatically by counterparty chains via IBC packets.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was incorrect, transactions are not signed on chain.


## Concepts

`Host Chain`: The chain where the interchain account is registered. The host chain listens for IBC packets from a controller chain which should contain instructions (e.g. cosmos SDK messages) for which the interchain account will execute.

`Controller Chain`: The chain registering and controlling an account on a host chain. The controller chain sends IBC packets to the host chain to control the account. A controller chain must have at least one interchain accounts authentication module in order to act as a controller chain.
`Host Chain`: The chain where the interchain account is registered. The host chain listens for IBC packets from a controller chain which should contain instructions (e.g. Cosmos SDK messages) for which the interchain account will execute.

`Authentication Module`: A custom IBC application module on the controller chain that uses the Interchain Accounts module API to build custom logic for the creation & management of interchain accounts. For a controller chain to utilize the interchain accounts module functionality, an authentication module is required.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we still keep this but say that authentication modules are deprecated?

`Controller Chain`: The chain registering and controlling an account on a host chain. The controller chain sends IBC packets to the host chain to control the account.

`Interchain Account`: An account on a host chain. An interchain account has all the capabilities of a normal account. However, rather than signing transactions with a private key, a controller chain's authentication module will send IBC packets to the host chain which signals what transactions the interchain account should execute.
`Interchain Account`: An account on a host chain created using the ICS-27 protocol. An interchain account has all the capabilities of a normal account. However, rather than signing transactions with a private key, a controller chain will send IBC packets to the host chain which signals what transactions the interchain account should execute.

## SDK Security Model

SDK modules on a chain are assumed to be trustworthy. For example, there are no checks to prevent an untrustworthy module from accessing the bank keeper.

The implementation of ICS27 on ibc-go uses this assumption in its security considerations. The implementation assumes the authentication module will not try to open channels on owner addresses it does not control.
The implementation of ICS-27 in ibc-go uses this assumption in its security considerations.

The implementation assumes other IBC application modules will not bind to ports within the ICS27 namespace.
The implementation assumes other IBC application modules will not bind to ports within the ICS-27 namespace.
2 changes: 1 addition & 1 deletion docs/apps/interchain-accounts/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ For example, a Cosmos SDK based chain that elects to provide hosted Interchain A
"allow_messages": ["/cosmos.staking.v1beta1.MsgDelegate", "/cosmos.gov.v1beta1.MsgVote"]
}
```
There is also a special wildcard `"*"` message type which allows any type of message to be executed by the interchain account. This must be the only message in the `allow_messages` array.
There is also a special wildcard `"*"` value which allows any type of message to be executed by the interchain account. This must be the only value in the `allow_messages` array.

```
"params": {
Expand Down
21 changes: 0 additions & 21 deletions docs/apps/interchain-accounts/transactions.md

This file was deleted.

Loading