From eb8ff19b98984b0e3a6732a1d6017984a3f0e7f0 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 16 Dec 2024 17:06:22 +0100 Subject: [PATCH] test: fix failing tests after protocompat changes (#22889) Co-authored-by: Marko (cherry picked from commit cfe194013ccd53a342d8dfa97d930df9e5416b83) # Conflicts: # x/authz/testutil/expected_keepers_mocks.go --- baseapp/internal/protocompat/protocompat.go | 32 +++-- scripts/mockgen.sh | 2 +- x/authz/keeper/keeper_test.go | 1 + x/authz/testutil/bank_helpers.go | 29 ----- x/authz/testutil/expected_keepers.go | 19 +++ x/authz/testutil/expected_keepers_mocks.go | 137 +++++++++++++++++++- x/group/keeper/msg_server_test.go | 28 ++-- x/group/testutil/expected_keepers.go | 2 +- 8 files changed, 191 insertions(+), 59 deletions(-) delete mode 100644 x/authz/testutil/bank_helpers.go create mode 100644 x/authz/testutil/expected_keepers.go diff --git a/baseapp/internal/protocompat/protocompat.go b/baseapp/internal/protocompat/protocompat.go index 43c32df35376..3c3a6fd701cb 100644 --- a/baseapp/internal/protocompat/protocompat.go +++ b/baseapp/internal/protocompat/protocompat.go @@ -123,14 +123,13 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B return fmt.Errorf("invalid request type %T, method %s does not accept protov2 messages", inReq, prefMethod.FullName()) } resp, err := method.Handler(handler, ctx, func(msg any) error { - setPointer(msg, inReq) - return nil + return setPointer(msg, inReq) }, nil) if err != nil { return err } - setPointer(outResp, resp) - return nil + + return setPointer(outResp, resp) }, nil } // this is a gogo handler, and we have a protov2 counterparty. @@ -161,14 +160,13 @@ func makeGogoHybridHandler(prefMethod protoreflect.MethodDescriptor, cdc codec.B case gogoproto.Message: // we can just call the handler after making a copy of the message, for safety reasons. resp, err := method.Handler(handler, ctx, func(msg any) error { - setPointer(msg, m) - return nil + return setPointer(msg, m) }, nil) if err != nil { return err } - setPointer(outResp, resp) - return nil + + return setPointer(outResp, resp) default: panic("unreachable") } @@ -235,6 +233,20 @@ func ResponseFullNameFromMethodDesc(sd *grpc.ServiceDesc, method grpc.MethodDesc // since proto.Merge breaks due to the custom cosmos sdk any, we are forced to do this ugly setPointer hack. // ref: https://github.com/cosmos/cosmos-sdk/issues/22779 -func setPointer(dst, src any) { - reflect.ValueOf(dst).Elem().Set(reflect.ValueOf(src).Elem()) +func setPointer(dst, src any) error { + dstValue := reflect.ValueOf(dst) + srcValue := reflect.ValueOf(src) + if !dstValue.IsValid() || !srcValue.IsValid() { + return fmt.Errorf("dst and src must be valid") + } + if dstValue.IsNil() || srcValue.IsNil() { + return fmt.Errorf("dst and src must be non-nil") + } + dstElem := dstValue.Elem() + srcElem := srcValue.Elem() + if dstElem.Type() != srcElem.Type() { + return fmt.Errorf("dst and src must have the same type") + } + dstElem.Set(srcElem) + return nil } diff --git a/scripts/mockgen.sh b/scripts/mockgen.sh index 1b02d7fd4a8a..a8f057a1d0a1 100755 --- a/scripts/mockgen.sh +++ b/scripts/mockgen.sh @@ -15,7 +15,7 @@ $mockgen_cmd -source=x/mint/types/expected_keepers.go -package testutil -destina $mockgen_cmd -source=x/auth/tx/config/expected_keepers.go -package testutil -destination x/auth/tx/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/auth/types/expected_keepers.go -package testutil -destination x/auth/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/auth/ante/expected_keepers.go -package testutil -destination x/auth/ante/testutil/expected_keepers_mocks.go -$mockgen_cmd -source=x/authz/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go +$mockgen_cmd -source=x/authz/testutil/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/bank/types/expected_keepers.go -package testutil -destination x/bank/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/group/testutil/expected_keepers.go -package testutil -destination x/group/testutil/expected_keepers_mocks.go $mockgen_cmd -source=x/evidence/types/expected_keepers.go -package testutil -destination x/evidence/testutil/expected_keepers_mocks.go diff --git a/x/authz/keeper/keeper_test.go b/x/authz/keeper/keeper_test.go index dcfd710fc264..5f258367242a 100644 --- a/x/authz/keeper/keeper_test.go +++ b/x/authz/keeper/keeper_test.go @@ -75,6 +75,7 @@ func (s *TestSuite) SetupTest() { s.accountKeeper.EXPECT().AddressCodec().Return(address.NewBech32Codec("cosmos")).AnyTimes() s.bankKeeper = authztestutil.NewMockBankKeeper(ctrl) + s.bankKeeper.EXPECT().Send(gomock.Any(), gomock.Any()).Return(&banktypes.MsgSendResponse{}, nil).AnyTimes() banktypes.RegisterInterfaces(s.encCfg.InterfaceRegistry) banktypes.RegisterMsgServer(s.baseApp.MsgServiceRouter(), s.bankKeeper) diff --git a/x/authz/testutil/bank_helpers.go b/x/authz/testutil/bank_helpers.go deleted file mode 100644 index b818ea8f8081..000000000000 --- a/x/authz/testutil/bank_helpers.go +++ /dev/null @@ -1,29 +0,0 @@ -package testutil - -import ( - "context" - - bank "cosmossdk.io/x/bank/types" -) - -var _ bank.MsgServer = MockBankKeeper{} - -func (k MockBankKeeper) Send(ctx context.Context, msg *bank.MsgSend) (*bank.MsgSendResponse, error) { - return nil, nil -} - -func (k MockBankKeeper) Burn(ctx context.Context, msg *bank.MsgBurn) (*bank.MsgBurnResponse, error) { - return nil, nil -} - -func (k MockBankKeeper) MultiSend(ctx context.Context, msg *bank.MsgMultiSend) (*bank.MsgMultiSendResponse, error) { - return nil, nil -} - -func (k MockBankKeeper) UpdateParams(ctx context.Context, req *bank.MsgUpdateParams) (*bank.MsgUpdateParamsResponse, error) { - return nil, nil -} - -func (k MockBankKeeper) SetSendEnabled(ctx context.Context, req *bank.MsgSetSendEnabled) (*bank.MsgSetSendEnabledResponse, error) { - return nil, nil -} diff --git a/x/authz/testutil/expected_keepers.go b/x/authz/testutil/expected_keepers.go new file mode 100644 index 000000000000..19902aa86fde --- /dev/null +++ b/x/authz/testutil/expected_keepers.go @@ -0,0 +1,19 @@ +package testutil + +import ( + "context" + + banktypes "cosmossdk.io/x/bank/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// BankKeeper extends bank `MsgServer` to mock `Send` and to register handlers in MsgServiceRouter +type BankKeeper interface { + banktypes.MsgServer + + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins +} diff --git a/x/authz/testutil/expected_keepers_mocks.go b/x/authz/testutil/expected_keepers_mocks.go index df0bcb0e835f..afc150777cea 100644 --- a/x/authz/testutil/expected_keepers_mocks.go +++ b/x/authz/testutil/expected_keepers_mocks.go @@ -1,5 +1,14 @@ // Code generated by MockGen. DO NOT EDIT. +<<<<<<< HEAD // Source: x/authz/expected_keepers.go +======= +// Source: x/authz/testutil/expected_keepers.go +// +// Generated by this command: +// +// mockgen -source=x/authz/testutil/expected_keepers.go -package testutil -destination x/authz/testutil/expected_keepers_mocks.go +// +>>>>>>> cfe194013 (test: fix failing tests after protocompat changes (#22889)) // Package testutil is a generated GoMock package. package testutil @@ -8,9 +17,15 @@ import ( context "context" reflect "reflect" +<<<<<<< HEAD address "cosmossdk.io/core/address" types "github.com/cosmos/cosmos-sdk/types" gomock "github.com/golang/mock/gomock" +======= + types "cosmossdk.io/x/bank/types" + types0 "github.com/cosmos/cosmos-sdk/types" + gomock "go.uber.org/mock/gomock" +>>>>>>> cfe194013 (test: fix failing tests after protocompat changes (#22889)) ) // MockAccountKeeper is a mock of AccountKeeper interface. @@ -101,30 +116,129 @@ func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { return m.recorder } -// IsSendEnabledCoins mocks base method. -func (m *MockBankKeeper) IsSendEnabledCoins(ctx context.Context, coins ...types.Coin) error { +// Burn mocks base method. +func (m *MockBankKeeper) Burn(arg0 context.Context, arg1 *types.MsgBurn) (*types.MsgBurnResponse, error) { m.ctrl.T.Helper() +<<<<<<< HEAD varargs := []interface{}{ctx} for _, a := range coins { varargs = append(varargs, a) } ret := m.ctrl.Call(m, "IsSendEnabledCoins", varargs...) +======= + ret := m.ctrl.Call(m, "Burn", arg0, arg1) + ret0, _ := ret[0].(*types.MsgBurnResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Burn indicates an expected call of Burn. +func (mr *MockBankKeeperMockRecorder) Burn(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Burn", reflect.TypeOf((*MockBankKeeper)(nil).Burn), arg0, arg1) +} + +// GetAllBalances mocks base method. +func (m *MockBankKeeper) GetAllBalances(ctx context.Context, addr types0.AccAddress) types0.Coins { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetAllBalances", ctx, addr) + ret0, _ := ret[0].(types0.Coins) + return ret0 +} + +// GetAllBalances indicates an expected call of GetAllBalances. +func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAllBalances", reflect.TypeOf((*MockBankKeeper)(nil).GetAllBalances), ctx, addr) +} + +// MintCoins mocks base method. +func (m *MockBankKeeper) MintCoins(ctx context.Context, moduleName string, amt types0.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MintCoins", ctx, moduleName, amt) +>>>>>>> cfe194013 (test: fix failing tests after protocompat changes (#22889)) ret0, _ := ret[0].(error) return ret0 } +<<<<<<< HEAD // IsSendEnabledCoins indicates an expected call of IsSendEnabledCoins. func (mr *MockBankKeeperMockRecorder) IsSendEnabledCoins(ctx interface{}, coins ...interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() varargs := append([]interface{}{ctx}, coins...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsSendEnabledCoins", reflect.TypeOf((*MockBankKeeper)(nil).IsSendEnabledCoins), varargs...) +======= +// MintCoins indicates an expected call of MintCoins. +func (mr *MockBankKeeperMockRecorder) MintCoins(ctx, moduleName, amt any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MintCoins", reflect.TypeOf((*MockBankKeeper)(nil).MintCoins), ctx, moduleName, amt) +} + +// MultiSend mocks base method. +func (m *MockBankKeeper) MultiSend(arg0 context.Context, arg1 *types.MsgMultiSend) (*types.MsgMultiSendResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MultiSend", arg0, arg1) + ret0, _ := ret[0].(*types.MsgMultiSendResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// MultiSend indicates an expected call of MultiSend. +func (mr *MockBankKeeperMockRecorder) MultiSend(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MultiSend", reflect.TypeOf((*MockBankKeeper)(nil).MultiSend), arg0, arg1) +} + +// Send mocks base method. +func (m *MockBankKeeper) Send(arg0 context.Context, arg1 *types.MsgSend) (*types.MsgSendResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Send", arg0, arg1) + ret0, _ := ret[0].(*types.MsgSendResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Send indicates an expected call of Send. +func (mr *MockBankKeeperMockRecorder) Send(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockBankKeeper)(nil).Send), arg0, arg1) +} + +// SendCoinsFromModuleToAccount mocks base method. +func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr types0.AccAddress, amt types0.Coins) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SendCoinsFromModuleToAccount", ctx, senderModule, recipientAddr, amt) + ret0, _ := ret[0].(error) + return ret0 +} + +// SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount. +func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendCoinsFromModuleToAccount", reflect.TypeOf((*MockBankKeeper)(nil).SendCoinsFromModuleToAccount), ctx, senderModule, recipientAddr, amt) +} + +// SetSendEnabled mocks base method. +func (m *MockBankKeeper) SetSendEnabled(arg0 context.Context, arg1 *types.MsgSetSendEnabled) (*types.MsgSetSendEnabledResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SetSendEnabled", arg0, arg1) + ret0, _ := ret[0].(*types.MsgSetSendEnabledResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// SetSendEnabled indicates an expected call of SetSendEnabled. +func (mr *MockBankKeeperMockRecorder) SetSendEnabled(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetSendEnabled", reflect.TypeOf((*MockBankKeeper)(nil).SetSendEnabled), arg0, arg1) +>>>>>>> cfe194013 (test: fix failing tests after protocompat changes (#22889)) } // SpendableCoins mocks base method. -func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types.AccAddress) types.Coins { +func (m *MockBankKeeper) SpendableCoins(ctx context.Context, addr types0.AccAddress) types0.Coins { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) - ret0, _ := ret[0].(types.Coins) + ret0, _ := ret[0].(types0.Coins) return ret0 } @@ -133,3 +247,18 @@ func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gom mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SpendableCoins", reflect.TypeOf((*MockBankKeeper)(nil).SpendableCoins), ctx, addr) } + +// UpdateParams mocks base method. +func (m *MockBankKeeper) UpdateParams(arg0 context.Context, arg1 *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "UpdateParams", arg0, arg1) + ret0, _ := ret[0].(*types.MsgUpdateParamsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// UpdateParams indicates an expected call of UpdateParams. +func (mr *MockBankKeeperMockRecorder) UpdateParams(arg0, arg1 any) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UpdateParams", reflect.TypeOf((*MockBankKeeper)(nil).UpdateParams), arg0, arg1) +} diff --git a/x/group/keeper/msg_server_test.go b/x/group/keeper/msg_server_test.go index d03f8721d563..3e90729856d5 100644 --- a/x/group/keeper/msg_server_test.go +++ b/x/group/keeper/msg_server_test.go @@ -1817,7 +1817,7 @@ func (s *TestSuite) TestSubmitProposal() { "with try exec": { preRun: func(msgs []sdk.Msg) { for i := 0; i < len(msgs); i++ { - s.bankKeeper.EXPECT().Send(gomock.Any(), msgs[i]).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgs[i]).Return(&banktypes.MsgSendResponse{}, nil) } }, req: &group.MsgSubmitProposal{ @@ -2154,7 +2154,7 @@ func (s *TestSuite) TestVote() { expProposalStatus: group.PROPOSAL_STATUS_ACCEPTED, expExecutorResult: group.PROPOSAL_EXECUTOR_RESULT_SUCCESS, doBefore: func(ctx context.Context) { - s.bankKeeper.EXPECT().Send(gomock.Any(), msg).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msg).Return(&banktypes.MsgSendResponse{}, nil) }, postRun: func(sdkCtx sdk.Context) { s.bankKeeper.EXPECT().GetAllBalances(gomock.Any(), groupPolicy).Return(sdk.NewCoins(sdk.NewInt64Coin("test", 9900))) @@ -2344,7 +2344,7 @@ func (s *TestSuite) TestVote() { Option: group.VOTE_OPTION_NO, }, doBefore: func(ctx context.Context) { - s.bankKeeper.EXPECT().Send(gomock.Any(), msg).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msg).Return(&banktypes.MsgSendResponse{}, nil) _, err := s.groupKeeper.Vote(ctx, &group.MsgVote{ ProposalId: myProposalID, @@ -2556,7 +2556,7 @@ func (s *TestSuite) TestExecProposal() { }{ "proposal executed when accepted": { setupProposal: func(ctx context.Context) uint64 { - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, nil) msgs := []sdk.Msg{msgSend1} return submitProposalAndVote(ctx, s, msgs, proposers, group.VOTE_OPTION_YES) }, @@ -2574,7 +2574,7 @@ func (s *TestSuite) TestExecProposal() { "proposal with multiple messages executed when accepted": { setupProposal: func(ctx context.Context) uint64 { msgs := []sdk.Msg{msgSend1, msgSend1} - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, nil).MaxTimes(2) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, nil).MaxTimes(2) return submitProposalAndVote(ctx, s, msgs, proposers, group.VOTE_OPTION_YES) }, @@ -2660,7 +2660,7 @@ func (s *TestSuite) TestExecProposal() { "exec proposal at exactly MinExecutionPeriod should pass": { setupProposal: func(ctx context.Context) uint64 { msgs := []sdk.Msg{msgSend1} - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, nil) return submitProposalAndVote(ctx, s, msgs, proposers, group.VOTE_OPTION_YES) }, srcBlockTime: s.blockTime.Add(5 * time.Second), // min execution date is 5s later after s.blockTime @@ -2674,7 +2674,7 @@ func (s *TestSuite) TestExecProposal() { "prevent double execution when successful": { setupProposal: func(ctx context.Context) uint64 { myProposalID := submitProposalAndVote(ctx, s, []sdk.Msg{msgSend1}, proposers, group.VOTE_OPTION_YES) - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, nil) // Wait after min execution period end before Exec sdkCtx := sdk.UnwrapSDKContext(ctx) @@ -2696,7 +2696,7 @@ func (s *TestSuite) TestExecProposal() { "rollback all msg updates on failure": { setupProposal: func(ctx context.Context) uint64 { msgs := []sdk.Msg{msgSend1, msgSend2} - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, nil) s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend2).Return(nil, errors.New("error")) return submitProposalAndVote(ctx, s, msgs, proposers, group.VOTE_OPTION_YES) @@ -2716,7 +2716,7 @@ func (s *TestSuite) TestExecProposal() { sdkCtx = sdkCtx.WithHeaderInfo(header.Info{Time: sdkCtx.HeaderInfo().Time.Add(minExecutionPeriod)}) // MinExecutionPeriod is 5s s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend2).Return(nil, errors.New("error")) _, err := s.groupKeeper.Exec(sdkCtx, &group.MsgExec{Executor: s.addrsStr[0], ProposalId: myProposalID}) - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend2).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend2).Return(&banktypes.MsgSendResponse{}, nil) s.Require().NoError(err) s.Require().NoError(s.bankKeeper.SendCoinsFromModuleToAccount(s.sdkCtx, minttypes.ModuleName, s.groupPolicyAddr, sdk.Coins{sdk.NewInt64Coin("test", 10000)})) @@ -2793,7 +2793,7 @@ func (s *TestSuite) TestExecPrunedProposalsAndVotes() { Amount: sdk.Coins{sdk.NewInt64Coin("test", 101)}, } msgs := []sdk.Msg{msgSend1} - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, nil) return submitProposalAndVote(ctx, s, msgs, proposers, group.VOTE_OPTION_YES) }, expErrMsg: "load proposal: not found", @@ -2806,7 +2806,7 @@ func (s *TestSuite) TestExecPrunedProposalsAndVotes() { ToAddress: s.addrsStr[1], Amount: sdk.Coins{sdk.NewInt64Coin("test", 102)}, } - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, nil).MaxTimes(2) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, nil).MaxTimes(2) msgs := []sdk.Msg{msgSend1, msgSend1} return submitProposalAndVote(ctx, s, msgs, proposers, group.VOTE_OPTION_YES) @@ -2891,7 +2891,7 @@ func (s *TestSuite) TestExecPrunedProposalsAndVotes() { } msgs := []sdk.Msg{msgSend1, msgSend2} - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, errors.New("error")) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, errors.New("error")) return submitProposalAndVote(ctx, s, msgs, proposers, group.VOTE_OPTION_YES) }, @@ -2915,7 +2915,7 @@ func (s *TestSuite) TestExecPrunedProposalsAndVotes() { sdkCtx := sdk.UnwrapSDKContext(ctx) sdkCtx = sdkCtx.WithHeaderInfo(header.Info{Time: sdkCtx.HeaderInfo().Time.Add(minExecutionPeriod)}) _, err := s.groupKeeper.Exec(sdkCtx, &group.MsgExec{Executor: s.addrsStr[0], ProposalId: myProposalID}) - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend2).Return(nil, nil) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend2).Return(&banktypes.MsgSendResponse{}, nil) s.Require().NoError(err) return myProposalID @@ -3194,7 +3194,7 @@ func (s *TestSuite) TestExecProposalsWhenMemberLeavesOrIsUpdated() { } // the proposal will pass and be executed - s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(nil, nil).MaxTimes(1) + s.bankKeeper.EXPECT().Send(gomock.Any(), msgSend1).Return(&banktypes.MsgSendResponse{}, nil).MaxTimes(1) msgs := []sdk.Msg{msgSend1} proposalReq := &group.MsgSubmitProposal{ diff --git a/x/group/testutil/expected_keepers.go b/x/group/testutil/expected_keepers.go index 3354ac5d7b54..04f9ac3d87f5 100644 --- a/x/group/testutil/expected_keepers.go +++ b/x/group/testutil/expected_keepers.go @@ -30,9 +30,9 @@ type AccountKeeper interface { // BankKeeper extends bank `MsgServer` to mock `Send` and to register handlers in MsgServiceRouter type BankKeeper interface { - SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins bank.MsgServer + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins