From 66139cc670bc14ea022299fa64407c99ff34812b Mon Sep 17 00:00:00 2001
From: Philip Offtermatt
Date: Wed, 15 May 2024 08:48:47 +0200
Subject: [PATCH] Add new param to tests
---
x/ccv/provider/keeper/params_test.go | 1 +
x/ccv/provider/types/genesis_test.go | 26 +++++++++++++-------------
x/ccv/provider/types/params_test.go | 24 ++++++++++++------------
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/x/ccv/provider/keeper/params_test.go b/x/ccv/provider/keeper/params_test.go
index 88175431c0..fb93d6c249 100644
--- a/x/ccv/provider/keeper/params_test.go
+++ b/x/ccv/provider/keeper/params_test.go
@@ -49,6 +49,7 @@ func TestParams(t *testing.T) {
Amount: sdk.NewInt(10000000),
},
600,
+ 180,
)
providerKeeper.SetParams(ctx, newParams)
params = providerKeeper.GetParams(ctx)
diff --git a/x/ccv/provider/types/genesis_test.go b/x/ccv/provider/types/genesis_test.go
index 41a716757f..094625d2c7 100644
--- a/x/ccv/provider/types/genesis_test.go
+++ b/x/ccv/provider/types/genesis_test.go
@@ -81,7 +81,7 @@ func TestValidateGenesisState(t *testing.T) {
nil,
types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -102,7 +102,7 @@ func TestValidateGenesisState(t *testing.T) {
nil,
types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -123,7 +123,7 @@ func TestValidateGenesisState(t *testing.T) {
nil,
types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -144,7 +144,7 @@ func TestValidateGenesisState(t *testing.T) {
nil,
types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -171,7 +171,7 @@ func TestValidateGenesisState(t *testing.T) {
types.DefaultVscTimeoutPeriod,
types.DefaultSlashMeterReplenishPeriod,
types.DefaultSlashMeterReplenishFraction,
- sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -198,7 +198,7 @@ func TestValidateGenesisState(t *testing.T) {
types.DefaultVscTimeoutPeriod,
types.DefaultSlashMeterReplenishPeriod,
types.DefaultSlashMeterReplenishFraction,
- sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -225,7 +225,7 @@ func TestValidateGenesisState(t *testing.T) {
types.DefaultVscTimeoutPeriod,
types.DefaultSlashMeterReplenishPeriod,
types.DefaultSlashMeterReplenishFraction,
- sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}, 600),
+ sdk.Coin{Denom: "stake", Amount: sdk.NewInt(1000000)}, 600, 180),
nil,
nil,
nil,
@@ -252,7 +252,7 @@ func TestValidateGenesisState(t *testing.T) {
types.DefaultVscTimeoutPeriod,
types.DefaultSlashMeterReplenishPeriod,
types.DefaultSlashMeterReplenishFraction,
- sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -279,7 +279,7 @@ func TestValidateGenesisState(t *testing.T) {
0, // 0 vsc timeout here
types.DefaultSlashMeterReplenishPeriod,
types.DefaultSlashMeterReplenishFraction,
- sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -306,7 +306,7 @@ func TestValidateGenesisState(t *testing.T) {
types.DefaultVscTimeoutPeriod,
0, // 0 slash meter replenish period here
types.DefaultSlashMeterReplenishFraction,
- sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -333,7 +333,7 @@ func TestValidateGenesisState(t *testing.T) {
types.DefaultVscTimeoutPeriod,
types.DefaultSlashMeterReplenishPeriod,
"1.15",
- sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600),
+ sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -685,7 +685,7 @@ func TestValidateGenesisState(t *testing.T) {
nil,
types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 600),
+ types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 600, 180),
nil,
nil,
nil,
@@ -706,7 +706,7 @@ func TestValidateGenesisState(t *testing.T) {
nil,
types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 600),
+ types.DefaultTrustingPeriodFraction, time.Hour, time.Hour, 30*time.Minute, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-1000000)}, 600, 180),
nil,
nil,
nil,
diff --git a/x/ccv/provider/types/params_test.go b/x/ccv/provider/types/params_test.go
index 4e72c233af..91feb9f276 100644
--- a/x/ccv/provider/types/params_test.go
+++ b/x/ccv/provider/types/params_test.go
@@ -24,39 +24,39 @@ func TestValidateParams(t *testing.T) {
{"custom valid params", types.NewParams(
ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true},
+ "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), true},
{"custom invalid params", types.NewParams(
ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
0, clienttypes.Height{}, nil, []string{"ibc", "upgradedIBCState"}),
- "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false},
+ "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
{"blank client", types.NewParams(&ibctmtypes.ClientState{},
- "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false},
- {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false},
+ "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
+ {"nil client", types.NewParams(nil, "0.33", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
// Check if "0.00" is valid or if a zero dec TrustFraction needs to return an error
{"0 trusting period fraction", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), true},
+ "0.00", time.Hour, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), true},
{"0 ccv timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false},
+ "0.33", 0, time.Hour, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
{"0 init timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false},
+ "0.33", time.Hour, 0, time.Hour, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
{"0 vsc timeout period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false},
+ "0.33", time.Hour, time.Hour, 0, 30*time.Minute, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
{"0 slash meter replenish period", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false},
+ "0.33", time.Hour, time.Hour, 24*time.Hour, 0, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
{"slash meter replenish fraction over 1", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000), false},
+ "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "1.5", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
{"invalid consumer reward denom registration fee denom", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000), false},
+ "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "st", Amount: sdk.NewInt(10000000)}, 1000, 180), false},
{"invalid consumer reward denom registration fee amount", types.NewParams(ibctmtypes.NewClientState("", ibctmtypes.DefaultTrustLevel, 0, 0,
time.Second*40, clienttypes.Height{}, commitmenttypes.GetSDKSpecs(), []string{"ibc", "upgradedIBCState"}),
- "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}, 1000), false},
+ "0.33", time.Hour, time.Hour, 24*time.Hour, time.Hour, "0.1", sdk.Coin{Denom: "stake", Amount: sdk.NewInt(-10000000)}, 1000, 180), false},
}
for _, tc := range testCases {