fixes + test hw edge cases

This commit is contained in:
2022-09-23 00:16:42 +00:00
parent fba158d4d1
commit 2ea722c81c
2 changed files with 21 additions and 1 deletions

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