Skip to content

Commit 6acc85e

Browse files
vishal-kannacrodriguezvegaDimitrisJim
authored andcommitted
feat: check if controller enabled or not in sendTx (#5343)
* checked if controller enabled or not * added the test case * rename test case * extra line * Update modules/apps/27-interchain-accounts/controller/keeper/relay_test.go Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> * make lint-fix --------- Co-authored-by: Carlos Rodriguez <carlos@interchain.io> Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com> (cherry picked from commit 6f2493f)
1 parent 7a89e5d commit 6acc85e

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

modules/apps/27-interchain-accounts/controller/keeper/relay.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
sdk "github.com/cosmos/cosmos-sdk/types"
77

88
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
9+
"github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
910
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
1011
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
1112
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
@@ -27,6 +28,10 @@ func (k Keeper) SendTx(ctx sdk.Context, _ *capabilitytypes.Capability, connectio
2728
}
2829

2930
func (k Keeper) sendTx(ctx sdk.Context, connectionID, portID string, icaPacketData icatypes.InterchainAccountPacketData, timeoutTimestamp uint64) (uint64, error) {
31+
if !k.GetParams(ctx).ControllerEnabled {
32+
return 0, types.ErrControllerSubModuleDisabled
33+
}
34+
3035
activeChannelID, found := k.GetOpenActiveChannel(ctx, connectionID, portID)
3136
if !found {
3237
return 0, errorsmod.Wrapf(icatypes.ErrActiveChannelNotFound, "failed to retrieve active channel on connection %s for port %s", connectionID, portID)

modules/apps/27-interchain-accounts/controller/keeper/relay_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
sdk "github.com/cosmos/cosmos-sdk/types"
99
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
1010

11+
"github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
1112
icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types"
1213
clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
1314
channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types"
@@ -113,6 +114,13 @@ func (suite *KeeperTestSuite) TestSendTx() {
113114
},
114115
false,
115116
},
117+
{
118+
"controller submodule disabled",
119+
func() {
120+
suite.chainA.GetSimApp().ICAControllerKeeper.SetParams(suite.chainA.GetContext(), types.NewParams(false))
121+
},
122+
false,
123+
},
116124
{
117125
"timeout timestamp is not in the future",
118126
func() {

0 commit comments

Comments
 (0)