Skip to content

Commit

Permalink
feat!: allow UNORDERED channels (#74)
Browse files Browse the repository at this point in the history
* imp: added unordered message

* refactor

* fix: stopped closing channel premptively

* e2e: modified tests to accept ordering

* deps: bumped version

* deps(testing): ran cargo update

* test: added migration test

* deps: ran cargo update

* imp: assert ordering

* imp: added new timeout test

* e2e: added migration test

* docs: added versioned docs

* docs: versions

* docs: updated docs

* deps: ran 'npm install --save @docusaurus/plugin-client-redirects'

* imp: allow reopen with different params

* docs: fix

* fix
  • Loading branch information
srdtrk authored Feb 3, 2024
1 parent d43e3e6 commit 71a27a8
Show file tree
Hide file tree
Showing 38 changed files with 1,462 additions and 204 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,22 @@ jobs:
fail-fast: false
matrix:
test:
- TestIcaContractChannelHandshake
- TestIcaContractChannelHandshake_Ordered_Protobuf
- TestIcaContractChannelHandshake_Ordered_Proto3Json
- TestIcaContractChannelHandshake_Unordered_Protobuf
- TestIcaContractChannelHandshake_Unordered_Proto3Json
- TestIcaRelayerInstantiatedChannelHandshake
- TestRecoveredIcaContractInstantiatedChannelHandshake
- TestIcaContractExecutionProto3JsonEncoding
- TestIcaContractExecutionProtobufEncoding
- TestIcaContractTimeoutPacket
- TestIcaContractExecution_Ordered_Proto3Json
- TestIcaContractExecution_Unordered_Protobuf
- TestIcaContractTimeoutPacket_Ordered_Proto3Json
- TestIcaContractTimeoutPacket_Unordered_Protobuf
- TestOwnerCreateIcaContract
- TestOwnerPredefinedAction
- TestSendCosmosMsgsProto3JsonEncoding
- TestSendCosmosMsgsProtobufEncoding
- TestSendCosmosMsgs_Ordered_Proto3Json
- TestSendCosmosMsgs_Unordered_Protobuf
- TestSendWasmMsgsProtobufEncoding
- TestMigrateOrderedToUnordered
name: ${{ matrix.test }}
runs-on: ubuntu-latest
steps:
Expand Down
73 changes: 51 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cw-ica-controller"
version = "0.4.2"
version = "0.5.0"
authors = ["srdtrk <srdtrk@hotmail.com>"]
edition = "2021"
description = "This is a CosmWasm implementation of an ICS-27 interchain accounts controller."
Expand Down Expand Up @@ -65,3 +65,4 @@ base64 = "0.13.1"
cw-ica-controller_v0_1_3 = { package = "cw-ica-controller", version = "=0.1.3" }
cw-ica-controller_v0_2_0 = { package = "cw-ica-controller", version = "=0.2.0" }
cw-ica-controller_v0_3_0 = { package = "cw-ica-controller", version = "=0.3.0" }
cw-ica-controller_v0_4_2= { package = "cw-ica-controller", version = "=0.4.2" }
2 changes: 1 addition & 1 deletion docs/docs/00-intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Introduction
sidebar_label: Introduction
sidebar_position: 0
slug: /intro
slug: /
---

import HighlightTag from '@site/src/components/HighlightTag';
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/contract-api/01-instantiate-msg.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ If left empty, the owner is set to the sender of the `InstantiateMsg`.
### `channel_open_init_options`

```rust reference
https://github.com/srdtrk/cw-ica-controller/blob/v0.4.0/src/types/msg.rs#L120-L132
https://github.com/srdtrk/cw-ica-controller/blob/29472c6b30704c101268b9d2971ddfd8b91b24b1/src/types/msg.rs#L122-L138
```

These are the options required for the contract to initiate an ICS-27 channel open handshake.
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/contract-api/04-callbacks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ If the callback contract returns an error, the `cw-ica-controller` will not proc
with the packet acknowledgement.
3. If the callback contract returns an error in response to a `OnTimeoutPacketCallback` callback, then the `cw-ica-controller` will not proceed with the packet timeout.

Since ICA channels are ordered, cases 2 and 3 will result in the halting of the channel until the callback contract returns a successful response.
If the ICA channel is ordered, cases 2 and 3 will result in the halting of the channel until the callback contract returns a successful response.

:::

Expand Down
8 changes: 0 additions & 8 deletions docs/docs/how-it-works/03-channel-handshake.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ https://github.com/srdtrk/cw-ica-controller/blob/v0.4.2/src/contract.rs#L130-L13

Whenever a new channel is created, the submitter of `MsgChannelOpenInit` must propose a version string and ordering.

:::info

Interchain Accounts currently only supports ordered channels. This means that a timed-out packet will close the
channel. In the upcoming `ibc-go` v8.1 release, unordered channels will be supported, which will allow for the
ICA channels to remain open even after a packet times out.

:::

In IBC, the version string is used to determine whether or not the two modules on either side of the channel are
compatible. The two modules are compatible if and only if they both support and agree on the same version string.
Moreover, the version string may carry arbitrary metadata encoded in JSON format. This metadata can be used to
Expand Down
34 changes: 33 additions & 1 deletion docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,22 @@ const config: Config = {
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/srdtrk/cw-ica-controller/tree/feat/docusaurus-docs/docs',
// Routed the docs to the root path
routeBasePath: "/",
sidebarCollapsed: false,
// Select the latest version
lastVersion: "v0.4.x",
versions: {
current: {
label: 'main',
path: 'main',
banner: 'unreleased',
},
"v0.4.x": {
label: 'v0.4',
path: 'v0.4',
},
},
},
theme: {
customCss: './src/css/custom.css',
Expand Down Expand Up @@ -81,6 +96,11 @@ const config: Config = {
position: 'left',
label: 'Documentation',
},
{
type: "docsVersionDropdown",
position: "right",
dropdownActiveClassDisabled: true,
},
{
href: 'https://github.com/srdtrk/cw-ica-controller',
label: 'GitHub',
Expand All @@ -96,7 +116,7 @@ const config: Config = {
items: [
{
label: 'Documentation',
to: '/docs/intro',
to: '/main',
},
],
},
Expand Down Expand Up @@ -141,6 +161,18 @@ const config: Config = {
},
} satisfies Preset.ThemeConfig,
plugins: [
[
"@docusaurus/plugin-client-redirects",
{
// makes the default page next in production
redirects: [
{
from: ["/", "/master", "/next", "/docs"],
to: "/main",
},
],
},
],
async function myPlugin(context, options) {
return {
name: "docusaurus-tailwindcss",
Expand Down
24 changes: 24 additions & 0 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"dependencies": {
"@docusaurus/core": "^3.1.1",
"@docusaurus/plugin-client-redirects": "^3.1.1",
"@docusaurus/preset-classic": "^3.1.1",
"@easyops-cn/docusaurus-search-local": "^0.40.1",
"@mdx-js/react": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function HomepageHeader() {
<div className={styles.buttons}>
<Link
className="button button--secondary button--lg"
to="/docs/intro">
to="/main">
Documentation
</Link>
</div>
Expand Down
Loading

0 comments on commit 71a27a8

Please sign in to comment.