fixes + test hw edge cases

master
michael 2022-09-23 00:16:42 +00:00
parent fba158d4d1
commit 2ea722c81c
2 changed files with 21 additions and 1 deletions

View File

@ -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) \

View File

@ -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)
}