diff --git a/tests/test_auction_flow.sh b/tests/test_auction_flow.sh index 42afcf1..3137447 100755 --- a/tests/test_auction_flow.sh +++ b/tests/test_auction_flow.sh @@ -19,6 +19,21 @@ colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 8200000) \ -y --from bob \ | expect_fail "Can't create auction above max lease period" +colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 3700) \ + '[]' '[]' 4 0 1000 50 \ + -y --from bob \ + | expect_fail "Can't create an auction with 0 GPUs" + +colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 3700) \ + '[]' '["gtx-1050-ti"]' 0 0 1000 50 \ + -y --from bob \ + | expect_fail "Can't create an auction with 0 cores" + +colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 3700) \ + '[]' '["gtx-1050-ti"]' 0 0 1000 50 \ + -y --from bob \ + | expect_fail "Can't create an auction with sub-25GB storage" + before=$(get_balance $BOB uusdc) colineard tx colinearcore new-auction asdf asdf 2000 uusdc $(now + 3700) \ diff --git a/x/colinearcore/keeper/msg_server_new_auction.go b/x/colinearcore/keeper/msg_server_new_auction.go index 974fcd6..352fbf9 100644 --- a/x/colinearcore/keeper/msg_server_new_auction.go +++ b/x/colinearcore/keeper/msg_server_new_auction.go @@ -152,6 +152,11 @@ func (k *Keeper) ValidateAuctionHardware(ctx sdk.Context, a types.Auction) error return errors.New("GPU list not found") } + // move these to module params later + if len(a.Gpus) == 0 || len(a.Gpus) > 20 { + return fmt.Errorf("must order between 1 and 20 GPUs (got %d)", len(a.Gpus)) + } + for _, gpu := range a.Gpus { if _, ok := k.GetParams(ctx).GpuModels[gpu]; !ok { return fmt.Errorf("GPU model %s invalid", gpu) @@ -159,11 +164,11 @@ func (k *Keeper) ValidateAuctionHardware(ctx sdk.Context, a types.Auction) error } // move these to module params later - if a.CpuCores < 1 || a.CpuCores > 12 { return fmt.Errorf("CPU Cores must be between 1 and 12 (got %d)", a.CpuCores) } + // move these to module params later if a.StorageGb < 25 || a.StorageGb > 2000 { return fmt.Errorf("storage must be between 25GB and 2TB (got %dGB)", a.StorageGb) }