From baa5d9d28fac5f2a80ed866cbf3e5b8454e1c443 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 13 Jan 2022 14:47:02 +0100 Subject: [PATCH 1/8] refactor: no longer remove active channel mapping on close chan --- .../27-interchain-accounts/controller/keeper/handshake.go | 4 +--- modules/apps/27-interchain-accounts/host/keeper/handshake.go | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go index 1dedbc228c4..ebb15e902a8 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go @@ -55,7 +55,7 @@ func (k Keeper) OnChanOpenInit( return sdkerrors.Wrapf(icatypes.ErrInvalidVersion, "expected %s, got %s", icatypes.Version, metadata.Version) } - activeChannelID, found := k.GetActiveChannelID(ctx, portID) + activeChannelID, found := k.HasActiveChannel(ctx, portID) if found { return sdkerrors.Wrapf(porttypes.ErrInvalidPort, "existing active channel %s for portID %s", activeChannelID, portID) } @@ -105,8 +105,6 @@ func (k Keeper) OnChanCloseConfirm( channelID string, ) error { - k.DeleteActiveChannelID(ctx, portID) - return nil } diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake.go b/modules/apps/27-interchain-accounts/host/keeper/handshake.go index 5d95f605076..8e0501cd165 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake.go @@ -91,8 +91,6 @@ func (k Keeper) OnChanCloseConfirm( channelID string, ) error { - k.DeleteActiveChannelID(ctx, portID) - return nil } From 3ac112e4acc05da12fc014c458d84ad01f690547 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 13 Jan 2022 15:47:00 +0100 Subject: [PATCH 2/8] refactor: adding HasActiveChannel helper fn & refactor active channel test cases --- .../controller/ibc_module_test.go | 4 ---- .../controller/keeper/account_test.go | 13 ++++++++++++- .../controller/keeper/handshake_test.go | 10 ++++++++++ .../controller/keeper/keeper.go | 18 +++++++++++++++++- .../host/ibc_module_test.go | 4 ---- .../host/keeper/handshake_test.go | 4 ---- 6 files changed, 39 insertions(+), 14 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/ibc_module_test.go b/modules/apps/27-interchain-accounts/controller/ibc_module_test.go index 68e534cda74..c9e64f0dc7f 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_module_test.go @@ -432,12 +432,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() { err = cbs.OnChanCloseConfirm( suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) - activeChannelID, found := suite.chainA.GetSimApp().ICAHostKeeper.GetActiveChannelID(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - if tc.expPass { suite.Require().NoError(err) - suite.Require().False(found) - suite.Require().Empty(activeChannelID) } else { suite.Require().Error(err) } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account_test.go b/modules/apps/27-interchain-accounts/controller/keeper/account_test.go index 967f7511aa2..45d0231ee12 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account_test.go @@ -2,6 +2,7 @@ package keeper_test import ( icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v3/testing" ) @@ -35,12 +36,22 @@ func (suite *KeeperTestSuite) TestInitInterchainAccount() { false, }, { - "MsgChanOpenInit fails - channel is already active", + "MsgChanOpenInit fails - channel is already active & in state OPEN", func() { portID, err := icatypes.NewControllerPortID(TestOwnerAddress) suite.Require().NoError(err) suite.chainA.GetSimApp().ICAControllerKeeper.SetActiveChannelID(suite.chainA.GetContext(), portID, path.EndpointA.ChannelID) + + counterparty := channeltypes.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) + channel := channeltypes.Channel{ + State: channeltypes.OPEN, + Ordering: channeltypes.ORDERED, + Counterparty: counterparty, + ConnectionHops: []string{path.EndpointA.ConnectionID}, + Version: string("version"), + } + suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), portID, path.EndpointA.ChannelID, channel) }, false, }, diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go index 9e902c41084..7a43e4ea8da 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go @@ -111,6 +111,16 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() { "channel is already active", func() { suite.chainA.GetSimApp().ICAControllerKeeper.SetActiveChannelID(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID) + + counterparty := channeltypes.NewCounterparty(path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) + channel := channeltypes.Channel{ + State: channeltypes.OPEN, + Ordering: channeltypes.ORDERED, + Counterparty: counterparty, + ConnectionHops: []string{path.EndpointA.ConnectionID}, + Version: string("version"), + } + suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel) }, false, }, diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 855b2a2de5d..2b74162e777 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -14,6 +14,7 @@ import ( "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v3/modules/core/24-host" ) @@ -101,7 +102,7 @@ func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability return k.scopedKeeper.ClaimCapability(ctx, cap, name) } -// GetActiveChannelID retrieves the active channelID from the store keyed by the provided portID +// GetActiveChannelID retrieves the active channelID from the store key by the provided portID func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool) { store := ctx.KVStore(k.storeKey) key := icatypes.KeyActiveChannel(portID) @@ -113,6 +114,21 @@ func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool return string(store.Get(key)), true } +// HasActiveChannel retrieves the active channelID from the store key by the provided portID & checks if the channel in question is in state OPEN +func (k Keeper) HasActiveChannel(ctx sdk.Context, portID string) (string, bool) { + store := ctx.KVStore(k.storeKey) + key := icatypes.KeyActiveChannel(portID) + + channelID := string(store.Get(key)) + channel, found := k.channelKeeper.GetChannel(ctx, portID, channelID) + + if channel.State == channeltypes.OPEN && found { + return channelID, true + } + + return "", false +} + // GetAllActiveChannels returns a list of all active interchain accounts controller channels and their associated port identifiers func (k Keeper) GetAllActiveChannels(ctx sdk.Context) []icatypes.ActiveChannel { store := ctx.KVStore(k.storeKey) diff --git a/modules/apps/27-interchain-accounts/host/ibc_module_test.go b/modules/apps/27-interchain-accounts/host/ibc_module_test.go index 0556f5b4100..28b7b9864fd 100644 --- a/modules/apps/27-interchain-accounts/host/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/host/ibc_module_test.go @@ -381,12 +381,8 @@ func (suite *InterchainAccountsTestSuite) TestOnChanCloseConfirm() { err = cbs.OnChanCloseConfirm( suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - activeChannelID, found := suite.chainB.GetSimApp().ICAHostKeeper.GetActiveChannelID(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - if tc.expPass { suite.Require().NoError(err) - suite.Require().False(found) - suite.Require().Empty(activeChannelID) } else { suite.Require().Error(err) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go index 52ca9dfb319..833ca32f54f 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/host/keeper/handshake_test.go @@ -242,12 +242,8 @@ func (suite *KeeperTestSuite) TestOnChanCloseConfirm() { err = suite.chainB.GetSimApp().ICAHostKeeper.OnChanCloseConfirm(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID, path.EndpointB.ChannelID) - activeChannelID, found := suite.chainB.GetSimApp().ICAHostKeeper.GetActiveChannelID(suite.chainB.GetContext(), path.EndpointB.ChannelConfig.PortID) - if tc.expPass { suite.Require().NoError(err) - suite.Require().False(found) - suite.Require().Empty(activeChannelID) } else { suite.Require().Error(err) } From c467787280852c2815f09516a2f82003e15b5f1c Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 13 Jan 2022 16:33:16 +0100 Subject: [PATCH 3/8] fix: update helper fn --- .../27-interchain-accounts/controller/keeper/keeper.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 2b74162e777..caa9206db8c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -116,13 +116,10 @@ func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool // HasActiveChannel retrieves the active channelID from the store key by the provided portID & checks if the channel in question is in state OPEN func (k Keeper) HasActiveChannel(ctx sdk.Context, portID string) (string, bool) { - store := ctx.KVStore(k.storeKey) - key := icatypes.KeyActiveChannel(portID) - - channelID := string(store.Get(key)) + channelID, _ := k.GetActiveChannelID(ctx, portID) channel, found := k.channelKeeper.GetChannel(ctx, portID, channelID) - if channel.State == channeltypes.OPEN && found { + if found && channel.State == channeltypes.OPEN { return channelID, true } From 5f28a1f1e39914daf54a82884aef3e4e6cb9e545 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 13 Jan 2022 17:35:55 +0100 Subject: [PATCH 4/8] refactor: remove DeleteChannelId --- .../27-interchain-accounts/controller/ibc_module_test.go | 4 ---- .../apps/27-interchain-accounts/controller/keeper/keeper.go | 6 ------ .../apps/27-interchain-accounts/controller/keeper/relay.go | 2 -- .../27-interchain-accounts/controller/keeper/relay_test.go | 4 ---- modules/apps/27-interchain-accounts/host/keeper/keeper.go | 6 ------ 5 files changed, 22 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/ibc_module_test.go b/modules/apps/27-interchain-accounts/controller/ibc_module_test.go index c9e64f0dc7f..605fa9c6415 100644 --- a/modules/apps/27-interchain-accounts/controller/ibc_module_test.go +++ b/modules/apps/27-interchain-accounts/controller/ibc_module_test.go @@ -624,12 +624,8 @@ func (suite *InterchainAccountsTestSuite) TestOnTimeoutPacket() { err = cbs.OnTimeoutPacket(suite.chainA.GetContext(), packet, nil) - activeChannelID, found := suite.chainA.GetSimApp().ICAControllerKeeper.GetActiveChannelID(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - if tc.expPass { suite.Require().NoError(err) - suite.Require().Empty(activeChannelID) - suite.Require().False(found) } else { suite.Require().Error(err) } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index caa9206db8c..44539a8ab03 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -153,12 +153,6 @@ func (k Keeper) SetActiveChannelID(ctx sdk.Context, portID, channelID string) { store.Set(icatypes.KeyActiveChannel(portID), []byte(channelID)) } -// DeleteActiveChannelID removes the active channel keyed by the provided portID stored in state -func (k Keeper) DeleteActiveChannelID(ctx sdk.Context, portID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(icatypes.KeyActiveChannel(portID)) -} - // IsActiveChannel returns true if there exists an active channel for the provided portID, otherwise false func (k Keeper) IsActiveChannel(ctx sdk.Context, portID string) bool { _, ok := k.GetActiveChannelID(ctx, portID) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay.go b/modules/apps/27-interchain-accounts/controller/keeper/relay.go index caf56bd430e..4a0ce345a5c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay.go @@ -74,7 +74,5 @@ func (k Keeper) createOutgoingPacket( // OnTimeoutPacket removes the active channel associated with the provided packet, the underlying channel end is closed // due to the semantics of ORDERED channels func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet) error { - k.DeleteActiveChannelID(ctx, packet.SourcePort) - return nil } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go index 75280c341a9..65dd7c7602c 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/relay_test.go @@ -187,12 +187,8 @@ func (suite *KeeperTestSuite) TestOnTimeoutPacket() { err = suite.chainA.GetSimApp().ICAControllerKeeper.OnTimeoutPacket(suite.chainA.GetContext(), packet) - activeChannelID, found := suite.chainA.GetSimApp().ICAControllerKeeper.GetActiveChannelID(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID) - if tc.expPass { suite.Require().NoError(err) - suite.Require().Empty(activeChannelID) - suite.Require().False(found) } else { suite.Require().Error(err) } diff --git a/modules/apps/27-interchain-accounts/host/keeper/keeper.go b/modules/apps/27-interchain-accounts/host/keeper/keeper.go index 5d8569a6e1a..bf76bce737d 100644 --- a/modules/apps/27-interchain-accounts/host/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/host/keeper/keeper.go @@ -129,12 +129,6 @@ func (k Keeper) SetActiveChannelID(ctx sdk.Context, portID, channelID string) { store.Set(icatypes.KeyActiveChannel(portID), []byte(channelID)) } -// DeleteActiveChannelID removes the active channel keyed by the provided portID stored in state -func (k Keeper) DeleteActiveChannelID(ctx sdk.Context, portID string) { - store := ctx.KVStore(k.storeKey) - store.Delete(icatypes.KeyActiveChannel(portID)) -} - // IsActiveChannel returns true if there exists an active channel for the provided portID, otherwise false func (k Keeper) IsActiveChannel(ctx sdk.Context, portID string) bool { _, ok := k.GetActiveChannelID(ctx, portID) From b40f3293e9f4a0e375df9ade82bbef126b8556d7 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 13 Jan 2022 17:45:50 +0100 Subject: [PATCH 5/8] refactor: err on GetActiveChannel & use TestVersion var in use testcase --- .../controller/keeper/handshake_test.go | 2 +- .../apps/27-interchain-accounts/controller/keeper/keeper.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go index 7a43e4ea8da..d1d9847cde5 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake_test.go @@ -118,7 +118,7 @@ func (suite *KeeperTestSuite) TestOnChanOpenInit() { Ordering: channeltypes.ORDERED, Counterparty: counterparty, ConnectionHops: []string{path.EndpointA.ConnectionID}, - Version: string("version"), + Version: TestVersion, } suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, channel) }, diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 44539a8ab03..218973dfaf9 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -116,7 +116,11 @@ func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool // HasActiveChannel retrieves the active channelID from the store key by the provided portID & checks if the channel in question is in state OPEN func (k Keeper) HasActiveChannel(ctx sdk.Context, portID string) (string, bool) { - channelID, _ := k.GetActiveChannelID(ctx, portID) + channelID, found := k.GetActiveChannelID(ctx, portID) + if !found { + return "", false + } + channel, found := k.channelKeeper.GetChannel(ctx, portID, channelID) if found && channel.State == channeltypes.OPEN { From ba5cafa5d30e031cd5ffd762f79b468b12447137 Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 13 Jan 2022 17:47:59 +0100 Subject: [PATCH 6/8] chore: comments --- .../apps/27-interchain-accounts/controller/keeper/keeper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 218973dfaf9..3724b2dda03 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -102,7 +102,7 @@ func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability return k.scopedKeeper.ClaimCapability(ctx, cap, name) } -// GetActiveChannelID retrieves the active channelID from the store key by the provided portID +// GetActiveChannelID retrieves the active channelID from the store, keyd by the provided portID func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool) { store := ctx.KVStore(k.storeKey) key := icatypes.KeyActiveChannel(portID) @@ -114,7 +114,7 @@ func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool return string(store.Get(key)), true } -// HasActiveChannel retrieves the active channelID from the store key by the provided portID & checks if the channel in question is in state OPEN +// HasActiveChannel retrieves the active channelID from the store, keyd by the provided portID & checks if the channel in question is in state OPEN func (k Keeper) HasActiveChannel(ctx sdk.Context, portID string) (string, bool) { channelID, found := k.GetActiveChannelID(ctx, portID) if !found { From 38c05d9c210774d1afd1cf1cd7f87ce4d307c55c Mon Sep 17 00:00:00 2001 From: Sean King Date: Thu, 13 Jan 2022 17:50:01 +0100 Subject: [PATCH 7/8] nit: TestVersion var --- .../27-interchain-accounts/controller/keeper/account_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/account_test.go b/modules/apps/27-interchain-accounts/controller/keeper/account_test.go index 45d0231ee12..fa0da9558f7 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/account_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/account_test.go @@ -49,7 +49,7 @@ func (suite *KeeperTestSuite) TestInitInterchainAccount() { Ordering: channeltypes.ORDERED, Counterparty: counterparty, ConnectionHops: []string{path.EndpointA.ConnectionID}, - Version: string("version"), + Version: TestVersion, } suite.chainA.GetSimApp().IBCKeeper.ChannelKeeper.SetChannel(suite.chainA.GetContext(), portID, path.EndpointA.ChannelID, channel) }, From 716167497a8d1a0aab56a78b66af5bcf041a2a42 Mon Sep 17 00:00:00 2001 From: Sean King Date: Fri, 14 Jan 2022 10:47:58 +0100 Subject: [PATCH 8/8] nits: fn name + comment --- .../27-interchain-accounts/controller/keeper/handshake.go | 2 +- .../apps/27-interchain-accounts/controller/keeper/keeper.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go index ebb15e902a8..e6c6f85366a 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go @@ -55,7 +55,7 @@ func (k Keeper) OnChanOpenInit( return sdkerrors.Wrapf(icatypes.ErrInvalidVersion, "expected %s, got %s", icatypes.Version, metadata.Version) } - activeChannelID, found := k.HasActiveChannel(ctx, portID) + activeChannelID, found := k.GetOpenActiveChannel(ctx, portID) if found { return sdkerrors.Wrapf(porttypes.ErrInvalidPort, "existing active channel %s for portID %s", activeChannelID, portID) } diff --git a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go index 3724b2dda03..afc1a2eda5d 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/keeper.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/keeper.go @@ -102,7 +102,7 @@ func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability return k.scopedKeeper.ClaimCapability(ctx, cap, name) } -// GetActiveChannelID retrieves the active channelID from the store, keyd by the provided portID +// GetActiveChannelID retrieves the active channelID from the store, keyed by the provided portID func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool) { store := ctx.KVStore(k.storeKey) key := icatypes.KeyActiveChannel(portID) @@ -114,8 +114,8 @@ func (k Keeper) GetActiveChannelID(ctx sdk.Context, portID string) (string, bool return string(store.Get(key)), true } -// HasActiveChannel retrieves the active channelID from the store, keyd by the provided portID & checks if the channel in question is in state OPEN -func (k Keeper) HasActiveChannel(ctx sdk.Context, portID string) (string, bool) { +// GetOpenActiveChannel retrieves the active channelID from the store, keyed by the provided portID & checks if the channel in question is in state OPEN +func (k Keeper) GetOpenActiveChannel(ctx sdk.Context, portID string) (string, bool) { channelID, found := k.GetActiveChannelID(ctx, portID) if !found { return "", false