diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 7216ccb7fa8..87af9ae9c6f 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -167,7 +167,7 @@ func (k Keeper) IsActiveChannel(ctx sdk.Context, connectionID, portID string) bo // GetInterchainAccountAddress retrieves the InterchainAccount address from the store associated with the provided connectionID and portID func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, connectionID, portID string) (string, bool) { store := ctx.KVStore(k.storeKey) - key := icatypes.KeyOwnerAccount(connectionID, portID) + key := icatypes.KeyOwnerAccount(portID, connectionID) if !store.Has(key) { return "", false @@ -186,8 +186,8 @@ func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []icatypes.RegisteredI keySplit := strings.Split(string(iterator.Key()), "/") acc := icatypes.RegisteredInterchainAccount{ - ConnectionId: keySplit[1], - PortId: keySplit[2], + ConnectionId: keySplit[2], + PortId: keySplit[1], AccountAddress: string(iterator.Value()), } @@ -200,5 +200,5 @@ func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []icatypes.RegisteredI // SetInterchainAccountAddress stores the InterchainAccount address, keyed by the associated connectionID and portID func (k Keeper) SetInterchainAccountAddress(ctx sdk.Context, connectionID, portID, address string) { store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyOwnerAccount(connectionID, portID), []byte(address)) + store.Set(icatypes.KeyOwnerAccount(portID, connectionID), []byte(address)) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 181153a0fb5..ea3f8205c87 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -156,7 +156,7 @@ func (k Keeper) IsActiveChannel(ctx sdk.Context, connectionID, portID string) bo // GetInterchainAccountAddress retrieves the InterchainAccount address from the store associated with the provided connectionID and portID func (k Keeper) GetInterchainAccountAddress(ctx sdk.Context, connectionID, portID string) (string, bool) { store := ctx.KVStore(k.storeKey) - key := icatypes.KeyOwnerAccount(connectionID, portID) + key := icatypes.KeyOwnerAccount(portID, connectionID) if !store.Has(key) { return "", false @@ -175,8 +175,8 @@ func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []icatypes.RegisteredI keySplit := strings.Split(string(iterator.Key()), "/") acc := icatypes.RegisteredInterchainAccount{ - ConnectionId: keySplit[1], - PortId: keySplit[2], + ConnectionId: keySplit[2], + PortId: keySplit[1], AccountAddress: string(iterator.Value()), } @@ -189,5 +189,5 @@ func (k Keeper) GetAllInterchainAccounts(ctx sdk.Context) []icatypes.RegisteredI // SetInterchainAccountAddress stores the InterchainAccount address, keyed by the associated connectionID and portID func (k Keeper) SetInterchainAccountAddress(ctx sdk.Context, connectionID, portID, address string) { store := ctx.KVStore(k.storeKey) - store.Set(icatypes.KeyOwnerAccount(connectionID, portID), []byte(address)) + store.Set(icatypes.KeyOwnerAccount(portID, connectionID), []byte(address)) } diff --git a/modules/apps/27-interchain-accounts/types/keys.go b/modules/apps/27-interchain-accounts/types/keys.go index c2bde682551..2bf05ffda3f 100644 --- a/modules/apps/27-interchain-accounts/types/keys.go +++ b/modules/apps/27-interchain-accounts/types/keys.go @@ -44,8 +44,8 @@ func KeyActiveChannel(portID, connectionID string) []byte { } // KeyOwnerAccount creates and returns a new key used for interchain account store operations -func KeyOwnerAccount(connectionID, portID string) []byte { - return []byte(fmt.Sprintf("%s/%s/%s", OwnerKeyPrefix, connectionID, portID)) +func KeyOwnerAccount(portID, connectionID string) []byte { + return []byte(fmt.Sprintf("%s/%s/%s", OwnerKeyPrefix, portID, connectionID)) } // KeyPort creates and returns a new key used for port store operations diff --git a/modules/apps/27-interchain-accounts/types/keys_test.go b/modules/apps/27-interchain-accounts/types/keys_test.go index 02da485bf32..94c7a3bed0d 100644 --- a/modules/apps/27-interchain-accounts/types/keys_test.go +++ b/modules/apps/27-interchain-accounts/types/keys_test.go @@ -10,6 +10,6 @@ func (suite *TypesTestSuite) TestKeyActiveChannel() { } func (suite *TypesTestSuite) TestKeyOwnerAccount() { - key := types.KeyOwnerAccount("connection-id", "port-id") - suite.Require().Equal("owner/connection-id/port-id", string(key)) + key := types.KeyOwnerAccount("port-id", "connection-id") + suite.Require().Equal("owner/port-id/connection-id", string(key)) }