Skip to content

Commit

Permalink
Merge branch 'main' of github.com:cosmos/ibc-go into colin/2009-sm-cl…
Browse files Browse the repository at this point in the history
…ient-registration
  • Loading branch information
colin-axner committed Nov 29, 2022
2 parents 45e6bb5 + 83f1cd1 commit 6665e6d
Show file tree
Hide file tree
Showing 15 changed files with 463 additions and 121 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"chain-a": ["release-v6.0.x"],
"chain-b": ["release-v6.0.x"],
"entrypoint": ["TestInterchainAccountsGovTestSuite"],
"test": [
"TestInterchainAccountsGovIntegration"
],
"chain-binary": ["simd"],
"chain-image": ["ghcr.io/cosmos/ibc-go-simd"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"chain-a": ["release-v6.0.x"],
"chain-b": ["release-v6.0.x"],
"entrypoint": ["TestInterchainAccountsGroupsTestSuite"],
"test": [
"TestInterchainAccountsGroupsIntegration"
],
"chain-binary": ["simd"],
"chain-image": ["ghcr.io/cosmos/ibc-go-simd"]
}
5 changes: 4 additions & 1 deletion .github/workflows/e2e-compatibility-workflow-call.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ jobs:
fail-fast: false
matrix: ${{ fromJSON(needs.load-test-matrix.outputs.test-matrix) }}
steps:
- uses: actions/checkout@v3
- name: Checkout the ibc-go repo
uses: actions/checkout@v3
with:
repository: cosmos/ibc-go
- uses: actions/setup-go@v3
with:
go-version: 1.18
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/e2e-compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,22 @@ jobs:
uses: ./.github/workflows/e2e-compatibility-workflow-call.yaml
with:
test-file-directory: "${{ needs.determine-test-directory.outputs.test-directory }}"
test-suite: "incentivized-transfer-chain-b"
test-suite: "incentivized-transfer-chain-b"

ica-groups-chain-a:
needs:
- build-release-images
- determine-test-directory
uses: ./.github/workflows/e2e-compatibility-workflow-call.yaml
with:
test-file-directory: "${{ needs.determine-test-directory.outputs.test-directory }}"
test-suite: "ica-groups-chain-a"

ica-gov-chain-a:
needs:
- build-release-images
- determine-test-directory
uses: ./.github/workflows/e2e-compatibility-workflow-call.yaml
with:
test-file-directory: "${{ needs.determine-test-directory.outputs.test-directory }}"
test-suite: "ica-gov-chain-a"
14 changes: 6 additions & 8 deletions .github/workflows/e2e-manual-icad.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,21 @@ on:
default: master
options:
- master
- v0.4.0
- v0.4.1
- v0.3.5
- v0.3.4
- v0.2.3
- v0.1.4
- v0.2.5
- v0.1.7
chain-b-tag:
default: master
description: 'The tag to use for chain B'
required: true
type: choice
options:
- master
- v0.4.0
- v0.4.1
- v0.3.5
- v0.3.4
- v0.2.3
- v0.1.4
- v0.2.5
- v0.1.7
relayer-tag:
description: 'The tag to use for the relayer'
required: true
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Features

