diff --git a/tests/e2e/group/tx.go b/tests/e2e/group/tx.go index cea0377dde04..7488806c798e 100644 --- a/tests/e2e/group/tx.go +++ b/tests/e2e/group/tx.go @@ -458,10 +458,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { }, s.commonFlags..., ), - true, + false, "not found", - nil, - 0, + &sdk.TxResponse{}, + sdkerrors.ErrNotFound.ABCICode(), }, } @@ -478,8 +478,12 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() { s.Require().NoError(err, out.String()) s.Require().NoError(clientCtx.Codec.UnmarshalJSON(out.Bytes(), tc.respType), out.String()) - txResp := tc.respType.(*sdk.TxResponse) - s.Require().NoError(clitestutil.CheckTxCode(s.network, clientCtx, txResp.TxHash, tc.expectedCode)) + txResp, err := clitestutil.GetTxResponse(s.network, clientCtx, tc.respType.(*sdk.TxResponse).TxHash) + s.Require().NoError(err) + s.Require().Equal(txResp.Code, tc.expectedCode) + if tc.expectErrMsg != "" { + s.Require().Contains(txResp.RawLog, tc.expectErrMsg) + } } }) } @@ -1554,7 +1558,7 @@ func (s *IntegrationTestSuite) TestTxSubmitProposal() { false, "msg does not have group policy authorization", &sdk.TxResponse{}, - errors.ErrUnauthorized.ABCICode(), + sdkerrors.ErrUnauthorized.ABCICode(), }, { "invalid proposers", diff --git a/x/group/keeper/proposal_executor.go b/x/group/keeper/proposal_executor.go index 29d9d1e8bed9..bc1317c629ac 100644 --- a/x/group/keeper/proposal_executor.go +++ b/x/group/keeper/proposal_executor.go @@ -5,9 +5,9 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/errors" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/group" - grouperrors "github.com/cosmos/cosmos-sdk/x/group/errors" + "github.com/cosmos/cosmos-sdk/x/group/errors" ) // doExecuteMsgs routes the messages to the registered handlers. Messages are limited to those that require no authZ or @@ -20,7 +20,7 @@ func (s Keeper) doExecuteMsgs(ctx sdk.Context, router *baseapp.MsgServiceRouter, // this simple and cheap check. expiryDate := proposal.VotingPeriodEnd.Add(s.config.MaxExecutionPeriod) if expiryDate.Before(ctx.BlockTime()) { - return nil, grouperrors.ErrExpired.Wrapf("proposal expired on %s", expiryDate) + return nil, errors.ErrExpired.Wrapf("proposal expired on %s", expiryDate) } msgs, err := proposal.GetMsgs() @@ -35,11 +35,11 @@ func (s Keeper) doExecuteMsgs(ctx sdk.Context, router *baseapp.MsgServiceRouter, for i, msg := range msgs { handler := s.router.Handler(msg) if handler == nil { - return nil, errors.Wrapf(grouperrors.ErrInvalid, "no message handler found for %q", sdk.MsgTypeURL(msg)) + return nil, sdkerrors.Wrapf(errors.ErrInvalid, "no message handler found for %q", sdk.MsgTypeURL(msg)) } r, err := handler(ctx, msg) if err != nil { - return nil, errors.Wrapf(err, "message %s at position %d", sdk.MsgTypeURL(msg), i) + return nil, sdkerrors.Wrapf(err, "message %s at position %d", sdk.MsgTypeURL(msg), i) } // Handler should always return non-nil sdk.Result. if r == nil { @@ -61,7 +61,7 @@ func ensureMsgAuthZ(msgs []sdk.Msg, groupPolicyAcc sdk.AccAddress) error { // but we prefer to loop through all GetSigners just to be sure. for _, acct := range msgs[i].GetSigners() { if !groupPolicyAcc.Equals(acct) { - return errors.Wrapf(errors.ErrUnauthorized, "msg does not have group policy authorization; expected %s, got %s", groupPolicyAcc.String(), acct.String()) + return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "msg does not have group policy authorization; expected %s, got %s", groupPolicyAcc.String(), acct.String()) } } }