refactor: duplicate message verification at msg server and keeper (#16098)

Signed-off-by: bjwswang <bjwswang@gmail.com>
This commit is contained in:
bjwswang 2023-05-11 18:43:48 +08:00 committed by GitHub
parent 57ee17b639
commit 250c478543
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -57,10 +57,6 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos
return nil, err
}
if err := validateMsgs(proposalMsgs); err != nil {
return nil, err
}
ctx := sdk.UnwrapSDKContext(goCtx)
initialDeposit := msg.GetInitialDeposit()
@ -412,19 +408,3 @@ func validateDeposit(deposit sdk.Coins) error {
return nil
}
func validateMsgs(msgs []sdk.Msg) error {
for idx, msg := range msgs {
m, ok := msg.(sdk.HasValidateBasic)
if !ok {
continue
}
if err := m.ValidateBasic(); err != nil {
return errors.Wrap(govtypes.ErrInvalidProposalMsg,
fmt.Sprintf("msg: %d, err: %s", idx, err.Error()))
}
}
return nil
}