* (light-clients/06-solomachine) [\#2826](https://github.com/cosmos/ibc-go/pull/2826) Add `AppModuleBasic` for the 06-solomachine client and remove solo machine type registration from core IBC. Chains must register the `AppModuleBasic` of light clients.
* (light-clients/07-tendermint) [\#2825](https://github.com/cosmos/ibc-go/pull/2825) Add `AppModuleBasic` for the 07-tendermint client and remove tendermint type registration from core IBC. Chains must register the `AppModuleBasic` of light clients.
* (light-clients/07-tendermint) [\#2800](https://github.com/cosmos/ibc-go/pull/2800) Add optional in-place store migration function to prune all expired tendermint consensus states.
* (core/24-host) [\#2820](https://github.com/cosmos/ibc-go/pull/2820) Add `MustParseClientStatePath` which parses the clientID from a client state key path.
* (apps/27-interchain-accounts) [\#2147](https://github.com/cosmos/ibc-go/pull/2147) Adding a `SubmitTx` gRPC endpoint for the ICS27 Controller module which allows owners of interchain accounts to submit transactions. This replaces the previously existing need for authentication modules to implement this standard functionality.
* (testing/simapp) [\#2190](https://github.com/cosmos/ibc-go/pull/2190) Adding the new `x/group` cosmos-sdk module to simapp.
Expand Down
92 changes: 53 additions & 39 deletions docs/migrations/v6-to-v7.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Migrating from ibc-go v5 to v6
# Migrating from ibc-go v6 to v7

This document is intended to highlight significant changes which may require more information than presented in the CHANGELOG.
Any changes that must be done by a user of ibc-go should be documented here.
Expand All @@ -13,21 +13,70 @@ There are four sections based on the four potential user groups of this document

## Chains

Chains will perform automatic migrations to remove existing localhost clients and to migrate the solomachine to v3 of the protobuf definition.

An optional upgrade handler has been added to prune expired tendermint consensus states. It may be used during any upgrade (from v7 onwards).
Add the following to the function call to the upgrade handler in `app/app.go`, to perform the optional state pruning.

```go
import (
// ...
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
)

// ...

app.UpgradeKeeper.SetUpgradeHandler(
upgradeName,
func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) {
// prune expired tendermint consensus states to save storage space
ibctm.PruneTendermintConsensusStates(ctx, app.Codec, appCodec, keys[ibchost.StoreKey])

return app.mm.RunMigrations(ctx, app.configurator, fromVM)
},
)
```

Checkout the logs to see how many consensus states are pruned.

### Light client registration

Chains must explicitly register the types of any light client modules it wishes to integrate.

#### Tendermint registration

To register the tendermint client, modify the `app.go` file to include the tendermint `AppModuleBasic`:

```
import (
// ...
+ ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
)
// ...
ModuleBasics = module.NewBasicManager(
...
ibc.AppModuleBasic{},
+ ibctm.AppModuleBasic{},
...
)
```

It may be useful to reference the [PR](https://github.com/cosmos/ibc-go/pull/2825) which added the `AppModuleBasic` for the tendermint client.

#### Solo machine registration

To register the solo machine client, modify the `app.go` file to include the solo machine `AppModuleBasic`:

```diff
import (
...
// ...
+ solomachine "github.com/cosmos/ibc-go/v6/modules/light-clients/06-solomachine"
...
)
...

// ...

ModuleBasics = module.NewBasicManager(
...
ibc.AppModuleBasic{},
Expand Down Expand Up @@ -80,41 +129,6 @@ A zero proof height is now allowed by core IBC and may be passed into `VerifyMem

The `GetRoot` function has been removed from consensus state interface since it was not used by core IBC.

### Light client implementations

The `09-localhost` light client implementation has been removed because it is currently non-functional.

An upgrade handler has been added to supply chain developers with the logic needed to prune the ibc client store and successfully complete the removal of `09-localhost`.
Add the following to the application upgrade handler in `app/app.go`, calling `MigrateToV6` to perform store migration logic.

```go
import (
// ...
ibcv6 "github.com/cosmos/ibc-go/v6/modules/core/migrations/v6"
)

// ...

app.UpgradeKeeper.SetUpgradeHandler(
upgradeName,
func(ctx sdk.Context, _ upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) {
// prune the 09-localhost client from the ibc client store
ibcv6.MigrateToV6(ctx, app.IBCKeeper.ClientKeeper)

return app.mm.RunMigrations(ctx, app.configurator, fromVM)
},
)
```

Please note the above upgrade handler is optional and should only be run if chains have an existing `09-localhost` client stored in state.
A simple query can be performed to check for a `09-localhost` client on chain.

For example:

```
simd query ibc client states | grep 09-localhost
```

### Client Keeper

Keeper function `CheckMisbehaviourAndUpdateState` has been removed since function `UpdateClient` can now handle updating `ClientState` on `ClientMessage` type which can be any `Misbehaviour` implementations.
Expand Down
2 changes: 0 additions & 2 deletions modules/core/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import (
connectiontypes "github.com/cosmos/ibc-go/v6/modules/core/03-connection/types"
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
commitmenttypes "github.com/cosmos/ibc-go/v6/modules/core/23-commitment/types"
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint"
)

// RegisterInterfaces registers x/ibc interfaces into protobuf Any.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
clienttypes.RegisterInterfaces(registry)
connectiontypes.RegisterInterfaces(registry)
channeltypes.RegisterInterfaces(registry)
ibctm.RegisterInterfaces(registry)
commitmenttypes.RegisterInterfaces(registry)
}
56 changes: 15 additions & 41 deletions modules/light-clients/06-solomachine/solomachine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

transfertypes "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v6/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v6/modules/core/04-channel/types"
host "github.com/cosmos/ibc-go/v6/modules/core/24-host"
Expand All @@ -23,6 +24,7 @@ import (

var (
channelIDSolomachine = "channel-on-solomachine" // channelID generated on solo machine side
clientIDSolomachine = "06-solomachine-0"
)

type SoloMachineTestSuite struct {
Expand Down Expand Up @@ -78,13 +80,12 @@ func (suite *SoloMachineTestSuite) SetupSolomachine() string {

func (suite *SoloMachineTestSuite) TestRecvPacket() {
channelID := suite.SetupSolomachine()

packet := channeltypes.NewPacket(
mock.MockPacketData,
1,
mock.PortID,
transfertypes.PortID,
channelIDSolomachine,
mock.PortID,
transfertypes.PortID,
channelID,
clienttypes.ZeroHeight(),
uint64(suite.chainA.GetContext().BlockTime().Add(time.Hour).UnixNano()),
Expand All @@ -96,70 +97,43 @@ func (suite *SoloMachineTestSuite) TestRecvPacket() {

// close init is not necessary as the solomachine implementation is mocked

suite.solomachine.ChanCloseConfirm(suite.chainA, channelID)
suite.solomachine.ChanCloseConfirm(suite.chainA, transfertypes.PortID, channelID)
}

func (suite *SoloMachineTestSuite) TestAcknowledgePacket() {
channelID := suite.SetupSolomachine()

packet := channeltypes.NewPacket(
mock.MockPacketData,
1,
mock.PortID,
channelID,
mock.PortID,
channelIDSolomachine,
clienttypes.ZeroHeight(),
uint64(suite.chainA.GetContext().BlockTime().Add(time.Hour).UnixNano()),
)

suite.solomachine.SendPacket(suite.chainA, packet)
packet := suite.solomachine.SendTransfer(suite.chainA, transfertypes.PortID, channelID)

// recv packet is not necessary as the solo machine implementation is mocked

suite.solomachine.AcknowledgePacket(suite.chainA, packet)

// close init is not necessary as the solomachine implementation is mocked

suite.solomachine.ChanCloseConfirm(suite.chainA, channelID)
suite.solomachine.ChanCloseConfirm(suite.chainA, transfertypes.PortID, channelID)
}

func (suite *SoloMachineTestSuite) TestTimeout() {
channelID := suite.SetupSolomachine()
packet := suite.solomachine.SendTransfer(suite.chainA, transfertypes.PortID, channelID, func(msg *transfertypes.MsgTransfer) {
msg.TimeoutTimestamp = suite.solomachine.Time + 1
})

packet := channeltypes.NewPacket(
mock.MockPacketData,
1,
mock.PortID,
channelID,
mock.PortID,
channelIDSolomachine,
clienttypes.ZeroHeight(),
1,
)
// simulate solomachine time increment
suite.solomachine.Time++

suite.solomachine.SendPacket(suite.chainA, packet)
suite.solomachine.UpdateClient(suite.chainA, clientIDSolomachine)

suite.solomachine.TimeoutPacket(suite.chainA, packet)

suite.solomachine.ChanCloseConfirm(suite.chainA, channelID)
suite.solomachine.ChanCloseConfirm(suite.chainA, transfertypes.PortID, channelID)
}

func (suite *SoloMachineTestSuite) TestTimeoutOnClose() {
channelID := suite.SetupSolomachine()

packet := channeltypes.NewPacket(
mock.MockPacketData,
1,
mock.PortID,
channelID,
mock.PortID,
channelIDSolomachine,
clienttypes.ZeroHeight(),
1,
)

suite.solomachine.SendPacket(suite.chainA, packet)
packet := suite.solomachine.SendTransfer(suite.chainA, transfertypes.PortID, channelID)

suite.solomachine.TimeoutPacketOnClose(suite.chainA, packet, channelID)
}
Expand Down
Loading

0 comments on commit 6665e6d

Please sign in to comment.