Add msg validation for auction module
This commit is contained in:
parent
639b4e6333
commit
a6023966e4
@ -118,6 +118,8 @@ func (ets *E2ETestSuite) createBond() string {
|
||||
sr.NoError(err)
|
||||
|
||||
// extract bond id from bonds list
|
||||
bond := queryResponse.GetBonds()[0]
|
||||
return bond.GetId()
|
||||
bonds := queryResponse.GetBonds()
|
||||
sr.NotEmpty(bonds)
|
||||
|
||||
return queryResponse.GetBonds()[0].GetId()
|
||||
}
|
||||
|
@ -285,12 +285,11 @@ func (k Keeper) QueryAuctionsByBidder(ctx sdk.Context, bidderAddress string) ([]
|
||||
|
||||
// CreateAuction creates a new auction.
|
||||
func (k Keeper) CreateAuction(ctx sdk.Context, msg auctiontypes.MsgCreateAuction) (*auctiontypes.Auction, error) {
|
||||
// TODO: Setup checks
|
||||
// Might be called from another module directly, always validate.
|
||||
// err := msg.ValidateBasic()
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
err := msg.ValidateBasic()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
if err != nil {
|
||||
|
@ -52,6 +52,11 @@ func (ms msgServer) CreateAuction(c context.Context, msg *auctiontypes.MsgCreate
|
||||
// CommitBid is the command for committing a bid
|
||||
// nolint: all
|
||||
func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid) (*auctiontypes.MsgCommitBidResponse, error) {
|
||||
err := msg.ValidateBasic()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
@ -83,6 +88,11 @@ func (ms msgServer) CommitBid(c context.Context, msg *auctiontypes.MsgCommitBid)
|
||||
// RevealBid is the command for revealing a bid
|
||||
// nolint: all
|
||||
func (ms msgServer) RevealBid(c context.Context, msg *auctiontypes.MsgRevealBid) (*auctiontypes.MsgRevealBidResponse, error) {
|
||||
err := msg.ValidateBasic()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
ctx := sdk.UnwrapSDKContext(c)
|
||||
|
||||
signerAddress, err := sdk.AccAddressFromBech32(msg.Signer)
|
||||
|
Loading…
Reference in New Issue
Block a user