From 8417fe80b0d61b7ab299005678cb30ad9b9d6c6e Mon Sep 17 00:00:00 2001 From: Roman Date: Wed, 27 Jul 2022 11:08:29 -0700 Subject: [PATCH] feat!: initial deposit requirement for proposals (#296) * feat!: initial deposit for proposals * fix TestValidateInitialDeposit * fix migration tests * integrate new param into simulator * increase consensus version and migration tests * fix app state determinism tests * fix gov cli * fix grpc query tests * more fixes * restore build tags * fix genesis and proposal handler tests * Adam's comment * revert some test changes * fix TestSimulateMsgSubmitProposal * more fixes * err check * uncomment test * fixTestProposalHandler * convert uint32 to dec * revert NewDepositParams API, use decorator instead * fix proto comment * fix more tests * go mod * remove copied proto field * typo * fix tests * fix x/gov/client/testutil tests * add json tags --- docs/core/proto-docs.md | 1 + proto/cosmos/gov/v1beta1/gov.proto | 7 + x/feegrant/client/testutil/cli_test.go | 1 + x/gov/client/testutil/suite.go | 5 +- x/gov/keeper/deposit.go | 18 ++ x/gov/keeper/deposit_test.go | 104 ++++++++++ x/gov/keeper/export_test.go | 7 + x/gov/keeper/msg_server.go | 6 + x/gov/keeper/msg_server_test.go | 88 +++++++++ x/gov/legacy/v040/migrate_test.go | 3 +- x/gov/legacy/v043/json_test.go | 3 +- x/gov/legacy/v3/export_test.go | 3 + x/gov/legacy/v3/store.go | 29 +++ x/gov/legacy/v3/store_test.go | 38 ++++ x/gov/module.go | 2 +- x/gov/simulation/genesis.go | 14 +- x/gov/simulation/genesis_test.go | 16 +- x/gov/simulation/operations.go | 47 +++-- x/gov/simulation/operations_test.go | 2 +- x/gov/types/errors.go | 1 + x/gov/types/gov.pb.go | 258 +++++++++++++++---------- x/gov/types/params.go | 15 +- x/params/proposal_handler_test.go | 7 +- 23 files changed, 538 insertions(+), 137 deletions(-) create mode 100644 x/gov/keeper/export_test.go create mode 100644 x/gov/keeper/msg_server_test.go create mode 100644 x/gov/legacy/v3/export_test.go create mode 100644 x/gov/legacy/v3/store.go create mode 100644 x/gov/legacy/v3/store_test.go diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index e86cd9d05a54..f30ade8a7d93 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -5049,6 +5049,7 @@ DepositParams defines the params for deposits on governance proposals. | `min_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Minimum deposit for a proposal to enter voting period. | | `max_deposit_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months. | | `min_expedited_deposit` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | Minimum expedited deposit for a proposal to enter voting period. | +| `min_initial_deposit_ratio` | [string](#string) | | The ratio representing the proportion of the deposit value that must be paid at proposal submission. | diff --git a/proto/cosmos/gov/v1beta1/gov.proto b/proto/cosmos/gov/v1beta1/gov.proto index f6f2165b755a..9fac9c5dbad5 100644 --- a/proto/cosmos/gov/v1beta1/gov.proto +++ b/proto/cosmos/gov/v1beta1/gov.proto @@ -168,6 +168,13 @@ message DepositParams { (gogoproto.moretags) = "yaml:\"min_expedited_deposit\"", (gogoproto.jsontag) = "min_expedited_deposit,omitempty" ]; + + // The ratio representing the proportion of the deposit value that must be paid at proposal submission. + string min_initial_deposit_ratio = 4 [ + (gogoproto.nullable) = false, + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.jsontag) = "min_initial_deposit_ratio,omitempty" + ]; } // VotingParams defines the params for voting on governance proposals. diff --git a/x/feegrant/client/testutil/cli_test.go b/x/feegrant/client/testutil/cli_test.go index bdbfb78d0bd1..9814e9573b3f 100644 --- a/x/feegrant/client/testutil/cli_test.go +++ b/x/feegrant/client/testutil/cli_test.go @@ -1,3 +1,4 @@ +//go:build norace // +build norace package testutil diff --git a/x/gov/client/testutil/suite.go b/x/gov/client/testutil/suite.go index 2b7fe39f95d7..e891818d690d 100644 --- a/x/gov/client/testutil/suite.go +++ b/x/gov/client/testutil/suite.go @@ -88,7 +88,7 @@ func (s *IntegrationTestSuite) TestCmdParams() { { "json output", []string{fmt.Sprintf("--%s=json", tmcli.OutputFlag)}, - `{"voting_params":{"voting_period":"172800000000000","proposal_voting_periods":null,"expedited_voting_period":"86400000000000"},"tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","expedited_threshold":"0.667000000000000000"},"deposit_params":{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800000000000","min_expedited_deposit":[{"denom":"stake","amount":"50000000"}]}}`, + `{"voting_params":{"voting_period":"172800000000000","proposal_voting_periods":null,"expedited_voting_period":"86400000000000"},"tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000","expedited_threshold":"0.667000000000000000"},"deposit_params":{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800000000000","min_expedited_deposit":[{"denom":"stake","amount":"50000000"}],"min_initial_deposit_ratio":"0.000000000000000000"}}`, }, { "text output", @@ -102,6 +102,7 @@ deposit_params: min_expedited_deposit: - amount: "50000000" denom: stake + min_initial_deposit_ratio: "0.000000000000000000" tally_params: expedited_threshold: "0.667000000000000000" quorum: "0.334000000000000000" @@ -159,7 +160,7 @@ func (s *IntegrationTestSuite) TestCmdParam() { "deposit", fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, - `{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800000000000","min_expedited_deposit":[{"denom":"stake","amount":"50000000"}]}`, + `{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800000000000","min_expedited_deposit":[{"denom":"stake","amount":"50000000"}],"min_initial_deposit_ratio":"0.000000000000000000"}`, }, } diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 8f02e2dd0194..8f32fded36aa 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -186,3 +186,21 @@ func (keeper Keeper) RefundDeposits(ctx sdk.Context, proposalID uint64) { return false }) } + +// validateInitialDeposit validates if initial deposit is greater than or equal to the minimum +// required at the time of proposal submission. This threshold amount is determined by +// the deposit parameters. Returns nil on success, error otherwise. +func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { + depositParams := keeper.GetDepositParams(ctx) + if depositParams.MinInitialDepositRatio.IsNil() || depositParams.MinInitialDepositRatio.IsZero() { + return nil + } + minDepositCoins := depositParams.MinDeposit + for i := range minDepositCoins { + minDepositCoins[i].Amount = minDepositCoins[i].Amount.ToDec().Mul(depositParams.MinInitialDepositRatio).RoundInt() + } + if !initialDeposit.IsAllGTE(minDepositCoins) { + return sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minDepositCoins) + } + return nil +} diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index fd5c7dc43afc..4e538ed5925e 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -12,6 +12,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov/types" ) +const ( + baseDepositTestAmount = 100 + baseDepositTestPercent = 25 +) + func TestDeposits(t *testing.T) { testcases := map[string]struct { isExpedited bool @@ -130,3 +135,102 @@ func TestDeposits(t *testing.T) { require.Len(t, deposits, 0) } } + +func TestValidateInitialDeposit(t *testing.T) { + testcases := map[string]struct { + minDeposit sdk.Coins + minInitialDepositPercent int64 + initialDeposit sdk.Coins + + expectError bool + }{ + "min deposit * initial percent == initial deposit: success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100))), + }, + "min deposit * initial percent < initial deposit: success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100+1))), + }, + "min deposit * initial percent > initial deposit: error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100-1))), + + expectError: true, + }, + "min deposit * initial percent == initial deposit (non-base values and denom): success": { + minDeposit: sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(56912))), + minInitialDepositPercent: 50, + initialDeposit: sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(56912/2+10))), + }, + "min deposit * initial percent == initial deposit but different denoms: error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100))), + + expectError: true, + }, + "min deposit * initial percent == initial deposit (multiple coins): success": { + minDeposit: sdk.NewCoins( + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount)), + sdk.NewCoin("uosmo", sdk.NewInt(baseDepositTestAmount*2))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins( + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin("uosmo", sdk.NewInt(baseDepositTestAmount*2*baseDepositTestPercent/100)), + ), + }, + "min deposit * initial percent > initial deposit (multiple coins): error": { + minDeposit: sdk.NewCoins( + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount)), + sdk.NewCoin("uosmo", sdk.NewInt(baseDepositTestAmount*2))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins( + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin("uosmo", sdk.NewInt(baseDepositTestAmount*2*baseDepositTestPercent/100-1)), + ), + + expectError: true, + }, + "min deposit * initial percent < initial deposit (multiple coins - coin not required by min deposit): success": { + minDeposit: sdk.NewCoins( + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins( + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin("uosmo", sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100-1)), + ), + }, + "0 initial percent: success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositPercent: 0, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount*baseDepositTestPercent/100))), + }, + } + + for name, tc := range testcases { + t.Run(name, func(t *testing.T) { + app := simapp.Setup(false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + + govKeeper := app.GovKeeper + + params := types.DefaultDepositParams() + params.MinDeposit = tc.minDeposit + params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)) + + govKeeper.SetDepositParams(ctx, params) + + err := govKeeper.ValidateInitialDeposit(ctx, tc.initialDeposit) + + if tc.expectError { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/gov/keeper/export_test.go b/x/gov/keeper/export_test.go new file mode 100644 index 000000000000..8f95664932d6 --- /dev/null +++ b/x/gov/keeper/export_test.go @@ -0,0 +1,7 @@ +package keeper + +import sdk "github.com/cosmos/cosmos-sdk/types" + +func (k Keeper) ValidateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { + return k.validateInitialDeposit(ctx, initialDeposit) +} diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index 1b2c6ca6a19e..86c61bff5763 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -26,6 +26,12 @@ var _ types.MsgServer = msgServer{} func (k msgServer) SubmitProposal(goCtx context.Context, msg *types.MsgSubmitProposal) (*types.MsgSubmitProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + initialDeposit := msg.GetInitialDeposit() + + if err := k.validateInitialDeposit(ctx, initialDeposit); err != nil { + return nil, err + } + proposal, err := k.Keeper.SubmitProposal(ctx, msg.GetContent(), msg.IsExpedited) if err != nil { return nil, err diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go new file mode 100644 index 000000000000..2b347c5e19fd --- /dev/null +++ b/x/gov/keeper/msg_server_test.go @@ -0,0 +1,88 @@ +package keeper_test + +import ( + "testing" + + "github.com/cosmos/cosmos-sdk/simapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/keeper" + "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/stretchr/testify/require" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" +) + +func TestSubmitProposal_InitialDeposit(t *testing.T) { + const meetsDepositValue = baseDepositTestAmount * baseDepositTestPercent / 100 + var baseDepositRatioDec = sdk.NewDec(baseDepositTestPercent).Quo(sdk.NewDec(100)) + + testcases := map[string]struct { + minDeposit sdk.Coins + minInitialDepositRatio sdk.Dec + initialDeposit sdk.Coins + accountBalance sdk.Coins + + expectError bool + }{ + "meets initial deposit, enough balance - success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositRatio: baseDepositRatioDec, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + }, + "does not meet initial deposit, enough balance - error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositRatio: baseDepositRatioDec, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + + expectError: true, + }, + "meets initial deposit, not enough balance - error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositRatio: baseDepositRatioDec, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + + expectError: true, + }, + "does not meet initial deposit and not enough balance - error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositRatio: baseDepositRatioDec, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + + expectError: true, + }, + } + + for name, tc := range testcases { + t.Run(name, func(t *testing.T) { + // Setup + app := simapp.Setup(false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + govKeeper := app.GovKeeper + msgServer := keeper.NewMsgServerImpl(govKeeper) + + params := types.DefaultDepositParams() + params.MinDeposit = tc.minDeposit + params.MinInitialDepositRatio = tc.minInitialDepositRatio + govKeeper.SetDepositParams(ctx, params) + + address := simapp.AddTestAddrs(app, ctx, 1, sdk.NewInt(0))[0] + simapp.FundAccount(app.BankKeeper, ctx, address, tc.accountBalance) + + msg, err := types.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address) + require.NoError(t, err) + + // System under test + _, err = msgServer.SubmitProposal(sdk.WrapSDKContext(ctx), msg) + + // Assertions + if tc.expectError { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/gov/legacy/v040/migrate_test.go b/x/gov/legacy/v040/migrate_test.go index 9d9fb3263399..cd2c2faf4b75 100644 --- a/x/gov/legacy/v040/migrate_test.go +++ b/x/gov/legacy/v040/migrate_test.go @@ -98,7 +98,8 @@ func TestMigrate(t *testing.T) { "deposit_params": { "max_deposit_period": "0s", "min_deposit": [], - "min_expedited_deposit": [] + "min_expedited_deposit": [], + "min_initial_deposit_ratio": "0" }, "deposits": [], "proposals": [ diff --git a/x/gov/legacy/v043/json_test.go b/x/gov/legacy/v043/json_test.go index 3e24b31aa2c1..b5ea95614f31 100644 --- a/x/gov/legacy/v043/json_test.go +++ b/x/gov/legacy/v043/json_test.go @@ -51,7 +51,8 @@ func TestMigrateJSON(t *testing.T) { "deposit_params": { "max_deposit_period": "0s", "min_deposit": [], - "min_expedited_deposit": [] + "min_expedited_deposit": [], + "min_initial_deposit_ratio": "0" }, "deposits": [], "proposals": [], diff --git a/x/gov/legacy/v3/export_test.go b/x/gov/legacy/v3/export_test.go new file mode 100644 index 000000000000..c18fb234cf15 --- /dev/null +++ b/x/gov/legacy/v3/export_test.go @@ -0,0 +1,3 @@ +package v3 + +var MinInitialDepositRatio = minInitialDepositRatio diff --git a/x/gov/legacy/v3/store.go b/x/gov/legacy/v3/store.go new file mode 100644 index 000000000000..dd25e9338b2b --- /dev/null +++ b/x/gov/legacy/v3/store.go @@ -0,0 +1,29 @@ +package v3 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +var minInitialDepositRatio = sdk.NewDec(25).Quo(sdk.NewDec(100)) + +// MigrateStore performs in-place store migrations for consensus version 3 +// in the gov module. +// Please note that this is the first version that switches from using +// SDK versioning (v043 etc) for package names to consensus versioning +// of the gov module. +// The migration includes: +// +// - Setting the minimum deposit param in the paramstore. +func MigrateStore(ctx sdk.Context, paramstore paramtypes.Subspace) error { + migrateParamsStore(ctx, paramstore) + return nil +} + +func migrateParamsStore(ctx sdk.Context, paramstore paramtypes.Subspace) { + var depositParams types.DepositParams + paramstore.Get(ctx, types.ParamStoreKeyDepositParams, &depositParams) + depositParams.MinInitialDepositRatio = minInitialDepositRatio + paramstore.Set(ctx, types.ParamStoreKeyDepositParams, depositParams) +} diff --git a/x/gov/legacy/v3/store_test.go b/x/gov/legacy/v3/store_test.go new file mode 100644 index 000000000000..bfe13e566a4f --- /dev/null +++ b/x/gov/legacy/v3/store_test.go @@ -0,0 +1,38 @@ +package v3_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/simapp" + "github.com/cosmos/cosmos-sdk/testutil" + sdk "github.com/cosmos/cosmos-sdk/types" + v3 "github.com/cosmos/cosmos-sdk/x/gov/legacy/v3" + "github.com/cosmos/cosmos-sdk/x/gov/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +func TestGovStoreMigrationToV3ConsensusVersion(t *testing.T) { + encCfg := simapp.MakeTestEncodingConfig() + govKey := sdk.NewKVStoreKey("gov") + transientTestKey := sdk.NewTransientStoreKey("transient_test") + ctx := testutil.DefaultContext(govKey, transientTestKey) + paramstore := paramtypes.NewSubspace(encCfg.Marshaler, encCfg.Amino, govKey, transientTestKey, "gov") + + paramstore = paramstore.WithKeyTable(types.ParamKeyTable()) + + // We assume that all deposit params are set besdides the MinInitialDepositRatio + originalDepositParams := types.DefaultDepositParams() + originalDepositParams.MinInitialDepositRatio = sdk.ZeroDec() + paramstore.Set(ctx, types.ParamStoreKeyDepositParams, originalDepositParams) + + // Run migrations. + err := v3.MigrateStore(ctx, paramstore) + require.NoError(t, err) + + // Make sure the new param is set. + var depositParams types.DepositParams + paramstore.Get(ctx, types.ParamStoreKeyDepositParams, &depositParams) + require.Equal(t, v3.MinInitialDepositRatio, depositParams.MinInitialDepositRatio) +} diff --git a/x/gov/module.go b/x/gov/module.go index a090b2c90da2..69f6d5572839 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -180,7 +180,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 3 } // BeginBlock performs a no-op. func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index b088376af2ad..807163fc1509 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -19,6 +19,7 @@ const ( DepositParamsMinDeposit = "deposit_params_min_deposit" DepositParamsMinExpeditedDeposit = "deposit_params_min_expedited_deposit" DepositParamsDepositPeriod = "deposit_params_deposit_period" + DepositMinInitialPercent = "deposit_params_min_initial_percent" VotingParamsVotingPeriod = "voting_params_voting_period" ExpeditedVotingParamsVotingPeriod = "expedited_voting_params_voting_period" TallyParamsQuorum = "tally_params_quorum" @@ -50,6 +51,11 @@ func GenDepositParamsMinExpeditedDeposit(r *rand.Rand) sdk.Coins { return sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, int64(simulation.RandIntBetween(r, 1e3/2, 1e3)))) } +// GenDepositMinInitialPercent randomized DepositMinInitialPercent +func GenDepositMinInitialDepositRatio(r *rand.Rand) sdk.Dec { + return sdk.NewDec(int64(simulation.RandIntBetween(r, 0, 99))).Quo(sdk.NewDec(100)) +} + // GenVotingParamsVotingPeriod randomized VotingParamsVotingPeriod func GenVotingParamsVotingPeriod(r *rand.Rand) time.Duration { return time.Duration(simulation.RandIntBetween(r, expeditedMaxVotingPeriod, 2*expeditedMaxVotingPeriod)) * time.Second @@ -102,6 +108,12 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { depositPeriod = GenDepositParamsDepositPeriod(r) }, ) + var minInitialDepositRatio sdk.Dec + simState.AppParams.GetOrGenerate( + simState.Cdc, DepositMinInitialPercent, &minInitialDepositRatio, simState.Rand, + func(r *rand.Rand) { minInitialDepositRatio = GenDepositMinInitialDepositRatio(r) }, + ) + var votingPeriod time.Duration simState.AppParams.GetOrGenerate( simState.Cdc, VotingParamsVotingPeriod, &votingPeriod, simState.Rand, @@ -155,7 +167,7 @@ func RandomizedGenState(simState *module.SimulationState) { govGenesis := types.NewGenesisState( startingProposalID, - types.NewDepositParams(minDeposit, depositPeriod, minExpeditedDeposit), + types.NewDepositParams(minDeposit, depositPeriod, minExpeditedDeposit).WithMinInitialDepositRatio(minInitialDepositRatio), types.NewVotingParams(votingPeriod, expeditedVotingPeriod, proposalVotingPeriods), types.NewTallyParams(quorum, threshold, expeditedThreshold, veto), ) diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index 98897defb45f..edb2417c00b7 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -40,16 +40,20 @@ func TestRandomizedGenState(t *testing.T) { var govGenesis types.GenesisState simState.Cdc.MustUnmarshalJSON(simState.GenState[types.ModuleName], &govGenesis) - dec1, _ := sdk.NewDecFromStr("0.375000000000000000") - dec2, _ := sdk.NewDecFromStr("0.487000000000000000") - dec3, _ := sdk.NewDecFromStr("0.524000000000000000") - dec4, _ := sdk.NewDecFromStr("0.313000000000000000") + dec1, _ := sdk.NewDecFromStr("0.466000000000000000") + dec2, _ := sdk.NewDecFromStr("0.485000000000000000") + dec3, _ := sdk.NewDecFromStr("0.511000000000000000") + dec4, _ := sdk.NewDecFromStr("0.291000000000000000") + + minInitialDepositDec, err := sdk.NewDecFromStr("0.880000000000000000") + require.NoError(t, err) require.Equal(t, "272stake", govGenesis.DepositParams.MinDeposit.String()) require.Equal(t, "41h11m36s", govGenesis.DepositParams.MaxDepositPeriod.String()) require.Equal(t, "800stake", govGenesis.DepositParams.MinExpeditedDeposit.String()) - require.Equal(t, float64(270511), govGenesis.VotingParams.VotingPeriod.Seconds()) - require.Equal(t, float64(137225), govGenesis.VotingParams.ExpeditedVotingPeriod.Seconds()) + require.Equal(t, minInitialDepositDec, govGenesis.DepositParams.MinInitialDepositRatio) + require.Equal(t, float64(307362), govGenesis.VotingParams.VotingPeriod.Seconds()) + require.Equal(t, float64(115820), govGenesis.VotingParams.ExpeditedVotingPeriod.Seconds()) require.Equal(t, dec1, govGenesis.TallyParams.Quorum) require.Equal(t, dec2, govGenesis.TallyParams.Threshold) require.Equal(t, dec3, govGenesis.TallyParams.ExpeditedThreshold) diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index a7550980a547..32f20135a80d 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -128,8 +128,10 @@ func SimulateMsgSubmitProposal( return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgSubmitProposal, "content is nil"), nil, nil } + isExpedited := r.Intn(2) == 0 + simAccount, _ := simtypes.RandomAcc(r, accs) - deposit, skip, err := randomDeposit(r, ctx, ak, bk, k, simAccount.Address) + deposit, skip, err := randomDeposit(r, ctx, ak, bk, k, simAccount.Address, isExpedited, true) switch { case skip: return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgSubmitProposal, "skip deposit"), nil, nil @@ -137,7 +139,7 @@ func SimulateMsgSubmitProposal( return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgSubmitProposal, "unable to generate deposit"), nil, err } - msg, err := types.NewMsgSubmitProposalWithExpedited(content, deposit, simAccount.Address, r.Intn(2) == 0) + msg, err := types.NewMsgSubmitProposalWithExpedited(content, deposit, simAccount.Address, isExpedited) if err != nil { return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate a submit proposal msg"), nil, err } @@ -220,7 +222,7 @@ func SimulateMsgDeposit(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Ke return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgDeposit, "unable to generate proposalID"), nil, nil } - deposit, skip, err := randomDeposit(r, ctx, ak, bk, k, simAccount.Address) + deposit, skip, err := randomDeposit(r, ctx, ak, bk, k, simAccount.Address, false, false) switch { case skip: return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgDeposit, "skip deposit"), nil, nil @@ -369,8 +371,15 @@ func operationSimulateMsgVoteWeighted(ak types.AccountKeeper, bk types.BankKeepe // deposit amount between (0, min(balance, minDepositAmount)) // This is to simulate multiple users depositing to get the // proposal above the minimum deposit amount -func randomDeposit(r *rand.Rand, ctx sdk.Context, - ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper, addr sdk.AccAddress, +func randomDeposit( + r *rand.Rand, + ctx sdk.Context, + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, + addr sdk.AccAddress, + isExpedited bool, + useMinAmount bool, ) (deposit sdk.Coins, skip bool, err error) { account := ak.GetAccount(ctx, addr) spendable := bk.SpendableCoins(ctx, account.GetAddress()) @@ -379,24 +388,38 @@ func randomDeposit(r *rand.Rand, ctx sdk.Context, return nil, true, nil // skip } - minDeposit := k.GetDepositParams(ctx).MinDeposit + depositParams := k.GetDepositParams(ctx) + + minDeposit := depositParams.MinDeposit + if isExpedited { + minDeposit = depositParams.MinExpeditedDeposit + } + denomIndex := r.Intn(len(minDeposit)) denom := minDeposit[denomIndex].Denom - depositCoins := spendable.AmountOf(denom) - if depositCoins.IsZero() { + spendableBalance := spendable.AmountOf(denom) + if spendableBalance.IsZero() { return nil, true, nil } - maxAmt := depositCoins - if maxAmt.GT(minDeposit[denomIndex].Amount) { - maxAmt = minDeposit[denomIndex].Amount + minDepositAmount := minDeposit[denomIndex].Amount + + minAmount := sdk.ZeroInt() + if useMinAmount { + minDepositPercent := depositParams.MinInitialDepositRatio + minAmount = minDepositAmount.ToDec().Mul(minDepositPercent).RoundInt() } - amount, err := simtypes.RandPositiveInt(r, maxAmt) + amount, err := simtypes.RandPositiveInt(r, minDepositAmount.Sub(minAmount)) if err != nil { return nil, false, err } + amount = amount.Add(minAmount) + + if amount.GT(spendableBalance) { + return nil, true, nil + } return sdk.Coins{sdk.NewCoin(denom, amount)}, false, nil } diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index fecd5929bbc2..58a2bce29133 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -118,7 +118,7 @@ func TestSimulateMsgSubmitProposal(t *testing.T) { require.True(t, operationMsg.OK) require.Equal(t, "cosmos1p8wcgrjr4pjju90xg6u9cgq55dxwq8j7u4x9a0", msg.Proposer) - require.Equal(t, "2686011stake", msg.InitialDeposit.String()) + require.Equal(t, "25166256stake", msg.InitialDeposit.String()) require.Equal(t, "title-3: ZBSpYuLyYggwexjxusrBqDOTtGTOWeLrQKjLxzIivHSlcxgdXhhuTSkuxKGLwQvuyNhYFmBZHeAerqyNEUzXPFGkqEGqiQWIXnku", msg.GetContent().GetTitle()) require.Equal(t, "description-3: NJWzHdBNpAXKJPHWQdrGYcAHSctgVlqwqHoLfHsXUdStwfefwzqLuKEhmMyYLdbZrcPgYqjNHxPexsruwEGStAneKbWkQDDIlCWBLSiAASNhZqNFlPtfqPJoxKsgMdzjWqLWdqKQuJqWPMvwPQWZUtVMOTMYKJbfdlZsjdsomuScvDmbDkgRualsxDvRJuCAmPOXitIbcyWsKGSdrEunFAOdmXnsuyFVgJqEjbklvmwrUlsxjRSfKZxGcpayDdgoFcnVSutxjRgOSFzPwidAjubMncNweqpbxhXGchpZUxuFDOtpnhNUycJICRYqsPhPSCjPTWZFLkstHWJxvdPEAyEIxXgLwbNOjrgzmaujiBABBIXvcXpLrbcEWNNQsbjvgJFgJkflpRohHUutvnaUqoopuKjTDaemDeSdqbnOzcfJ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jPOOjCFuIvTyhXKLyhUScOXvYthRXpPfKwMhptXaxIxgqBoUqzrWbaoLTVpQoottZyPFfNOoMioXHRuFwMRYUiKvcWPkrayyTLOCFJlAyslDameIuqVAuxErqFPEWIScKpBORIuZqoXlZuTvAjEdlEWDODFRregDTqGNoFBIHxvimmIZwLfFyKUfEWAnNBdtdzDmTPXtpHRGdIbuucfTjOygZsTxPjfweXhSUkMhPjMaxKlMIJMOXcnQfyzeOcbWwNbeH", msg.GetContent().GetDescription()) require.Equal(t, "gov", msg.Route()) diff --git a/x/gov/types/errors.go b/x/gov/types/errors.go index 96973f1751a2..c04ee3832fdf 100644 --- a/x/gov/types/errors.go +++ b/x/gov/types/errors.go @@ -14,4 +14,5 @@ var ( ErrInvalidVote = sdkerrors.Register(ModuleName, 7, "invalid vote option") ErrInvalidGenesis = sdkerrors.Register(ModuleName, 8, "invalid genesis state") ErrNoProposalHandlerExists = sdkerrors.Register(ModuleName, 9, "no handler exists for proposal type") + ErrMinDepositTooSmall = sdkerrors.Register(ModuleName, 10, "minimum deposit is too small") ) diff --git a/x/gov/types/gov.pb.go b/x/gov/types/gov.pb.go index 15af097a9c2b..ea6d67e1648e 100644 --- a/x/gov/types/gov.pb.go +++ b/x/gov/types/gov.pb.go @@ -380,6 +380,8 @@ type DepositParams struct { MaxDepositPeriod time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty" yaml:"max_deposit_period"` // Minimum expedited deposit for a proposal to enter voting period. MinExpeditedDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=min_expedited_deposit,json=minExpeditedDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"min_expedited_deposit,omitempty" yaml:"min_expedited_deposit"` + // The ratio representing the proportion of the deposit value that must be paid at proposal submission. + MinInitialDepositRatio github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_initial_deposit_ratio,omitempty"` } func (m *DepositParams) Reset() { *m = DepositParams{} } @@ -559,110 +561,112 @@ func init() { func init() { proto.RegisterFile("cosmos/gov/v1beta1/gov.proto", fileDescriptor_6e82113c1a9a4b7c) } var fileDescriptor_6e82113c1a9a4b7c = []byte{ - // 1634 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x6f, 0xe2, 0xda, - 0x15, 0xc6, 0x40, 0x7e, 0x70, 0x81, 0x84, 0x77, 0x43, 0x12, 0x42, 0xf3, 0x6c, 0xc6, 0xaf, 0x7a, - 0x8a, 0x46, 0xf3, 0xc8, 0x7b, 0x69, 0xd5, 0xaa, 0x19, 0xa9, 0x2d, 0x04, 0xa7, 0x43, 0xf5, 0x04, - 0xc8, 0xf0, 0x88, 0xde, 0xeb, 0xc2, 0x72, 0xe0, 0x86, 0xb8, 0xc5, 0xbe, 0x14, 0x5f, 0x32, 0x41, - 0xdd, 0x8c, 0xd4, 0xcd, 0x88, 0x45, 0x35, 0xcb, 0xa9, 0x2a, 0xa4, 0x51, 0xab, 0x6e, 0xba, 0xee, - 0xa2, 0xeb, 0xae, 0xa2, 0xaa, 0x52, 0x47, 0x5d, 0x8d, 0xba, 0x60, 0x3a, 0x89, 0x54, 0x8d, 0xb2, - 0xcc, 0x5f, 0x50, 0xd9, 0xf7, 0xda, 0xd8, 0xc0, 0x0c, 0x43, 0x17, 0x5d, 0xc5, 0x9c, 0x7b, 0xbe, - 0xef, 0x9c, 0xf3, 0x71, 0xce, 0xb9, 0x26, 0x60, 0xb7, 0x81, 0x4d, 0x1d, 0x9b, 0xfb, 0x2d, 0x7c, - 0xb1, 0x7f, 0xf1, 0xc5, 0x29, 0x22, 0xea, 0x17, 0xd6, 0x73, 0xb6, 0xd3, 0xc5, 0x04, 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xc0, - 0xab, 0x1b, 0x3e, 0xf0, 0xcd, 0xfb, 0xef, 0xb4, 0x4b, 0xfb, 0x3f, 0x26, 0xf6, 0xec, 0x9d, 0x2e, - 0xdb, 0x5d, 0xfe, 0x9d, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xba, 0x25, 0x63, 0x35, 0x4c, 0x11, - 0x00, 0x00, + // 1673 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcf, 0x8f, 0x1a, 0xc9, + 0x15, 0xa6, 0x81, 0xf9, 0x55, 0xc0, 0x98, 0xad, 0xc1, 0x33, 0x0c, 0xf1, 0x76, 0xe3, 0x76, 0xb4, + 0x1a, 0x59, 0x5e, 0x66, 0xd7, 0x89, 0x12, 0x65, 0x2c, 0x25, 0x01, 0xd3, 0x8e, 0x89, 0x56, 0x80, + 0x1a, 0xcc, 0x68, 0x37, 0x87, 0x56, 0x0f, 0x94, 0x99, 0x4a, 0xe8, 0x2e, 0x42, 0x17, 0xb3, 0x83, + 0x72, 0xd9, 0xa3, 0xc5, 0x21, 0xf2, 0x29, 0x72, 0x14, 0x21, 0x59, 0x89, 0x72, 0xc9, 0x39, 0x87, + 0x9c, 0x73, 0xb2, 0xa2, 0x48, 0x59, 0xe5, 0xb4, 0xca, 0x81, 0xcd, 0xda, 0x52, 0xb4, 0xf2, 0x71, + 0xfe, 0x82, 0xa8, 0xab, 0xaa, 0x9b, 0x6e, 0xc0, 0x8b, 0xc9, 0x21, 0xa7, 0xe9, 0x7e, 0xf5, 0xbe, + 0xef, 0xbd, 0xf7, 0xd5, 0x7b, 0x55, 0xcd, 0x80, 0x1b, 0x6d, 0xe2, 0x58, 0xc4, 0x39, 0xee, 0x92, + 0x8b, 0xe3, 0x8b, 0x0f, 0xcf, 0x10, 0x35, 0x3f, 0x74, 0x9f, 0x0b, 0xfd, 0x01, 0xa1, 0x04, 0x42, + 0x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, 0x82, 0x50, 0x6c, 0x77, 0xdd, 0xed, 0x1d, 0x08, 0x61, 0xb7, 0x57, 0x96, 0xfd, + 0x6d, 0x91, 0x4e, 0x96, 0xa7, 0xb3, 0x40, 0xc1, 0xeb, 0xbe, 0xc6, 0xed, 0x0d, 0xd7, 0xcc, 0x0a, + 0x7f, 0x0c, 0x84, 0x69, 0x26, 0xf1, 0xce, 0xca, 0x58, 0xaa, 0x88, 0xb5, 0x1f, 0x8a, 0x15, 0x56, + 0x38, 0xc5, 0xad, 0x9e, 0xc0, 0x37, 0x41, 0x12, 0x3b, 0x06, 0xba, 0xec, 0xa3, 0x0e, 0xa6, 0xa8, + 0x93, 0x05, 0x79, 0xe9, 0x68, 0x5b, 0x4f, 0x60, 0x47, 0xf3, 0x4c, 0x27, 0x71, 0xf7, 0xe0, 0x51, + 0x5f, 0x44, 0x41, 0x22, 0xd8, 0x61, 0x3f, 0x06, 0xb1, 0x11, 0x72, 0xf8, 0x21, 0x56, 0x2a, 0xac, + 0x71, 0x58, 0x56, 0x6c, 0xaa, 0xbb, 0x50, 0xf8, 0x10, 0x6c, 0x99, 0x67, 0x0e, 0x35, 0xb1, 0x38, + 0xee, 0xd6, 0x66, 0xf1, 0xe0, 0xf0, 0x87, 0x20, 0x6a, 0x13, 0x36, 0xb3, 0xeb, 0x93, 0x44, 0x6d, + 0x02, 0xbb, 0x20, 0x69, 0x13, 0xe3, 0x53, 0x4c, 0xcf, 0x8d, 0x0b, 0x44, 0x09, 0x9b, 0xcc, 0x9d, + 0x92, 0xb6, 0x1e, 0xd3, 0xd5, 0x54, 0xd9, 0xe3, 0xba, 0x07, 0xb9, 0x54, 0x1d, 0xd8, 0xe4, 0x14, + 0xd3, 0xf3, 0x16, 0xa2, 0x44, 0x48, 0xf9, 0x4a, 0x02, 0x71, 0xf7, 0x06, 0xfa, 0xdf, 0x4f, 0xed, + 0x0c, 0xd8, 0xb8, 0x20, 0x14, 0x79, 0x27, 0x36, 0x7f, 0x81, 0x27,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 0xff, 0xc0, + 0xc4, 0x3d, 0xd4, 0xe1, 0x72, 0x96, 0xaa, 0x2f, 0xbe, 0x92, 0x23, 0x5f, 0x7c, 0x25, 0x47, 0x3e, + 0x7b, 0x29, 0x47, 0x5e, 0xbc, 0x94, 0xa5, 0xcf, 0x5f, 0xca, 0xd2, 0xbf, 0x5f, 0xca, 0xd2, 0xd3, + 0x57, 0x72, 0xe4, 0xf3, 0x57, 0x72, 0xe4, 0x8b, 0x57, 0x72, 0xe4, 0x93, 0x6f, 0xbe, 0x66, 0x2f, + 0xd9, 0x3f, 0x71, 0xd8, 0xec, 0x9d, 0x6d, 0xb2, 0x2e, 0xff, 0xce, 0x7f, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x97, 0x49, 0x34, 0x08, 0xdf, 0x11, 0x00, 0x00, } func (this *TextProposal) Equal(that interface{}) bool { @@ -1153,6 +1157,16 @@ func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.MinInitialDepositRatio.Size() + i -= size + if _, err := m.MinInitialDepositRatio.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 if len(m.MinExpeditedDeposit) > 0 { for iNdEx := len(m.MinExpeditedDeposit) - 1; iNdEx >= 0; iNdEx-- { { @@ -1510,6 +1524,8 @@ func (m *DepositParams) Size() (n int) { n += 1 + l + sovGov(uint64(l)) } } + l = m.MinInitialDepositRatio.Size() + n += 1 + l + sovGov(uint64(l)) return n } @@ -2735,6 +2751,40 @@ func (m *DepositParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinInitialDepositRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/x/gov/types/params.go b/x/gov/types/params.go index 56003987d80b..fc17e7fe77d4 100644 --- a/x/gov/types/params.go +++ b/x/gov/types/params.go @@ -76,9 +76,10 @@ func ParamKeyTable() paramtypes.KeyTable { // NewDepositParams creates a new DepositParams object func NewDepositParams(minDeposit sdk.Coins, maxDepositPeriod time.Duration, minExpeditedDeposit sdk.Coins) DepositParams { return DepositParams{ - MinDeposit: minDeposit, - MaxDepositPeriod: maxDepositPeriod, - MinExpeditedDeposit: minExpeditedDeposit, + MinDeposit: minDeposit, + MaxDepositPeriod: maxDepositPeriod, + MinExpeditedDeposit: minExpeditedDeposit, + MinInitialDepositRatio: sdk.ZeroDec(), } } @@ -87,8 +88,12 @@ func DefaultDepositParams() DepositParams { return NewDepositParams( sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)), DefaultPeriod, - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinExpeditedDepositTokens)), - ) + sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinExpeditedDepositTokens))) +} + +func (dp DepositParams) WithMinInitialDepositRatio(ratio sdk.Dec) DepositParams { + dp.MinInitialDepositRatio = ratio + return dp } // String implements stringer insterface diff --git a/x/params/proposal_handler_test.go b/x/params/proposal_handler_test.go index 3005418d7b80..b16ebb96e498 100644 --- a/x/params/proposal_handler_test.go +++ b/x/params/proposal_handler_test.go @@ -69,9 +69,10 @@ func (suite *HandlerTestSuite) TestProposalHandler() { func() { depositParams := suite.app.GovKeeper.GetDepositParams(suite.ctx) suite.Require().Equal(govtypes.DepositParams{ - MinDeposit: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(64000000))), - MaxDepositPeriod: govtypes.DefaultPeriod, - MinExpeditedDeposit: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(64000001))), + MinDeposit: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(64000000))), + MaxDepositPeriod: govtypes.DefaultPeriod, + MinExpeditedDeposit: sdk.NewCoins(sdk.NewCoin("uatom", sdk.NewInt(64000001))), + MinInitialDepositRatio: sdk.ZeroDec(), }, depositParams) }, false,