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

Allow host_connection_id in version metadata to be empty on ChanOpenInit #5533

Merged
merged 63 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
2f33154
remove host connection ID in default metadata
GNaD13 Jan 7, 2024
e535ddb
allow empty host connection id in validateConnectionParams
GNaD13 Jan 7, 2024
670ff0d
add host connection id to the metadata on host open try
GNaD13 Jan 7, 2024
bc119a7
nit
GNaD13 Jan 7, 2024
d0f0831
add test init with empty host connection ID
GNaD13 Jan 7, 2024
a37e7f1
add test host
GNaD13 Jan 7, 2024
0e377ef
correct test
GNaD13 Jan 7, 2024
b9f280b
nit
GNaD13 Jan 7, 2024
c92c59b
lint
Jan 8, 2024
677865d
Merge branch 'main' into dang/host-connection-id
Jan 8, 2024
fc05c68
remove assert
GNaD13 Jan 8, 2024
4280d46
Merge remote-tracking branch 'decent/dang/host-connection-id' into da…
GNaD13 Jan 8, 2024
1162019
TestOnChanOpenInit
GNaD13 Jan 9, 2024
237ade9
OnChanOpenTry
GNaD13 Jan 9, 2024
b53a2ff
TestOnChanUpgradeInit
GNaD13 Jan 9, 2024
0324206
TestOnChanUpgradeTry
GNaD13 Jan 9, 2024
b8e8fe2
TestOnChanUpgradeTry
GNaD13 Jan 9, 2024
a1a5e0f
remove check
GNaD13 Jan 9, 2024
e1d2f77
test
GNaD13 Jan 9, 2024
cbb39da
test
GNaD13 Jan 9, 2024
6d86f85
nit
GNaD13 Jan 9, 2024
840953f
Merge remote-tracking branch 'origin/main' into dang/host-connection-id
GNaD13 Jan 9, 2024
61f3fb5
nit
GNaD13 Jan 10, 2024
e222c4b
add check version
GNaD13 Jan 10, 2024
0b0b7d0
NewDefaultMetadataString
GNaD13 Jan 10, 2024
858954b
e2e
GNaD13 Jan 10, 2024
3b092a6
change func name and var place
GNaD13 Jan 17, 2024
ad3e344
callbacks
GNaD13 Jan 17, 2024
27d488f
revert icatypes.NewDefaultMetadataString
GNaD13 Jan 17, 2024
fd23ea2
add back NewDefaultMetadataString with hostConnectionID
GNaD13 Jan 17, 2024
ef00a21
nit
GNaD13 Jan 17, 2024
9abb309
nit
GNaD13 Jan 17, 2024
e7cce12
Merge remote-tracking branch 'origin/main' into dang/host-connection-id
GNaD13 Jan 18, 2024
5a6a68a
nit
GNaD13 Jan 18, 2024
cebec2b
remove unused code
GNaD13 Jan 18, 2024
56bbbc8
Merge branch 'main' into dang/host-connection-id
GNaD13 Jan 18, 2024
530ecd9
revert
GNaD13 Jan 19, 2024
553dd63
Merge remote-tracking branch 'decent/dang/host-connection-id' into da…
GNaD13 Jan 19, 2024
9ed3d4e
Merge branch 'main' into dang/host-connection-id
GNaD13 Jan 19, 2024
f2e58d9
Merge branch 'main' into dang/host-connection-id
DimitrisJim Jan 25, 2024
fca1943
Merge branch 'main' into dang/host-connection-id
Feb 1, 2024
de2ef57
address self-review comments
Feb 1, 2024
ef661c0
Merge branch 'cosmos:dang/host-connection-id' into dang/host-connecti…
Feb 1, 2024
6af728f
add import back
Feb 1, 2024
2903797
Merge branch 'cosmos:dang/host-connection-id' into dang/host-connecti…
Feb 1, 2024
cfd440a
some more refactoring
Feb 1, 2024
ceb0205
Merge branch 'cosmos:dang/host-connection-id' into dang/host-connecti…
Feb 1, 2024
61b3505
more cleanup
Feb 1, 2024
7cbf91e
Merge branch 'cosmos:dang/host-connection-id' into dang/host-connecti…
Feb 1, 2024
8f381a5
remove unused test
GNaD13 Feb 2, 2024
f9a8e4c
change set version func
GNaD13 Feb 2, 2024
2287133
lint
GNaD13 Feb 2, 2024
fbfbb0f
Merge branch 'main' into dang/host-connection-id
GNaD13 Feb 3, 2024
99b4443
Merge branch 'main' into dang/host-connection-id
GNaD13 Feb 9, 2024
e8501ec
Merge branch 'main' into dang/host-connection-id
GNaD13 Mar 5, 2024
e23cf85
still set host connection ID in our controller implementation
Mar 7, 2024
abcff64
remove empty lines
Mar 7, 2024
5b5b609
remove unnecessary line
Mar 8, 2024
883d795
add changelog
Mar 8, 2024
c2b7850
Merge branch 'main' into dang/host-connection-id
Mar 8, 2024
3606daa
Merge branch 'main' into dang/host-connection-id
Mar 8, 2024
59fdf13
Merge branch 'main' into dang/host-connection-id
Mar 12, 2024
d7cfafd
Merge branch 'main' into dang/host-connection-id
Mar 12, 2024
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
16 changes: 16 additions & 0 deletions docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,22 @@ There are four sections based on the four potential user groups of this document

