CLI tests, updates, fixes (reflect hw options)

This commit is contained in:
2022-09-22 23:59:03 +00:00
parent e57473e2d2
commit fba158d4d1
4 changed files with 12 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ func CmdNewAuction() *cobra.Command {
cmd := &cobra.Command{
Use: "new-auction [name] [description] [ceiling] [denom] [end date] [verified providers (json string)] [gpus (json string)] [cpu cores] [cpu arch] [memory (MB)] [storage (GB)]",
Short: "Broadcast message newAuction",
Args: cobra.ExactArgs(10),
Args: cobra.ExactArgs(11),
// below: we're hardcoding the max providers param since we
// can't check chain params locally
// Args: cobra.RangeArgs(10, 1010),
@@ -69,7 +69,6 @@ func CmdNewAuction() *cobra.Command {
if err != nil {
return err
}
nMemMb, err := strconv.Atoi(memMb)
if err != nil {
return err

View File

@@ -88,7 +88,11 @@ found:
LeaseEnd: msg.LeaseEnd,
// remaining payout -> null
// Remaining: "0",
Gpus: msg.Gpus,
Gpus: msg.Gpus,
CpuArch: msg.CpuArch,
CpuCores: msg.CpuCores,
MemMb: msg.MemMb,
StorageGb: msg.StorageGb,
}
// validate hardware
@@ -156,8 +160,8 @@ func (k *Keeper) ValidateAuctionHardware(ctx sdk.Context, a types.Auction) error
// move these to module params later
if a.CpuCores == 0 || a.CpuCores > 12 {
return errors.New("CPU Cores must be between 0 and 12")
if a.CpuCores < 1 || a.CpuCores > 12 {
return fmt.Errorf("CPU Cores must be between 1 and 12 (got %d)", a.CpuCores)
}
if a.StorageGb < 25 || a.StorageGb > 2000 {