From 958d74f47103bb8b479899475e8b3acfb25cdc9a Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 9 Dec 2023 03:42:34 -0500 Subject: [PATCH 01/20] test: add governance unmodifiable params --- app/app.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/app.go b/app/app.go index 1401d2df03..3a292130ce 100644 --- a/app/app.go +++ b/app/app.go @@ -734,14 +734,22 @@ func (app *App) setPostHanders() { // governance. func (*App) BlockedParams() [][2]string { return [][2]string{ + // MaxSquareSize + {blobmoduletypes.ModuleName, string(blobmoduletypes.KeyGovMaxSquareSize)}, // bank.SendEnabled {banktypes.ModuleName, string(banktypes.KeySendEnabled)}, - // staking.UnbondingTime - {stakingtypes.ModuleName, string(stakingtypes.KeyUnbondingTime)}, - // staking.BondDenom - {stakingtypes.ModuleName, string(stakingtypes.KeyBondDenom)}, + // MaxBlockBytes and consensus.block.TimeIotaMs + {baseapp.Paramspace, string(baseapp.ParamStoreKeyBlockParams)}, // consensus.validator.PubKeyTypes {baseapp.Paramspace, string(baseapp.ParamStoreKeyValidatorParams)}, + // consensus.Version.AppVersion + {baseapp.Paramspace, string(baseapp.ParamStoreKeyVersionParams)}, + // staking.BondDenom + {stakingtypes.ModuleName, string(stakingtypes.KeyBondDenom)}, + // staking.MaxValidators + {stakingtypes.ModuleName, string(stakingtypes.KeyMaxValidators)}, + // staking.UnbondingTime + {stakingtypes.ModuleName, string(stakingtypes.KeyUnbondingTime)}, } } From f966d2f5f3f3e67a89919e026c3c24ca3a17619a Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 9 Dec 2023 04:01:19 -0500 Subject: [PATCH 02/20] remove invalid param test --- x/paramfilter/test/param_filter_test.go | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/x/paramfilter/test/param_filter_test.go b/x/paramfilter/test/param_filter_test.go index dc6cda917c..027848bea0 100644 --- a/x/paramfilter/test/param_filter_test.go +++ b/x/paramfilter/test/param_filter_test.go @@ -8,7 +8,6 @@ import ( "github.com/celestiaorg/celestia-app/x/paramfilter" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/require" tmlog "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/proto/tendermint/types" @@ -34,30 +33,6 @@ func TestParamFilter(t *testing.T) { require.Error(t, err) require.Contains(t, err.Error(), "parameter can not be modified") } - - // ensure that we are not filtering out valid proposals - validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxValidators), "1") - p := testProposal(validChange) - err := handler(ctx, p) - require.NoError(t, err) - - ps := app.StakingKeeper.GetParams(ctx) - require.Equal(t, ps.MaxValidators, uint32(1)) - - // ensure that we're throwing out entire proposals if any of the changes are blocked - for _, p := range app.BlockedParams() { - // try to set the max validators to 2, unlike above this should fail - validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxValidators), "2") - invalidChange := proposal.NewParamChange(p[0], p[1], "value") - p := testProposal(validChange, invalidChange) - err := handler(ctx, p) - require.Error(t, err) - require.Contains(t, err.Error(), "parameter can not be modified") - - ps := app.StakingKeeper.GetParams(ctx) - require.Equal(t, ps.MaxValidators, uint32(1)) - - } } func testProposal(changes ...proposal.ParamChange) *proposal.ParameterChangeProposal { From d8758b1639eb98d4e674bce117aca2ac41ab799a Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 9 Dec 2023 22:50:17 -0500 Subject: [PATCH 03/20] update BlockedParams --- app/app.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/app.go b/app/app.go index 3a292130ce..3f92866e2e 100644 --- a/app/app.go +++ b/app/app.go @@ -734,11 +734,9 @@ func (app *App) setPostHanders() { // governance. func (*App) BlockedParams() [][2]string { return [][2]string{ - // MaxSquareSize - {blobmoduletypes.ModuleName, string(blobmoduletypes.KeyGovMaxSquareSize)}, // bank.SendEnabled {banktypes.ModuleName, string(banktypes.KeySendEnabled)}, - // MaxBlockBytes and consensus.block.TimeIotaMs + // consensus.block.TimeIotaMs {baseapp.Paramspace, string(baseapp.ParamStoreKeyBlockParams)}, // consensus.validator.PubKeyTypes {baseapp.Paramspace, string(baseapp.ParamStoreKeyValidatorParams)}, From d4ea38b8a50b10e002964cf57f45a043a42b33ae Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 9 Dec 2023 23:30:25 -0500 Subject: [PATCH 04/20] Revert "remove invalid param test" This reverts commit f966d2f5f3f3e67a89919e026c3c24ca3a17619a. --- x/paramfilter/test/param_filter_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/x/paramfilter/test/param_filter_test.go b/x/paramfilter/test/param_filter_test.go index 027848bea0..dc6cda917c 100644 --- a/x/paramfilter/test/param_filter_test.go +++ b/x/paramfilter/test/param_filter_test.go @@ -8,6 +8,7 @@ import ( "github.com/celestiaorg/celestia-app/x/paramfilter" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/require" tmlog "github.com/tendermint/tendermint/libs/log" "github.com/tendermint/tendermint/proto/tendermint/types" @@ -33,6 +34,30 @@ func TestParamFilter(t *testing.T) { require.Error(t, err) require.Contains(t, err.Error(), "parameter can not be modified") } + + // ensure that we are not filtering out valid proposals + validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxValidators), "1") + p := testProposal(validChange) + err := handler(ctx, p) + require.NoError(t, err) + + ps := app.StakingKeeper.GetParams(ctx) + require.Equal(t, ps.MaxValidators, uint32(1)) + + // ensure that we're throwing out entire proposals if any of the changes are blocked + for _, p := range app.BlockedParams() { + // try to set the max validators to 2, unlike above this should fail + validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxValidators), "2") + invalidChange := proposal.NewParamChange(p[0], p[1], "value") + p := testProposal(validChange, invalidChange) + err := handler(ctx, p) + require.Error(t, err) + require.Contains(t, err.Error(), "parameter can not be modified") + + ps := app.StakingKeeper.GetParams(ctx) + require.Equal(t, ps.MaxValidators, uint32(1)) + + } } func testProposal(changes ...proposal.ParamChange) *proposal.ParameterChangeProposal { From 9c2d8fcfa007b26be310ec39bf2fcf8a7fc76d76 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 9 Dec 2023 23:56:49 -0500 Subject: [PATCH 05/20] fix TestParamFilter --- x/paramfilter/test/param_filter_test.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/x/paramfilter/test/param_filter_test.go b/x/paramfilter/test/param_filter_test.go index dc6cda917c..65bec1e34c 100644 --- a/x/paramfilter/test/param_filter_test.go +++ b/x/paramfilter/test/param_filter_test.go @@ -36,18 +36,18 @@ func TestParamFilter(t *testing.T) { } // ensure that we are not filtering out valid proposals - validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxValidators), "1") + validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxEntries), "1") p := testProposal(validChange) err := handler(ctx, p) require.NoError(t, err) ps := app.StakingKeeper.GetParams(ctx) - require.Equal(t, ps.MaxValidators, uint32(1)) + require.Equal(t, ps.MaxEntries, uint32(1)) // ensure that we're throwing out entire proposals if any of the changes are blocked for _, p := range app.BlockedParams() { // try to set the max validators to 2, unlike above this should fail - validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxValidators), "2") + validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxEntries), "2") invalidChange := proposal.NewParamChange(p[0], p[1], "value") p := testProposal(validChange, invalidChange) err := handler(ctx, p) @@ -55,8 +55,7 @@ func TestParamFilter(t *testing.T) { require.Contains(t, err.Error(), "parameter can not be modified") ps := app.StakingKeeper.GetParams(ctx) - require.Equal(t, ps.MaxValidators, uint32(1)) - + require.Equal(t, ps.MaxEntries, uint32(1)) } } From 634ab86920c6d6d364cd6e07f5467335bf56ae9c Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Wed, 13 Dec 2023 02:07:57 -0500 Subject: [PATCH 06/20] Add initial test cases for unmodifiable parameters --- test/util/params/governance_params_test.go | 96 ++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 test/util/params/governance_params_test.go diff --git a/test/util/params/governance_params_test.go b/test/util/params/governance_params_test.go new file mode 100644 index 0000000000..e2cfb7d21a --- /dev/null +++ b/test/util/params/governance_params_test.go @@ -0,0 +1,96 @@ +package params_test + +import ( + "testing" + + "github.com/stretchr/testify/suite" + + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + params "github.com/cosmos/cosmos-sdk/x/params" + "github.com/cosmos/cosmos-sdk/x/params/types/proposal" +) + +type HandlerTestSuite struct { + suite.Suite + + app *simapp.SimApp + ctx sdk.Context + govHandler govv1beta1.Handler +} + +func (suite *HandlerTestSuite) SetupTest() { + suite.app = simapp.Setup(suite.T(), false) + suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{}) + suite.govHandler = params.NewParamChangeProposalHandler(suite.app.ParamsKeeper) +} + +func TestHandlerTestSuite(t *testing.T) { + suite.Run(t, new(HandlerTestSuite)) +} + +func testProposal(changes ...proposal.ParamChange) *proposal.ParameterChangeProposal { + return proposal.NewParameterChangeProposal("title", "description", changes) +} + +func (suite *HandlerTestSuite) TestUnmodifiableParameters() { + testCases := []struct { + name string + proposal *proposal.ParameterChangeProposal + onHandle func() + expErr bool + }{ + // This parameters below should not be modifiable, however the tests show they are. + { + "conensus.block", + testProposal(proposal.ParamChange{ + Subspace: baseapp.Paramspace, + Key: string(baseapp.ParamStoreKeyBlockParams), + Value: `{"max_bytes": "100", "max_gas": "100"}`, + }), + func() { + blockParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Block + suite.Require().Equal(abci.BlockParams{ + MaxBytes: 100, + MaxGas: 100, + }, *blockParams) + }, + false, + }, + { + "conensus.validator.PubKeyTypes", + testProposal(proposal.ParamChange{ + Subspace: baseapp.Paramspace, + Key: string(baseapp.ParamStoreKeyValidatorParams), + Value: `{"pub_key_types": ["secp256k1"]}`, + }), + func() { + validatorParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Validator + suite.Require().Equal( + tmproto.ValidatorParams{ + PubKeyTypes: []string{"secp256k1"}, + }, + *validatorParams) + }, + false, + }, + } + + for _, tc := range testCases { + tc := tc + suite.Run(tc.name, func() { + validationErr := suite.govHandler(suite.ctx, tc.proposal) + if tc.expErr { + suite.Require().Error(validationErr) + } else { + suite.Require().NoError(validationErr) + + } + }) + } +} From 574392a16c2b7f3b1c045adae4eab17e69832969 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 16 Dec 2023 02:44:23 -0500 Subject: [PATCH 07/20] test modifying all remaining unmodifiable governance tests --- test/util/params/governance_params_test.go | 100 ++++++++++++++++++--- 1 file changed, 89 insertions(+), 11 deletions(-) diff --git a/test/util/params/governance_params_test.go b/test/util/params/governance_params_test.go index e2cfb7d21a..2ea4c28a10 100644 --- a/test/util/params/governance_params_test.go +++ b/test/util/params/governance_params_test.go @@ -2,18 +2,21 @@ package params_test import ( "testing" + "time" "github.com/stretchr/testify/suite" - abci "github.com/tendermint/tendermint/abci/types" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" params "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) type HandlerTestSuite struct { @@ -47,21 +50,19 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { }{ // This parameters below should not be modifiable, however the tests show they are. { - "conensus.block", + "bank.SendEnabled", testProposal(proposal.ParamChange{ - Subspace: baseapp.Paramspace, - Key: string(baseapp.ParamStoreKeyBlockParams), - Value: `{"max_bytes": "100", "max_gas": "100"}`, + Subspace: banktypes.ModuleName, + Key: string(banktypes.KeySendEnabled), + Value: `[{"denom": "test", "enabled": false}]`, }), func() { - blockParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Block - suite.Require().Equal(abci.BlockParams{ - MaxBytes: 100, - MaxGas: 100, - }, *blockParams) + sendEnabledParams := suite.app.BankKeeper.GetParams(suite.ctx).SendEnabled + suite.Require().Equal([]*banktypes.SendEnabled{banktypes.NewSendEnabled("test", false)}, sendEnabledParams) }, false, }, + // TimeIotaMs is not in conensus.block { "conensus.validator.PubKeyTypes", testProposal(proposal.ParamChange{ @@ -79,6 +80,83 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { }, false, }, + { + "consensus.Version.AppVersion", + testProposal(proposal.ParamChange{ + Subspace: baseapp.Paramspace, + Key: string(baseapp.ParamStoreKeyVersionParams), + Value: `{"app_version": "3"}`, + }), + func() { + versionParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Version + suite.Require().Equal( + tmproto.VersionParams{ + AppVersion: 3, + }, + *versionParams) + }, + false, + }, + { + "mint.MintDenom", + testProposal(proposal.ParamChange{ + Subspace: minttypes.ModuleName, + Key: string(minttypes.KeyMintDenom), + Value: `"test"`, + }), + func() { + mintParams := suite.app.MintKeeper.GetParams(suite.ctx) + suite.Require().Equal( + mintParams.MintDenom, + "test") + }, + false, + }, + { + "staking.BondDenom", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyBondDenom), + Value: `"test"`, + }), + func() { + stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) + suite.Require().Equal( + stakingParams.BondDenom, + "test") + }, + false, + }, + { + "staking.MaxValidators", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyMaxValidators), + Value: `1`, + }), + func() { + stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) + suite.Require().Equal( + stakingParams.MaxValidators, + uint32(1)) + }, + false, + }, + { + "staking.UnbondingTime", + testProposal(proposal.ParamChange{ + Subspace: stakingtypes.ModuleName, + Key: string(stakingtypes.KeyUnbondingTime), + Value: `"1"`, + }), + func() { + stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) + suite.Require().Equal( + stakingParams.UnbondingTime, + time.Duration(1)) + }, + false, + }, } for _, tc := range testCases { @@ -89,7 +167,7 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { suite.Require().Error(validationErr) } else { suite.Require().NoError(validationErr) - + tc.onHandle() } }) } From dbd315aaeddd776a108c8ad2b93231e881ac6578 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 23 Dec 2023 23:36:12 -0500 Subject: [PATCH 08/20] move location of tests and use app.go in test suite --- .../test}/governance_params_test.go | 55 ++++++++++--------- 1 file changed, 29 insertions(+), 26 deletions(-) rename {test/util/params => x/paramfilter/test}/governance_params_test.go (78%) diff --git a/test/util/params/governance_params_test.go b/x/paramfilter/test/governance_params_test.go similarity index 78% rename from test/util/params/governance_params_test.go rename to x/paramfilter/test/governance_params_test.go index 2ea4c28a10..ff13d87831 100644 --- a/test/util/params/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -1,19 +1,21 @@ -package params_test +package test import ( "testing" "time" + "github.com/celestiaorg/celestia-app/app" + "github.com/celestiaorg/celestia-app/x/paramfilter" "github.com/stretchr/testify/suite" tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + testutil "github.com/celestiaorg/celestia-app/test/util" + minttypes "github.com/celestiaorg/celestia-app/x/mint/types" "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" params "github.com/cosmos/cosmos-sdk/x/params" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -22,25 +24,26 @@ import ( type HandlerTestSuite struct { suite.Suite - app *simapp.SimApp + app *app.App ctx sdk.Context - govHandler govv1beta1.Handler + govHandler v1beta1.Handler + pph paramfilter.ParamBlockList } func (suite *HandlerTestSuite) SetupTest() { - suite.app = simapp.Setup(suite.T(), false) + suite.app, _ = testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams()) suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{}) suite.govHandler = params.NewParamChangeProposalHandler(suite.app.ParamsKeeper) + suite.pph = paramfilter.NewParamBlockList([2]string{}) + + minter := minttypes.DefaultMinter() + suite.app.MintKeeper.SetMinter(suite.ctx, minter) } func TestHandlerTestSuite(t *testing.T) { suite.Run(t, new(HandlerTestSuite)) } -func testProposal(changes ...proposal.ParamChange) *proposal.ParameterChangeProposal { - return proposal.NewParameterChangeProposal("title", "description", changes) -} - func (suite *HandlerTestSuite) TestUnmodifiableParameters() { testCases := []struct { name string @@ -97,21 +100,21 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { }, false, }, - { - "mint.MintDenom", - testProposal(proposal.ParamChange{ - Subspace: minttypes.ModuleName, - Key: string(minttypes.KeyMintDenom), - Value: `"test"`, - }), - func() { - mintParams := suite.app.MintKeeper.GetParams(suite.ctx) - suite.Require().Equal( - mintParams.MintDenom, - "test") - }, - false, - }, + // { + // "mint.BondDenom", + // testProposal(proposal.ParamChange{ + // Subspace: minttypes.ModuleName, + // Key: string(minttypes.KeyMinter), + // Value: `{"inflation_rate": "1", "annual_provisions": "3", "PreviousBlockTime": "1", "bond_denom": "test"}`, + // }), + // func() { + // mintParams := suite.app.MintKeeper.GetMinter(suite.ctx) + // suite.Require().Equal( + // mintParams.BondDenom, + // "test") + // }, + // false, + // }, { "staking.BondDenom", testProposal(proposal.ParamChange{ From 610678ded584910bdc3b6d21503afd45b1896a33 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 23 Dec 2023 23:44:06 -0500 Subject: [PATCH 09/20] update commenting --- x/paramfilter/test/governance_params_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index ff13d87831..8f1b889de5 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -51,7 +51,7 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { onHandle func() expErr bool }{ - // This parameters below should not be modifiable, however the tests show they are. + // The tests below show the parameters as modifiable, block in App.BlockedParams(). { "bank.SendEnabled", testProposal(proposal.ParamChange{ @@ -65,7 +65,7 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { }, false, }, - // TimeIotaMs is not in conensus.block + // TimeIotaMs is not in conensus.block, can not submit a governance proposal to modify it. { "conensus.validator.PubKeyTypes", testProposal(proposal.ParamChange{ From db5b4fb349a5078a34f17afd2c246f77e7f70d96 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Sat, 23 Dec 2023 23:44:15 -0500 Subject: [PATCH 10/20] update App.BlockedParams() --- app/app.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/app.go b/app/app.go index 3f92866e2e..15d4387286 100644 --- a/app/app.go +++ b/app/app.go @@ -736,8 +736,6 @@ func (*App) BlockedParams() [][2]string { return [][2]string{ // bank.SendEnabled {banktypes.ModuleName, string(banktypes.KeySendEnabled)}, - // consensus.block.TimeIotaMs - {baseapp.Paramspace, string(baseapp.ParamStoreKeyBlockParams)}, // consensus.validator.PubKeyTypes {baseapp.Paramspace, string(baseapp.ParamStoreKeyValidatorParams)}, // consensus.Version.AppVersion From c874633d2354d7ee029eac44793281ff4166a055 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Mon, 25 Dec 2023 18:28:32 -0500 Subject: [PATCH 11/20] update params.md docs to reference tests --- specs/src/specs/params.md | 4 ++++ x/paramfilter/test/governance_params_test.go | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/specs/src/specs/params.md b/specs/src/specs/params.md index 2b992e4eff..8a88878e47 100644 --- a/specs/src/specs/params.md +++ b/specs/src/specs/params.md @@ -64,3 +64,7 @@ are blocked by the `x/paramfilter` module. | staking.MaxValidators | 100 | Maximum number of validators. | False | | staking.MinCommissionRate | 0.05 (5%) | Minimum commission rate used by all validators. | True | | staking.UnbondingTime | 1814400 (21 days) | Duration of time for unbonding in seconds. | False | + +### Tests +See [/x/paramfilter/test/governance_params_test.go](/x/paramfilter/test/governance_params_test.go) for tests that attempt to modify a parameter. +Note that `TimeIotaMs` is not in `conensus.block`, so a governance proposal can not be submitted to modify it. Additionally, the `x/mint` module does not have any governance modifiable params as justified in [/x/mint/README.md#params](/x/mint/README.md#params) diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index 8f1b889de5..093a9eedc5 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -65,7 +65,6 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { }, false, }, - // TimeIotaMs is not in conensus.block, can not submit a governance proposal to modify it. { "conensus.validator.PubKeyTypes", testProposal(proposal.ParamChange{ From c8cb8452d73c8e21b27b419c4b3b5ce181b2fb1f Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Mon, 25 Dec 2023 19:17:57 -0500 Subject: [PATCH 12/20] update paramter modification test in std_sdk_test.go --- app/test/std_sdk_test.go | 2 +- x/paramfilter/test/param_filter_test.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/test/std_sdk_test.go b/app/test/std_sdk_test.go index 2456d0f650..f3d594d093 100644 --- a/app/test/std_sdk_test.go +++ b/app/test/std_sdk_test.go @@ -273,7 +273,7 @@ func (s *StandardSDKIntegrationTestSuite) TestStandardSDK() { name: "create param proposal change for a modifiable parameter", msgFunc: func() (msgs []sdk.Msg, signer string) { account := s.unusedAccount() - change := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxValidators), "1") + change := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxEntries), "2") content := proposal.NewParameterChangeProposal("title", "description", []proposal.ParamChange{change}) addr := testfactory.GetAddress(s.cctx.Keyring, account) msg, err := oldgov.NewMsgSubmitProposal( diff --git a/x/paramfilter/test/param_filter_test.go b/x/paramfilter/test/param_filter_test.go index 65bec1e34c..f49372dcb7 100644 --- a/x/paramfilter/test/param_filter_test.go +++ b/x/paramfilter/test/param_filter_test.go @@ -46,7 +46,6 @@ func TestParamFilter(t *testing.T) { // ensure that we're throwing out entire proposals if any of the changes are blocked for _, p := range app.BlockedParams() { - // try to set the max validators to 2, unlike above this should fail validChange := proposal.NewParamChange(stakingtypes.ModuleName, string(stakingtypes.KeyMaxEntries), "2") invalidChange := proposal.NewParamChange(p[0], p[1], "value") p := testProposal(validChange, invalidChange) From 3f964c61c6d230c8bb0176c53213bb47ba202917 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Mon, 25 Dec 2023 19:19:29 -0500 Subject: [PATCH 13/20] remove commented out test --- x/paramfilter/test/governance_params_test.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index 093a9eedc5..c04ff498e7 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -99,21 +99,6 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { }, false, }, - // { - // "mint.BondDenom", - // testProposal(proposal.ParamChange{ - // Subspace: minttypes.ModuleName, - // Key: string(minttypes.KeyMinter), - // Value: `{"inflation_rate": "1", "annual_provisions": "3", "PreviousBlockTime": "1", "bond_denom": "test"}`, - // }), - // func() { - // mintParams := suite.app.MintKeeper.GetMinter(suite.ctx) - // suite.Require().Equal( - // mintParams.BondDenom, - // "test") - // }, - // false, - // }, { "staking.BondDenom", testProposal(proposal.ParamChange{ From f953792266215a411c8407d6994006c86f8fb5c6 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Wed, 27 Dec 2023 18:04:38 -0500 Subject: [PATCH 14/20] fix params.md links --- specs/src/specs/params.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/src/specs/params.md b/specs/src/specs/params.md index e43ce1991d..d7302b840f 100644 --- a/specs/src/specs/params.md +++ b/specs/src/specs/params.md @@ -66,5 +66,5 @@ are blocked by the `x/paramfilter` module. | staking.UnbondingTime | 1814400 (21 days) | Duration of time for unbonding in seconds. | False | ### Tests -See [/x/paramfilter/test/governance_params_test.go](/x/paramfilter/test/governance_params_test.go) for tests that attempt to modify a parameter. -Note that `TimeIotaMs` is not in `conensus.block`, so a governance proposal can not be submitted to modify it. Additionally, the `x/mint` module does not have any governance modifiable params as justified in [/x/mint/README.md#params](/x/mint/README.md#params) +See [/x/paramfilter/test/governance_params_test.go](./x/paramfilter/test/governance_params_test.go) for tests that attempt to modify a parameter. +Note that `TimeIotaMs` is not in `conensus.block`, so a governance proposal can not be submitted to modify it. Additionally, the `x/mint` module does not have any governance modifiable params as justified in [/x/mint/README.md#params](./x/mint/README.md#params) From 39fede889d8cf6504427c1df639792fae1994764 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Wed, 27 Dec 2023 18:50:22 -0500 Subject: [PATCH 15/20] Add in test for consensus.block.TimeIotaMs --- x/paramfilter/test/governance_params_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index c04ff498e7..992964441f 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -65,6 +65,25 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { }, false, }, + { + "consensus.block.TimeIotaMs", + testProposal(proposal.ParamChange{ + Subspace: baseapp.Paramspace, + Key: string(baseapp.ParamStoreKeyBlockParams), + Value: `{"max_bytes": "1", "max_gas": "1", "time_iota_ms": "1"}`, + }), + func() { + blockParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Block + suite.Require().Equal( + tmproto.BlockParams{ + MaxBytes: 1, + MaxGas: 1, + TimeIotaMs: 1, + }, + *blockParams) + }, + false, + }, { "conensus.validator.PubKeyTypes", testProposal(proposal.ParamChange{ From 00a5bb47460fa7af49872ff4389f0d09e65ac758 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Wed, 27 Dec 2023 19:00:15 -0500 Subject: [PATCH 16/20] improve naming in governance params test --- go.work.sum | 202 +++++++++++++++++++ x/paramfilter/test/governance_params_test.go | 15 +- 2 files changed, 209 insertions(+), 8 deletions(-) diff --git a/go.work.sum b/go.work.sum index 336f882a2c..0dde3bbf93 100644 --- a/go.work.sum +++ b/go.work.sum @@ -484,8 +484,210 @@ github.com/charithe/durationcheck v0.0.9/go.mod h1:SSbRIBVfMjCi/kEB6K65XEA83D6pr github.com/chavacava/garif v0.0.0-20220630083739-93517212f375 h1:E7LT642ysztPWE0dfz43cWOvMiF42DyTRC+eZIaO4yI= github.com/chavacava/garif v0.0.0-20220630083739-93517212f375/go.mod h1:4m1Rv7xfuwWPNKXlThldNuJvutYM6J95wNuuVmn55To= github.com/checkpoint-restore/go-criu/v5 v5.3.0/go.mod h1:E/eQpaFtUKGOOSEBZgmKAcn+zUUwWxqcaKZlF54wK8E= +github.com/cloudflare/cloudflare-go v0.79.0/go.mod h1:gkHQf9xEubaQPEuerBuoinR9P8bf8a05Lq0X6WKy1Oc= +github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/datadriven v1.0.0/go.mod h1:5Ib8Meh+jk1RlHIXej6Pzevx/NLlNvQB9pmSBZErGA4= +github.com/cockroachdb/errors v1.6.1/go.mod h1:tm6FTP5G81vwJ5lC0SizQo374JNCOPrHyXGitRJoDqM= +github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= +github.com/curioswitch/go-reassign v0.2.0/go.mod h1:x6OpXuWvgfQaMGks2BZybTngWjT84hqJfKoO8Tt/Roc= github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4= +github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= +github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= +github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 h1:H2pdYOb3KQ1/YsqVWoWNLQO+fusocsw354rqGTZtAgw= +github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= +github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= +github.com/ettle/strcase v0.1.1/go.mod h1:hzDLsPC7/lwKyBOywSHEP89nt2pDgdy+No1NBA9o9VY= +github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= +github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/firefart/nonamedreturns v1.0.4/go.mod h1:TDhe/tjI1BXo48CmYbUduTV7BdIga8MAO/xbKdcVsGI= +github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e/go.mod h1:AzA8Lj6YtixmJWL+wkKoBGsLWy9gFrAzi4g+5bCKwpY= +github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4/go.mod h1:T9YF2M40nIgbVgp3rreNmTged+9HrbNTIQf1PsaIiTA= +github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= +github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILDlzrGEckF6HKjXe48EgsY/l7K7vhY4MW8= +github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= +github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98= +github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= +github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= +github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= +github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= +github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= +github.com/golangci/gofmt v0.0.0-20220901101216-f2edd75033f2/go.mod h1:9wOXstvyDRshQ9LggQuzBCGysxs3b6Uo/1MvYCR2NMs= +github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0/go.mod h1:66R6K6P6VWk9I95jvqGxkqJxVWGFy9XlDwLwVz1RCFg= +github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca/go.mod h1:tvlJhZqDe4LMs4ZHD0oMUlt9G2LWuDGoisJTBzLMV9o= +github.com/golangci/revgrep v0.0.0-20220804021717-745bb2f7c2e6/go.mod h1:0AKcRCkMoKvUvlf89F6O7H2LYdhr1zBh736mBItOdRs= +github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= +github.com/gomodule/redigo v1.7.1-0.20190724094224-574c33c3df38/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= +github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= +github.com/googleapis/gax-go/v2 v2.10.0/go.mod h1:4UOEnMCrxsSqQ940WnTiD6qJ63le2ev3xfyagutxiPw= +github.com/googleapis/gax-go/v2 v2.11.0/go.mod h1:DxmR61SGKkGLa2xigwuZIQpkCI2S5iydzRfb3peWZJI= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= +github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= +github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= +github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= +github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= +github.com/hydrogen18/memlistener v0.0.0-20141126152155-54553eb933fb/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= +github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= +github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= +github.com/iris-contrib/go.uuid v2.0.0+incompatible/go.mod h1:iz2lgM/1UnEf1kP0L/+fafWORmlnuysV2EMP8MW+qe0= +github.com/iris-contrib/i18n v0.0.0-20171121225848-987a633949d0/go.mod h1:pMCz62A0xJL6I+umB2YTlFRwWXaDFA0jy+5HzGiJjqI= +github.com/iris-contrib/schema v0.0.1/go.mod h1:urYA3uvUNG1TIIjOSCzHr9/LmbQo8LrOcOqfqxa4hXw= +github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= +github.com/jgautheron/goconst v1.5.1/go.mod h1:aAosetZ5zaeC/2EfMeRswtxUFBpe2Hr7HzkgX4fanO4= +github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= +github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/loggo v0.0.0-20180524022052-584905176618/go.mod h1:vgyd7OREkbtVEN/8IXZe5Ooef3LQePvuBm9UWj6ZL8U= +github.com/juju/testing v0.0.0-20180920084828-472a3e8b2073/go.mod h1:63prj8cnj0tU0S9OHjGJn+b1h0ZghCndfnbQolrYTwA= +github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/kataras/golog v0.0.9/go.mod h1:12HJgwBIZFNGL0EJnMRhmvGA0PQGx8VFwrZtM4CqbAk= +github.com/kataras/iris/v12 v12.0.1/go.mod h1:udK4vLQKkdDqMGJJVd/msuMtN6hpYJhg/lSzuxjhO+U= +github.com/kataras/neffos v0.0.10/go.mod h1:ZYmJC07hQPW67eKuzlfY7SO3bC0mw83A3j6im82hfqw= +github.com/kataras/pio v0.0.0-20190103105442-ea782b38602d/go.mod h1:NV88laa9UiiDuX9AhMbDPkGYSPugBOV6yTZB1l2K9Z0= +github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= +github.com/kisielk/errcheck v1.6.2/go.mod h1:nXw/i/MfnvRHqXa7XXmQMUB0oNFGuBrNI8d8NLy0LPw= +github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.9.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= github.com/klauspost/cpuid v1.2.0 h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE= +github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= +github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= +github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= +github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= +github.com/lufeee/execinquery v1.2.1/go.mod h1:EC7DrEKView09ocscGHC+apXMIaorh4xqSxS/dy8SbM= +github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= +github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/mbilski/exhaustivestruct v1.2.0/go.mod h1:OeTBVxQWoEmB2J2JCHmXWPJ0aksxSUOUy+nvtVEfzXc= +github.com/mediocregopher/mediocre-go-lib v0.0.0-20181029021733-cb65787f37ed/go.mod h1:dSsfyI2zABAdhcbvkXqgxOxrCsbYeHCPgrZkku60dSg= +github.com/mediocregopher/radix/v3 v3.3.0/go.mod h1:EmfVyvspXz1uZEyPBMyGK+kjWiKQGvsUt6O3Pj+LDCQ= +github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= +github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= +github.com/nakabonne/nestif v0.3.1/go.mod h1:9EtoZochLn5iUprVDmDjqGKPofoUEBL8U4Ngq6aY7OE= +github.com/nats-io/nats.go v1.8.1/go.mod h1:BrFz9vVn0fU3AcH9Vn4Kd7W0NpJ651tD5omQ3M8LwxM= +github.com/nats-io/nkeys v0.0.2/go.mod h1:dab7URMsZm6Z/jp9Z5UGa87Uutgc2mVpXLC4B7TDb/4= +github.com/nbutton23/zxcvbn-go v0.0.0-20210217022336-fa2cb2858354/go.mod h1:KSVJerMDfblTH7p5MZaTt+8zaT2iEk3AkVb9PQdZuE8= +github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= +github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= +github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.0/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_model v0.2.1-0.20210607210712-147c58e9608a/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= +github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= +github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= +github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= +github.com/sivchari/nosnakecase v1.7.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= +github.com/ssgreg/nlreturn/v2 v2.2.1/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= +github.com/stbenjam/no-sprintf-host-port v0.1.1/go.mod h1:TLhvtIvONRzdmkFiio4O8LHsN9N74I+PhRquPsxpL0I= +github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaEohUpn8= +github.com/tommy-muehle/go-mnd/v2 v2.5.1/go.mod h1:WsUAkMJMYww6l/ufffCD3m+P7LEvr8TnZn9lwVDlgzw= +github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= +github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= +github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= +github.com/uudashr/gocognit v1.0.6/go.mod h1:nAIUuVBnYU7pcninia3BHOvQkpQCeO76Uscky5BOwcY= +github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xhit/go-str2duration v1.2.0/go.mod h1:3cPSlfZlUHVlneIVfePFWcJZsuwf+P1v2SRTV4cUmp4= +github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= +github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= +github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= +github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= +github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= +github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +gitlab.com/bosi/decorder v0.2.3/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= +go.uber.org/automaxprocs v1.5.2/go.mod h1:eRbA25aqJrxAbsLO0xy5jVwPt7FQnRgjW+efnwa1WM0= +golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0= +golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= +golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190327201419-c70d86f8b7cf/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= +golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= +google.golang.org/api v0.126.0/go.mod h1:mBwVAtz+87bEN6CbA1GtZPDOqY2R5ONPqJeIlvyo4Aw= +google.golang.org/genproto v0.0.0-20180518175338-11a468237815/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:xZnkP7mREFX5MORlOPEzLMr+90PPZQ2QWzrVTWfAq64= +google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:CCviP9RmpZ1mxVr8MUjCnSiY09IbAXZxhLE6EhHIdPU= +google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:vHYtlOoi6TsQ3Uk2yxR7NI5z8uoV+3pZtR4jmHIkRig= +google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:RdyHbowztCGQySiCvQPgWQWgWhGnouTdCflKoDBt32U= +google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97/go.mod h1:v7nGkzlmW8P3n/bKmWBn2WpBjpOEx8Q6gMueudAmKfY= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= +google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= +mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ= +mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc= +mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4= sigs.k8s.io/structured-merge-diff v0.0.0-20190525122527-15d366b2352e h1:4Z09Hglb792X0kfOBBJUPFEyvVfQWrYT/l8h5EKA6JQ= diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index 992964441f..350f8671a9 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -21,7 +21,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) -type HandlerTestSuite struct { +type TestSuite struct { suite.Suite app *app.App @@ -30,7 +30,7 @@ type HandlerTestSuite struct { pph paramfilter.ParamBlockList } -func (suite *HandlerTestSuite) SetupTest() { +func (suite *TestSuite) SetupTest() { suite.app, _ = testutil.SetupTestAppWithGenesisValSet(app.DefaultConsensusParams()) suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{}) suite.govHandler = params.NewParamChangeProposalHandler(suite.app.ParamsKeeper) @@ -40,15 +40,15 @@ func (suite *HandlerTestSuite) SetupTest() { suite.app.MintKeeper.SetMinter(suite.ctx, minter) } -func TestHandlerTestSuite(t *testing.T) { - suite.Run(t, new(HandlerTestSuite)) +func RunTestSuite(t *testing.T) { + suite.Run(t, new(TestSuite)) } -func (suite *HandlerTestSuite) TestUnmodifiableParameters() { +func (suite *TestSuite) TestUnmodifiableParameters() { testCases := []struct { name string proposal *proposal.ParameterChangeProposal - onHandle func() + test func() expErr bool }{ // The tests below show the parameters as modifiable, block in App.BlockedParams(). @@ -166,14 +166,13 @@ func (suite *HandlerTestSuite) TestUnmodifiableParameters() { } for _, tc := range testCases { - tc := tc suite.Run(tc.name, func() { validationErr := suite.govHandler(suite.ctx, tc.proposal) if tc.expErr { suite.Require().Error(validationErr) } else { suite.Require().NoError(validationErr) - tc.onHandle() + tc.test() } }) } From 0ee81b0419eb6e6fc1c0bcd8cc3fcdd85a173409 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Wed, 27 Dec 2023 19:08:21 -0500 Subject: [PATCH 17/20] fix naming and add comment --- x/paramfilter/test/governance_params_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index 350f8671a9..beac68c579 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -40,7 +40,7 @@ func (suite *TestSuite) SetupTest() { suite.app.MintKeeper.SetMinter(suite.ctx, minter) } -func RunTestSuite(t *testing.T) { +func TestTestSuite(t *testing.T) { suite.Run(t, new(TestSuite)) } @@ -48,7 +48,7 @@ func (suite *TestSuite) TestUnmodifiableParameters() { testCases := []struct { name string proposal *proposal.ParameterChangeProposal - test func() + subTest func() expErr bool }{ // The tests below show the parameters as modifiable, block in App.BlockedParams(). @@ -73,6 +73,7 @@ func (suite *TestSuite) TestUnmodifiableParameters() { Value: `{"max_bytes": "1", "max_gas": "1", "time_iota_ms": "1"}`, }), func() { + // need to determine if ConsensusParams.Block should be BlockParams from proto/tendermint/types instead of abci/types blockParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Block suite.Require().Equal( tmproto.BlockParams{ @@ -82,6 +83,7 @@ func (suite *TestSuite) TestUnmodifiableParameters() { }, *blockParams) }, + false, }, { @@ -172,7 +174,7 @@ func (suite *TestSuite) TestUnmodifiableParameters() { suite.Require().Error(validationErr) } else { suite.Require().NoError(validationErr) - tc.test() + tc.subTest() } }) } From 3738a99cbe56285016850becab848615d0a37393 Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Wed, 27 Dec 2023 19:12:33 -0500 Subject: [PATCH 18/20] remove unnecessary expErr bool --- x/paramfilter/test/governance_params_test.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index beac68c579..c5b22abb49 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -49,7 +49,6 @@ func (suite *TestSuite) TestUnmodifiableParameters() { name string proposal *proposal.ParameterChangeProposal subTest func() - expErr bool }{ // The tests below show the parameters as modifiable, block in App.BlockedParams(). { @@ -63,7 +62,6 @@ func (suite *TestSuite) TestUnmodifiableParameters() { sendEnabledParams := suite.app.BankKeeper.GetParams(suite.ctx).SendEnabled suite.Require().Equal([]*banktypes.SendEnabled{banktypes.NewSendEnabled("test", false)}, sendEnabledParams) }, - false, }, { "consensus.block.TimeIotaMs", @@ -83,8 +81,6 @@ func (suite *TestSuite) TestUnmodifiableParameters() { }, *blockParams) }, - - false, }, { "conensus.validator.PubKeyTypes", @@ -101,7 +97,6 @@ func (suite *TestSuite) TestUnmodifiableParameters() { }, *validatorParams) }, - false, }, { "consensus.Version.AppVersion", @@ -118,7 +113,6 @@ func (suite *TestSuite) TestUnmodifiableParameters() { }, *versionParams) }, - false, }, { "staking.BondDenom", @@ -133,7 +127,6 @@ func (suite *TestSuite) TestUnmodifiableParameters() { stakingParams.BondDenom, "test") }, - false, }, { "staking.MaxValidators", @@ -148,7 +141,6 @@ func (suite *TestSuite) TestUnmodifiableParameters() { stakingParams.MaxValidators, uint32(1)) }, - false, }, { "staking.UnbondingTime", @@ -163,19 +155,14 @@ func (suite *TestSuite) TestUnmodifiableParameters() { stakingParams.UnbondingTime, time.Duration(1)) }, - false, }, } for _, tc := range testCases { suite.Run(tc.name, func() { validationErr := suite.govHandler(suite.ctx, tc.proposal) - if tc.expErr { - suite.Require().Error(validationErr) - } else { - suite.Require().NoError(validationErr) - tc.subTest() - } + suite.Require().NoError(validationErr) + tc.subTest() }) } } From f3bc57e1f4440bac12953076ff6725df9d8ad23f Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Wed, 27 Dec 2023 19:19:28 -0500 Subject: [PATCH 19/20] improve readability of TestUnmodifiableParameters --- x/paramfilter/test/governance_params_test.go | 65 +++++++++++--------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index c5b22abb49..39752baf0d 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -48,7 +48,7 @@ func (suite *TestSuite) TestUnmodifiableParameters() { testCases := []struct { name string proposal *proposal.ParameterChangeProposal - subTest func() + subTest func() }{ // The tests below show the parameters as modifiable, block in App.BlockedParams(). { @@ -59,8 +59,9 @@ func (suite *TestSuite) TestUnmodifiableParameters() { Value: `[{"denom": "test", "enabled": false}]`, }), func() { - sendEnabledParams := suite.app.BankKeeper.GetParams(suite.ctx).SendEnabled - suite.Require().Equal([]*banktypes.SendEnabled{banktypes.NewSendEnabled("test", false)}, sendEnabledParams) + gotSendEnabledParams := suite.app.BankKeeper.GetParams(suite.ctx).SendEnabled + wantSendEnabledParams := []*banktypes.SendEnabled{banktypes.NewSendEnabled("test", false)} + suite.Require().Equal(wantSendEnabledParams, gotSendEnabledParams) }, }, { @@ -72,14 +73,15 @@ func (suite *TestSuite) TestUnmodifiableParameters() { }), func() { // need to determine if ConsensusParams.Block should be BlockParams from proto/tendermint/types instead of abci/types - blockParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Block + gotBlockParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Block + wantBlockParams := tmproto.BlockParams{ + MaxBytes: 1, + MaxGas: 1, + TimeIotaMs: 1, + } suite.Require().Equal( - tmproto.BlockParams{ - MaxBytes: 1, - MaxGas: 1, - TimeIotaMs: 1, - }, - *blockParams) + wantBlockParams, + *gotBlockParams) }, }, { @@ -90,12 +92,13 @@ func (suite *TestSuite) TestUnmodifiableParameters() { Value: `{"pub_key_types": ["secp256k1"]}`, }), func() { - validatorParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Validator + gotValidatorParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Validator + wantValidatorParams := tmproto.ValidatorParams{ + PubKeyTypes: []string{"secp256k1"}, + } suite.Require().Equal( - tmproto.ValidatorParams{ - PubKeyTypes: []string{"secp256k1"}, - }, - *validatorParams) + wantValidatorParams, + *gotValidatorParams) }, }, { @@ -106,12 +109,13 @@ func (suite *TestSuite) TestUnmodifiableParameters() { Value: `{"app_version": "3"}`, }), func() { - versionParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Version + gotVersionParams := suite.app.BaseApp.GetConsensusParams(suite.ctx).Version + wantVersionParams := tmproto.VersionParams{ + AppVersion: 3, + } suite.Require().Equal( - tmproto.VersionParams{ - AppVersion: 3, - }, - *versionParams) + wantVersionParams, + *gotVersionParams) }, }, { @@ -122,10 +126,11 @@ func (suite *TestSuite) TestUnmodifiableParameters() { Value: `"test"`, }), func() { - stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) + gotBondDenom := suite.app.StakingKeeper.GetParams(suite.ctx).BondDenom + wantBondDenom := "test" suite.Require().Equal( - stakingParams.BondDenom, - "test") + gotBondDenom, + wantBondDenom) }, }, { @@ -136,10 +141,11 @@ func (suite *TestSuite) TestUnmodifiableParameters() { Value: `1`, }), func() { - stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) + gotMaxValidators := suite.app.StakingKeeper.GetParams(suite.ctx).MaxValidators + wantMaxValidators := uint32(1) suite.Require().Equal( - stakingParams.MaxValidators, - uint32(1)) + gotMaxValidators, + wantMaxValidators) }, }, { @@ -150,10 +156,11 @@ func (suite *TestSuite) TestUnmodifiableParameters() { Value: `"1"`, }), func() { - stakingParams := suite.app.StakingKeeper.GetParams(suite.ctx) + gotUnbondingTime := suite.app.StakingKeeper.GetParams(suite.ctx).UnbondingTime + wantUnbondingTime := time.Duration(1) suite.Require().Equal( - stakingParams.UnbondingTime, - time.Duration(1)) + gotUnbondingTime, + wantUnbondingTime) }, }, } From 5958cb4f18b055e016400da731846e28c41495aa Mon Sep 17 00:00:00 2001 From: fahimahmedx Date: Wed, 27 Dec 2023 19:22:31 -0500 Subject: [PATCH 20/20] change conensus to consensus --- x/paramfilter/test/governance_params_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/paramfilter/test/governance_params_test.go b/x/paramfilter/test/governance_params_test.go index 39752baf0d..58848a5ae8 100644 --- a/x/paramfilter/test/governance_params_test.go +++ b/x/paramfilter/test/governance_params_test.go @@ -85,7 +85,7 @@ func (suite *TestSuite) TestUnmodifiableParameters() { }, }, { - "conensus.validator.PubKeyTypes", + "consensus.validator.PubKeyTypes", testProposal(proposal.ParamChange{ Subspace: baseapp.Paramspace, Key: string(baseapp.ParamStoreKeyValidatorParams),