## IBC Apps

### ICS27 - Interchain Accounts

- The signature of function `NewDefaultMetadata` has changed:

```diff
- func NewDefaultMetadata(controllerConnectionID, hostConnectionID string) Metadata
+ func NewDefaultMetadata(controllerConnectionID string) Metadata
```

- The signature of function `NewDefaultMetadataString` has changed:

```diff
- func NewDefaultMetadataString(controllerConnectionID, hostConnectionID string)
+ func NewDefaultMetadataString(controllerConnectionID string) string
```

### API removals

The `exported.ChannelI` and `exported.CounterpartyChannelI` interfaces have been removed. Please use the concrete types.
Expand Down
10 changes: 6 additions & 4 deletions e2e/tests/interchain_accounts/base_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (s *InterchainAccountsTestSuite) testMsgSendTxSuccessfulTransfer(order chan

t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) {
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, order)

txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount)
Expand Down Expand Up @@ -172,7 +172,7 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_FailedTransfer_InsufficientF

t.Run("broadcast MsgRegisterInterchainAccount", func(t *testing.T) {
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED)

txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount)
Expand Down Expand Up @@ -270,8 +270,9 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop
t.Run("register interchain account", func(t *testing.T) {
var err error
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED)

s.RegisterInterchainAccount(ctx, chainA, controllerAccount, msgRegisterInterchainAccount)
portID, err = icatypes.NewControllerPortID(controllerAddress)
s.Require().NoError(err)
Expand Down Expand Up @@ -368,8 +369,9 @@ func (s *InterchainAccountsTestSuite) TestMsgSendTx_SuccessfulTransfer_AfterReop
// on an ordered channel
t.Run("register interchain account", func(t *testing.T) {
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED)

s.RegisterInterchainAccount(ctx, chainA, controllerAccount, msgRegisterInterchainAccount)

s.Require().NoError(test.WaitForBlocks(ctx, 10, chainA, chainB))
Expand Down
3 changes: 2 additions & 1 deletion e2e/tests/interchain_accounts/gov_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ func (s *InterchainAccountsGovTestSuite) TestInterchainAccountsGovIntegration()
s.Require().NotNil(govModuleAddress)

t.Run("execute proposal for MsgRegisterInterchainAccount", func(t *testing.T) {
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, govModuleAddress.String(), version, channeltypes.ORDERED)

s.ExecuteAndPassGovV1Proposal(ctx, msgRegisterAccount, chainA, controllerAccount)
})

Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func (s *InterchainAccountsGroupsTestSuite) TestInterchainAccountsGroupsIntegrat

t.Run("submit proposal for MsgRegisterInterchainAccount", func(t *testing.T) {
groupPolicyAddr = s.QueryGroupPolicyAddress(ctx, chainA)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, groupPolicyAddr, icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID), channeltypes.ORDERED)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, groupPolicyAddr, icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID), channeltypes.ORDERED)

