refactor: duplicate message verification at msg server and keeper (#16098)
Signed-off-by: bjwswang <bjwswang@gmail.com>
This commit is contained in:
parent
57ee17b639
commit
250c478543
@ -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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user