Skip to content

Commit

Permalink
Added test files to validate untrimmed labels
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthishvitwit committed May 24, 2023
1 parent 8ca2d96 commit dd70f6d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion x/wasm/types/proposal.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ func (p InstantiateContractProposal) ValidateBasic() error {
if p.CodeID == 0 {
return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "code id is required")
}
p.Label = strings.TrimSpace(p.Label)

if err := ValidateLabel(p.Label); err != nil {
return err
Expand Down
6 changes: 6 additions & 0 deletions x/wasm/types/proposal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ func TestValidateInstantiateContract2Proposal(t *testing.T) {
}),
expErr: true,
},
"untrimmed label ": {
src: InstantiateContract2ProposalFixture(func(p *InstantiateContract2Proposal) {
p.Label = " label "
}),
expErr: true,
},
"init funds negative": {
src: InstantiateContract2ProposalFixture(func(p *InstantiateContract2Proposal) {
p.Funds = sdk.Coins{{Denom: "foo", Amount: sdk.NewInt(-1)}}
Expand Down

0 comments on commit dd70f6d

Please sign in to comment.