From dc9c9e4d9f25bcb3a6b1ff1ac019952ca01ea691 Mon Sep 17 00:00:00 2001 From: Tony Stark Date: Sat, 30 Nov 2024 22:49:13 +0530 Subject: [PATCH] fix: validation of node price parameters --- x/node/types/v3/params.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/x/node/types/v3/params.go b/x/node/types/v3/params.go index 056feb16..fdbc284b 100644 --- a/x/node/types/v3/params.go +++ b/x/node/types/v3/params.go @@ -12,8 +12,8 @@ import ( var ( DefaultDeposit = sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(10)) DefaultActiveDuration = 30 * time.Second - DefaultMinGigabytePrices = sdk.NewDecCoins(sdk.NewDecCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))) - DefaultMinHourlyPrices = sdk.NewDecCoins(sdk.NewDecCoin(sdk.DefaultBondDenom, sdkmath.NewInt(1))) + DefaultMinGigabytePrices = sdk.NewDecCoins(sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, sdkmath.LegacyMustNewDecFromStr("0.1"))) + DefaultMinHourlyPrices = sdk.NewDecCoins(sdk.NewDecCoinFromDec(sdk.DefaultBondDenom, sdkmath.LegacyMustNewDecFromStr("0.1"))) DefaultMaxSessionGigabytes int64 = 10 DefaultMinSessionGigabytes int64 = 1 DefaultMaxSessionHours int64 = 10 @@ -190,7 +190,7 @@ func validateActiveDuration(v interface{}) error { } func validateMinGigabytePrices(v interface{}) error { - value, ok := v.(sdk.Coins) + value, ok := v.(sdk.DecCoins) if !ok { return fmt.Errorf("invalid parameter type %T", v) } @@ -198,9 +198,6 @@ func validateMinGigabytePrices(v interface{}) error { if value == nil { return nil } - if value.IsAnyNil() { - return fmt.Errorf("min_gigabyte_prices cannot contain nil") - } if !value.IsValid() { return fmt.Errorf("min_gigabyte_prices must be valid") } @@ -209,7 +206,7 @@ func validateMinGigabytePrices(v interface{}) error { } func validateMinHourlyPrices(v interface{}) error { - value, ok := v.(sdk.Coins) + value, ok := v.(sdk.DecCoins) if !ok { return fmt.Errorf("invalid parameter type %T", v) } @@ -217,9 +214,6 @@ func validateMinHourlyPrices(v interface{}) error { if value == nil { return nil } - if value.IsAnyNil() { - return fmt.Errorf("min_hourly_prices cannot contain nil") - } if !value.IsValid() { return fmt.Errorf("min_hourly_prices must be valid") }