msgSubmitProposal, err := grouptypes.NewMsgSubmitProposal(groupPolicyAddr, []string{chainAAddress}, []sdk.Msg{msgRegisterAccount}, DefaultMetadata, grouptypes.Exec_EXEC_UNSPECIFIED, "e2e groups proposal: for MsgRegisterInterchainAccount", "e2e groups proposal: for MsgRegisterInterchainAccount")
s.Require().NoError(err)
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/interchain_accounts/localhost_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (s *LocalhostInterchainAccountsTestSuite) TestInterchainAccounts_Localhost(

s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA), "failed to wait for blocks")

version := icatypes.NewDefaultMetadataString(exported.LocalhostConnectionID, exported.LocalhostConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(exported.LocalhostConnectionID, exported.LocalhostConnectionID)
controllerPortID, err := icatypes.NewControllerPortID(userAWallet.FormattedAddress())
s.Require().NoError(err)

Expand Down Expand Up @@ -214,7 +214,7 @@ func (s *LocalhostInterchainAccountsTestSuite) TestInterchainAccounts_ReopenChan

s.Require().NoError(test.WaitForBlocks(ctx, 1, chainA), "failed to wait for blocks")

version := icatypes.NewDefaultMetadataString(exported.LocalhostConnectionID, exported.LocalhostConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(exported.LocalhostConnectionID, exported.LocalhostConnectionID)
controllerPortID, err := icatypes.NewControllerPortID(userAWallet.FormattedAddress())
s.Require().NoError(err)

Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/interchain_accounts/params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (s *InterchainAccountsParamsTestSuite) TestControllerEnabledParam() {

t.Run("ensure that broadcasting a MsgRegisterInterchainAccount fails", func(t *testing.T) {
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED)

txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount)
Expand Down
4 changes: 2 additions & 2 deletions e2e/tests/interchain_accounts/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (s *InterchainAccountsChannelUpgradesTestSuite) TestMsgSendTx_SuccessfulTra
t.Run("register interchain account", func(t *testing.T) {
var err error
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED)

txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterInterchainAccount)
Expand Down Expand Up @@ -249,7 +249,7 @@ func (s *InterchainAccountsChannelUpgradesTestSuite) TestChannelUpgrade_ICAChann
t.Run("register interchain account", func(t *testing.T) {
var err error
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterInterchainAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED)
txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterInterchainAccount)
s.AssertTxSuccess(txResp)
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/upgrades/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (s *GenesisTestSuite) TestIBCGenesis() {

t.Run("ics27: broadcast MsgRegisterInterchainAccount", func(t *testing.T) {
// explicitly set the version string because we don't want to use incentivized channels.
version := icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
msgRegisterAccount := controllertypes.NewMsgRegisterInterchainAccount(ibctesting.FirstConnectionID, controllerAddress, version, channeltypes.ORDERED)

txResp := s.BroadcastMessages(ctx, chainA, controllerAccount, msgRegisterAccount)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,7 @@ var (
TestPortID, _ = icatypes.NewControllerPortID(TestOwnerAddress)

// TestVersion defines a reusable interchainaccounts version string for testing purposes
TestVersion = string(icatypes.ModuleCdc.MustMarshalJSON(&icatypes.Metadata{
Version: icatypes.Version,
ControllerConnectionId: ibctesting.FirstConnectionID,
HostConnectionId: ibctesting.FirstConnectionID,
Encoding: icatypes.EncodingProtobuf,
TxType: icatypes.TxTypeSDKMultiMsg,
}))
TestVersion = icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
)

type InterchainAccountsTestSuite struct {
Expand Down Expand Up @@ -244,7 +238,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanOpenInit() {
)

if tc.expPass {
suite.Require().Equal(icatypes.NewDefaultMetadataString(path.EndpointA.ConnectionID, path.EndpointB.ConnectionID), version)
suite.Require().Equal(TestVersion, version)
suite.Require().NoError(err)
} else {
suite.Require().Error(err)
Expand Down Expand Up @@ -828,8 +822,7 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeInit() {
err := RegisterInterchainAccount(path.EndpointA, TestOwnerAddress)
suite.Require().NoError(err)

metadata := icatypes.NewDefaultMetadata(path.EndpointA.ConnectionID, path.EndpointB.ConnectionID)
version = string(icatypes.ModuleCdc.MustMarshalJSON(&metadata))
version = icatypes.NewDefaultMetadataStringWithHostConnectionID(path.EndpointA.ConnectionID, path.EndpointB.ConnectionID)

tc.malleate() // malleate mutates test data

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,18 @@ func (k Keeper) OnChanOpenInit(
err error
metadata icatypes.Metadata
)
if strings.TrimSpace(version) == "" {
crodriguezvega marked this conversation as resolved.
Show resolved Hide resolved
connection, err := k.channelKeeper.GetConnection(ctx, connectionHops[0])
if err != nil {
return "", err
}

metadata = icatypes.NewDefaultMetadata(connectionHops[0], connection.Counterparty.ConnectionId)
if strings.TrimSpace(version) == "" {
metadata = icatypes.NewDefaultMetadata(connectionHops[0])
} else {
metadata, err = icatypes.MetadataFromVersion(version)
if err != nil {
return "", err
}
}

if err := icatypes.ValidateControllerMetadata(ctx, k.channelKeeper, connectionHops, metadata); err != nil {
return "", err
if err := icatypes.ValidateControllerMetadata(ctx, k.channelKeeper, connectionHops, metadata); err != nil {
return "", err
}
}

activeChannelID, found := k.GetActiveChannelID(ctx, connectionHops[0], portID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ const (

func (suite *KeeperTestSuite) TestOnChanOpenInit() {
var (
channel *channeltypes.Channel
path *ibctesting.Path
chanCap *capabilitytypes.Capability
metadata icatypes.Metadata
channel *channeltypes.Channel
path *ibctesting.Path
chanCap *capabilitytypes.Capability
metadata icatypes.Metadata
expectedVersion string
)

testCases := []struct {
Expand Down Expand Up @@ -54,6 +55,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() {
"success: empty channel version returns default metadata JSON string",
func() {
channel.Version = ""
expectedVersion = icatypes.NewDefaultMetadataString(path.EndpointA.ConnectionID)
},
nil,
},
Expand Down Expand Up @@ -173,14 +175,6 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() {
},
connectiontypes.ErrConnectionNotFound,
},
{
"connection not found with default empty channel version",
func() {
channel.ConnectionHops = []string{"connection-10"}
channel.Version = ""
},
connectiontypes.ErrConnectionNotFound,
},
{
"invalid controller connection ID",
func() {
Expand Down Expand Up @@ -278,6 +272,8 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() {
versionBytes, err := icatypes.ModuleCdc.MarshalJSON(&metadata)
suite.Require().NoError(err)

expectedVersion = string(versionBytes)

counterparty := channeltypes.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID)
channel = &channeltypes.Channel{
State: channeltypes.INIT,
Expand All @@ -299,7 +295,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() {
expPass := tc.expError == nil
if expPass {
suite.Require().NoError(err)
suite.Require().Equal(string(versionBytes), version)
suite.Require().Equal(expectedVersion, version)
} else {
suite.Require().Error(err)
suite.Require().ErrorIs(err, tc.expError)
Expand Down Expand Up @@ -657,7 +653,8 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeInit() {
suite.Require().NoError(err)

order = channeltypes.ORDERED
metadata = icatypes.NewDefaultMetadata(path.EndpointA.ConnectionID, path.EndpointB.ConnectionID)
metadata = icatypes.NewDefaultMetadata(path.EndpointA.ConnectionID)
metadata.HostConnectionId = path.EndpointB.ConnectionID
// use the same address as the previous metadata.
metadata.Address = currentMetadata.Address

Expand Down Expand Up @@ -824,7 +821,9 @@ func (suite *KeeperTestSuite) TestOnChanUpgradeAck() {
currentMetadata, err := suite.chainA.GetSimApp().ICAControllerKeeper.GetAppMetadata(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)
suite.Require().NoError(err)

metadata = icatypes.NewDefaultMetadata(path.EndpointA.ConnectionID, path.EndpointB.ConnectionID)
metadata = icatypes.NewDefaultMetadata(path.EndpointA.ConnectionID)
// add host connection id to metadata
metadata.HostConnectionId = path.EndpointB.ConnectionID
// use the same address as the previous metadata.
metadata.Address = currentMetadata.Address

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ type MigrationsTestSuite struct {
}

func (suite *MigrationsTestSuite) SetupTest() {
version := icatypes.NewDefaultMetadataStringWithHostConnectionID(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)

suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2)

suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1))
Expand All @@ -38,8 +40,8 @@ func (suite *MigrationsTestSuite) SetupTest() {
suite.path.EndpointB.ChannelConfig.PortID = icatypes.HostPortID
suite.path.EndpointA.ChannelConfig.Order = channeltypes.ORDERED
suite.path.EndpointB.ChannelConfig.Order = channeltypes.ORDERED
suite.path.EndpointA.ChannelConfig.Version = icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
suite.path.EndpointB.ChannelConfig.Version = icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID)
suite.path.EndpointA.ChannelConfig.Version = version
suite.path.EndpointB.ChannelConfig.Version = version
}

func (suite *MigrationsTestSuite) SetupPath() error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestMsgRegisterInterchainAccountValidateBasic(t *testing.T) {
func() {
feeMetadata := feetypes.Metadata{
FeeVersion: feetypes.Version,
AppVersion: icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID),
AppVersion: icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID),
}

bz := feetypes.ModuleCdc.MustMarshalJSON(&feeMetadata)
Expand Down Expand Up @@ -87,7 +87,7 @@ func TestMsgRegisterInterchainAccountValidateBasic(t *testing.T) {
msg = types.NewMsgRegisterInterchainAccount(
ibctesting.FirstConnectionID,
ibctesting.TestAccAddress,
icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID, ibctesting.FirstConnectionID),
icatypes.NewDefaultMetadataString(ibctesting.FirstConnectionID),
channeltypes.ORDERED,
)

Expand Down
3 changes: 2 additions & 1 deletion modules/apps/27-interchain-accounts/host/ibc_module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanUpgradeTry() {
interchainAccountAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), path.EndpointB.ConnectionID, path.EndpointA.ChannelConfig.PortID)
suite.Require().True(found)

metadata := icatypes.NewDefaultMetadata(path.EndpointA.ConnectionID, path.EndpointB.ConnectionID)
metadata := icatypes.NewDefaultMetadata(path.EndpointA.ConnectionID)
metadata.HostConnectionId = path.EndpointB.ConnectionID
metadata.Address = interchainAccountAddr
metadata.Encoding = icatypes.EncodingProto3JSON // this is the actual change to the version
path.EndpointA.ChannelConfig.ProposedUpgrade.Fields.Version = string(icatypes.ModuleCdc.MustMarshalJSON(&metadata))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ func (k Keeper) OnChanOpenTry(
return "", err
}

// set here the HostConnectionId because the controller did not set it
metadata.HostConnectionId = connectionHops[0]

if err = icatypes.ValidateHostMetadata(ctx, k.channelKeeper, connectionHops, metadata); err != nil {
return "", err
}
Expand Down
Loading
Loading