Skip to content

Commit

Permalink
fix last test
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Sep 23, 2022
1 parent 2602a0b commit e64760f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
16 changes: 10 additions & 6 deletions tests/e2e/group/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -458,10 +458,10 @@ func (s *IntegrationTestSuite) TestTxUpdateGroupAdmin() {
},
s.commonFlags...,
),
true,
false,
"not found",
nil,
0,
&sdk.TxResponse{},
sdkerrors.ErrNotFound.ABCICode(),
},
}

Expand All @@ -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)
}
}
})
}
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions x/group/keeper/proposal_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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 {
Expand All @@ -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())
}
}
}
Expand Down

0 comments on commit e64760f

Please sign in to comment.