diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go index d7390c0aba3..ba0c564bdd4 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server.go @@ -12,10 +12,20 @@ import ( host "github.com/cosmos/ibc-go/v5/modules/core/24-host" ) -var _ types.MsgServer = Keeper{} +var _ types.MsgServer = msgServer{} + +type msgServer struct { + *Keeper +} + +// NewMsgServerImpl returns an implementation of the ICS27 MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper *Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} // RegisterAccount defines a rpc handler for MsgRegisterAccount -func (k Keeper) RegisterAccount(goCtx context.Context, msg *types.MsgRegisterAccount) (*types.MsgRegisterAccountResponse, error) { +func (k msgServer) RegisterAccount(goCtx context.Context, msg *types.MsgRegisterAccount) (*types.MsgRegisterAccountResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) portID, err := icatypes.NewControllerPortID(msg.Owner) @@ -34,7 +44,7 @@ func (k Keeper) RegisterAccount(goCtx context.Context, msg *types.MsgRegisterAcc } // SubmitTx defines a rpc handler for MsgSubmitTx -func (k Keeper) SubmitTx(goCtx context.Context, msg *types.MsgSubmitTx) (*types.MsgSubmitTxResponse, error) { +func (k msgServer) SubmitTx(goCtx context.Context, msg *types.MsgSubmitTx) (*types.MsgSubmitTxResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) portID, err := icatypes.NewControllerPortID(msg.Owner) diff --git a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go index 38aa673015c..6eb503e7531 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/msg_server_test.go @@ -7,6 +7,7 @@ import ( sdktypes "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/keeper" "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types" controllertypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/controller/types" icatypes "github.com/cosmos/ibc-go/v5/modules/apps/27-interchain-accounts/types" @@ -75,7 +76,8 @@ func (suite *KeeperTestSuite) TestRegisterAccount() { tc.malleate() ctx := suite.chainA.GetContext() - res, err := suite.chainA.GetSimApp().ICAControllerKeeper.RegisterAccount(ctx, msg) + msgServer := keeper.NewMsgServerImpl(&suite.chainA.GetSimApp().ICAControllerKeeper) + res, err := msgServer.RegisterAccount(ctx, msg) if tc.expPass { suite.Require().NoError(err) @@ -183,7 +185,10 @@ func (suite *KeeperTestSuite) TestSubmitTx() { msg = types.NewMsgSubmitTx(owner, connectionID, clienttypes.ZeroHeight(), timeoutTimestamp, packetData) tc.malleate() // malleate mutates test data - res, err := suite.chainA.GetSimApp().ICAControllerKeeper.SubmitTx(sdk.WrapSDKContext(suite.chainA.GetContext()), msg) + + ctx := suite.chainA.GetContext() + msgServer := keeper.NewMsgServerImpl(&suite.chainA.GetSimApp().ICAControllerKeeper) + res, err := msgServer.SubmitTx(ctx, msg) if tc.expPass { suite.Require().NoError(err) diff --git a/modules/apps/27-interchain-accounts/module.go b/modules/apps/27-interchain-accounts/module.go index d534247c805..616de1a4a3b 100644 --- a/modules/apps/27-interchain-accounts/module.go +++ b/modules/apps/27-interchain-accounts/module.go @@ -150,7 +150,7 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // RegisterServices registers module services func (am AppModule) RegisterServices(cfg module.Configurator) { - controllertypes.RegisterMsgServer(cfg.MsgServer(), am.controllerKeeper) + controllertypes.RegisterMsgServer(cfg.MsgServer(), controllerkeeper.NewMsgServerImpl(am.controllerKeeper)) controllertypes.RegisterQueryServer(cfg.QueryServer(), am.controllerKeeper) hosttypes.RegisterQueryServer(cfg.QueryServer(), am.hostKeeper)