diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index e3c17faa0eb8..42a112111136 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -163,6 +163,11 @@ - [cosmos/base/snapshots/v1beta1/snapshot.proto](#cosmos/base/snapshots/v1beta1/snapshot.proto) - [Metadata](#cosmos.base.snapshots.v1beta1.Metadata) - [Snapshot](#cosmos.base.snapshots.v1beta1.Snapshot) + - [SnapshotExtensionMeta](#cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta) + - [SnapshotExtensionPayload](#cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload) + - [SnapshotIAVLItem](#cosmos.base.snapshots.v1beta1.SnapshotIAVLItem) + - [SnapshotItem](#cosmos.base.snapshots.v1beta1.SnapshotItem) + - [SnapshotStoreItem](#cosmos.base.snapshots.v1beta1.SnapshotStoreItem) - [cosmos/base/store/v1beta1/commit_info.proto](#cosmos/base/store/v1beta1/commit_info.proto) - [CommitID](#cosmos.base.store.v1beta1.CommitID) @@ -172,11 +177,6 @@ - [cosmos/base/store/v1beta1/listening.proto](#cosmos/base/store/v1beta1/listening.proto) - [StoreKVPair](#cosmos.base.store.v1beta1.StoreKVPair) -- [cosmos/base/store/v1beta1/snapshot.proto](#cosmos/base/store/v1beta1/snapshot.proto) - - [SnapshotIAVLItem](#cosmos.base.store.v1beta1.SnapshotIAVLItem) - - [SnapshotItem](#cosmos.base.store.v1beta1.SnapshotItem) - - [SnapshotStoreItem](#cosmos.base.store.v1beta1.SnapshotStoreItem) - - [cosmos/base/tendermint/v1beta1/query.proto](#cosmos/base/tendermint/v1beta1/query.proto) - [GetBlockByHeightRequest](#cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest) - [GetBlockByHeightResponse](#cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse) @@ -343,6 +343,7 @@ - [Deposit](#cosmos.gov.v1beta1.Deposit) - [DepositParams](#cosmos.gov.v1beta1.DepositParams) - [Proposal](#cosmos.gov.v1beta1.Proposal) + - [ProposalVotingPeriod](#cosmos.gov.v1beta1.ProposalVotingPeriod) - [TallyParams](#cosmos.gov.v1beta1.TallyParams) - [TallyResult](#cosmos.gov.v1beta1.TallyResult) - [TextProposal](#cosmos.gov.v1beta1.TextProposal) @@ -2706,68 +2707,83 @@ Snapshot contains Tendermint state sync snapshot info. - - + - +### SnapshotExtensionMeta +SnapshotExtensionMeta contains metadata about an external snapshotter. - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `name` | [string](#string) | | | +| `format` | [uint32](#uint32) | | | - -
-## cosmos/base/store/v1beta1/commit_info.proto - + -### CommitID -CommitID defines the committment information when a specific store is -committed. +### SnapshotExtensionPayload +SnapshotExtensionPayload contains payloads of an external snapshotter. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `version` | [int64](#int64) | | | -| `hash` | [bytes](#bytes) | | | +| `payload` | [bytes](#bytes) | | | - + -### CommitInfo -CommitInfo defines commit information used by the multi-store when committing -a version/height. +### SnapshotIAVLItem +SnapshotIAVLItem is an exported IAVL node. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `version` | [int64](#int64) | | | -| `store_infos` | [StoreInfo](#cosmos.base.store.v1beta1.StoreInfo) | repeated | | +| `key` | [bytes](#bytes) | | | +| `value` | [bytes](#bytes) | | | +| `version` | [int64](#int64) | | version is block height | +| `height` | [int32](#int32) | | height is depth of the tree. | - + + +### SnapshotItem +SnapshotItem is an item contained in a rootmulti.Store snapshot. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `store` | [SnapshotStoreItem](#cosmos.base.snapshots.v1beta1.SnapshotStoreItem) | | | +| `iavl` | [SnapshotIAVLItem](#cosmos.base.snapshots.v1beta1.SnapshotIAVLItem) | | | +| `extension` | [SnapshotExtensionMeta](#cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta) | | | +| `extension_payload` | [SnapshotExtensionPayload](#cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload) | | | + + -### StoreInfo -StoreInfo defines store-specific commit information. It contains a reference -between a store name and the commit ID. + + + + + +### SnapshotStoreItem +SnapshotStoreItem contains metadata about a snapshotted store. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | `name` | [string](#string) | | | -| `commit_id` | [CommitID](#cosmos.base.store.v1beta1.CommitID) | | | @@ -2783,94 +2799,96 @@ between a store name and the commit ID. - + -## cosmos/base/store/v1beta1/listening.proto - +## cosmos/base/store/v1beta1/commit_info.proto - -### StoreKVPair -StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) -It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and -Deletes + -Since: cosmos-sdk 0.43 +### CommitID +CommitID defines the committment information when a specific store is +committed. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `store_key` | [string](#string) | | the store key for the KVStore this pair originates from | -| `delete` | [bool](#bool) | | true indicates a delete operation, false indicates a set operation | -| `key` | [bytes](#bytes) | | | -| `value` | [bytes](#bytes) | | | +| `version` | [int64](#int64) | | | +| `hash` | [bytes](#bytes) | | | - - + - +### CommitInfo +CommitInfo defines commit information used by the multi-store when committing +a version/height. - +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `version` | [int64](#int64) | | | +| `store_infos` | [StoreInfo](#cosmos.base.store.v1beta1.StoreInfo) | repeated | | - - -## cosmos/base/store/v1beta1/snapshot.proto - + -### SnapshotIAVLItem -SnapshotIAVLItem is an exported IAVL node. +### StoreInfo +StoreInfo defines store-specific commit information. It contains a reference +between a store name and the commit ID. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `key` | [bytes](#bytes) | | | -| `value` | [bytes](#bytes) | | | -| `version` | [int64](#int64) | | | -| `height` | [int32](#int32) | | | +| `name` | [string](#string) | | | +| `commit_id` | [CommitID](#cosmos.base.store.v1beta1.CommitID) | | | + - + -### SnapshotItem -SnapshotItem is an item contained in a rootmulti.Store snapshot. + + -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| `store` | [SnapshotStoreItem](#cosmos.base.store.v1beta1.SnapshotStoreItem) | | | -| `iavl` | [SnapshotIAVLItem](#cosmos.base.store.v1beta1.SnapshotIAVLItem) | | | + + + +## cosmos/base/store/v1beta1/listening.proto + - +### StoreKVPair +StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) +It optionally includes the StoreKey for the originating KVStore and a Boolean flag to distinguish between Sets and +Deletes -### SnapshotStoreItem -SnapshotStoreItem contains metadata about a snapshotted store. +Since: cosmos-sdk 0.43 | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `name` | [string](#string) | | | +| `store_key` | [string](#string) | | the store key for the KVStore this pair originates from | +| `delete` | [bool](#bool) | | true indicates a delete operation, false indicates a set operation | +| `key` | [bytes](#bytes) | | | +| `value` | [bytes](#bytes) | | | @@ -5025,6 +5043,23 @@ Proposal defines the core field members of a governance proposal. + + +### ProposalVotingPeriod +ProposalVotingPeriod defines custom voting periods for a unique governance +proposal type. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `proposal_type` | [string](#string) | | e.g. "cosmos.params.v1beta1.ParameterChangeProposal" | +| `voting_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | | + + + + + + ### TallyParams @@ -5104,7 +5139,8 @@ VotingParams defines the params for voting on governance proposals. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `voting_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | Length of the voting period. | +| `voting_period` | [google.protobuf.Duration](#google.protobuf.Duration) | | voting_period defines the length of the voting period. | +| `proposal_voting_periods` | [ProposalVotingPeriod](#cosmos.gov.v1beta1.ProposalVotingPeriod) | repeated | proposal_voting_periods defines custom voting periods for proposal types. | @@ -6510,7 +6546,7 @@ Params defines the parameters for the staking module. | `historical_entries` | [uint32](#uint32) | | historical_entries is the number of historical entries to persist. | | `bond_denom` | [string](#string) | | bond_denom defines the bondable coin denomination. | | `min_commission_rate` | [string](#string) | | min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators | -| `min_self_delegation` | [string](#string) | | min_self_delegation is the chain-wide minimum self delegation a validator can have | +| `min_self_delegation` | [string](#string) | | min_self_delegation is the chain-wide minimum amount that a validator has to self delegate | diff --git a/proto/cosmos/gov/v1beta1/gov.proto b/proto/cosmos/gov/v1beta1/gov.proto index 01aebf950cf3..c16d62f34b30 100644 --- a/proto/cosmos/gov/v1beta1/gov.proto +++ b/proto/cosmos/gov/v1beta1/gov.proto @@ -163,13 +163,16 @@ message DepositParams { // VotingParams defines the params for voting on governance proposals. message VotingParams { - // Length of the voting period. + // voting_period defines the length of the voting period. google.protobuf.Duration voting_period = 1 [ (gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.jsontag) = "voting_period,omitempty", (gogoproto.moretags) = "yaml:\"voting_period\"" ]; + + // proposal_voting_periods defines custom voting periods for proposal types. + repeated ProposalVotingPeriod proposal_voting_periods = 2 [(gogoproto.nullable) = false]; } // TallyParams defines the params for tallying votes on governance proposals. @@ -198,3 +201,15 @@ message TallyParams { (gogoproto.moretags) = "yaml:\"veto_threshold\"" ]; } + +// ProposalVotingPeriod defines custom voting periods for a unique governance +// proposal type. +message ProposalVotingPeriod { + string proposal_type = 1; // e.g. "cosmos.params.v1beta1.ParameterChangeProposal" + google.protobuf.Duration voting_period = 2 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "voting_period,omitempty", + (gogoproto.moretags) = "yaml:\"voting_period\"" + ]; +} diff --git a/snapshots/types/snapshot.pb.go b/snapshots/types/snapshot.pb.go index 5a70e5eb8d4d..c7e427343346 100644 --- a/snapshots/types/snapshot.pb.go +++ b/snapshots/types/snapshot.pb.go @@ -306,10 +306,12 @@ func (m *SnapshotStoreItem) GetName() string { // SnapshotIAVLItem is an exported IAVL node. type SnapshotIAVLItem struct { - Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - Version int64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` - Height int32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` + Key []byte `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + // version is block height + Version int64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` + // height is depth of the tree. + Height int32 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` } func (m *SnapshotIAVLItem) Reset() { *m = SnapshotIAVLItem{} } diff --git a/x/gov/client/testutil/cli_test.go b/x/gov/client/testutil/cli_test.go index 713c33f12182..6870df4b653b 100644 --- a/x/gov/client/testutil/cli_test.go +++ b/x/gov/client/testutil/cli_test.go @@ -1,3 +1,4 @@ +//go:build norace // +build norace package testutil @@ -21,7 +22,7 @@ func TestIntegrationTestSuite(t *testing.T) { genesisState := types.DefaultGenesisState() genesisState.DepositParams = types.NewDepositParams(sdk.NewCoins(sdk.NewCoin(cfg.BondDenom, types.DefaultMinDepositTokens)), time.Duration(15)*time.Second) - genesisState.VotingParams = types.NewVotingParams(time.Duration(5) * time.Second) + genesisState.VotingParams = types.NewVotingParams(time.Duration(5)*time.Second, []types.ProposalVotingPeriod{}) bz, err := cfg.Codec.MarshalJSON(genesisState) require.NoError(t, err) cfg.GenesisState["gov"] = bz diff --git a/x/gov/client/testutil/suite.go b/x/gov/client/testutil/suite.go index ee2634e3d188..de55c3e20184 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"},"tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000"},"deposit_params":{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800000000000"}}`, + `{"voting_params":{"voting_period":"172800000000000","proposal_voting_periods":null},"tally_params":{"quorum":"0.334000000000000000","threshold":"0.500000000000000000","veto_threshold":"0.334000000000000000"},"deposit_params":{"min_deposit":[{"denom":"stake","amount":"10000000"}],"max_deposit_period":"172800000000000"}}`, }, { "text output", @@ -104,6 +104,7 @@ tally_params: threshold: "0.500000000000000000" veto_threshold: "0.334000000000000000" voting_params: + proposal_voting_periods: null voting_period: "172800000000000" `, }, @@ -137,7 +138,7 @@ func (s *IntegrationTestSuite) TestCmdParam() { "voting", fmt.Sprintf("--%s=json", tmcli.OutputFlag), }, - `{"voting_period":"172800000000000"}`, + `{"voting_period":"172800000000000","proposal_voting_periods":null}`, }, { "tally params", diff --git a/x/gov/keeper/grpc_query.go b/x/gov/keeper/grpc_query.go index 5caf220f77bc..1efb747f6466 100644 --- a/x/gov/keeper/grpc_query.go +++ b/x/gov/keeper/grpc_query.go @@ -169,8 +169,8 @@ func (q Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types return &types.QueryParamsResponse{DepositParams: depositParmas}, nil case types.ParamVoting: - votingParmas := q.GetVotingParams(ctx) - return &types.QueryParamsResponse{VotingParams: votingParmas}, nil + votingParams := q.GetVotingParams(ctx) + return &types.QueryParamsResponse{VotingParams: votingParams}, nil case types.ParamTallying: tallyParams := q.GetTallyParams(ctx) diff --git a/x/gov/keeper/grpc_query_test.go b/x/gov/keeper/grpc_query_test.go index 0e7d6f251091..0818ed817cda 100644 --- a/x/gov/keeper/grpc_query_test.go +++ b/x/gov/keeper/grpc_query_test.go @@ -497,16 +497,16 @@ func (suite *KeeperTestSuite) TestGRPCQueryParams() { } for _, testCase := range testCases { - suite.Run(fmt.Sprintf("Case %s", testCase.msg), func() { + suite.Run(fmt.Sprintf("case %s", testCase.msg), func() { testCase.malleate() params, err := queryClient.Params(gocontext.Background(), req) if testCase.expPass { suite.Require().NoError(err) - suite.Require().Equal(expRes.GetDepositParams(), params.GetDepositParams()) - suite.Require().Equal(expRes.GetVotingParams(), params.GetVotingParams()) - suite.Require().Equal(expRes.GetTallyParams(), params.GetTallyParams()) + suite.Require().True(expRes.GetDepositParams().Equal(params.GetDepositParams())) + suite.Require().True(expRes.GetVotingParams().Equal(params.GetVotingParams())) + suite.Require().True(expRes.GetTallyParams().Equal(params.GetTallyParams())) } else { suite.Require().Error(err) suite.Require().Nil(params) diff --git a/x/gov/keeper/params.go b/x/gov/keeper/params.go index 0c6fc4338b9f..52eb83dc9f31 100644 --- a/x/gov/keeper/params.go +++ b/x/gov/keeper/params.go @@ -16,6 +16,11 @@ func (keeper Keeper) GetDepositParams(ctx sdk.Context) types.DepositParams { func (keeper Keeper) GetVotingParams(ctx sdk.Context) types.VotingParams { var votingParams types.VotingParams keeper.paramSpace.Get(ctx, types.ParamStoreKeyVotingParams, &votingParams) + + if votingParams.ProposalVotingPeriods == nil { + votingParams.ProposalVotingPeriods = []types.ProposalVotingPeriod{} + } + return votingParams } diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 216596932fad..6c7c1e01cf96 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -2,6 +2,10 @@ package keeper import ( "fmt" + "strings" + "time" + + "github.com/gogo/protobuf/proto" "github.com/cosmos/cosmos-sdk/client" sdk "github.com/cosmos/cosmos-sdk/types" @@ -183,17 +187,42 @@ func (keeper Keeper) SetProposalID(ctx sdk.Context, proposalID uint64) { store.Set(types.ProposalIDKey, types.GetProposalIDBytes(proposalID)) } +// ActivateVotingPeriod moves the governance proposal from the deposit stage to +// the voting stage, given that enough deposits have been submitted. It is +// removed from the inactive proposal queue and moved into the active queue. +// Note, if the proposal's contents has a custom voting period registered, that +// voting period is used instead of the base voting period. func (keeper Keeper) ActivateVotingPeriod(ctx sdk.Context, proposal types.Proposal) { proposal.VotingStartTime = ctx.BlockHeader().Time - votingPeriod := keeper.GetVotingParams(ctx).VotingPeriod - proposal.VotingEndTime = proposal.VotingStartTime.Add(votingPeriod) proposal.Status = types.StatusVotingPeriod + + votingPeriod := keeper.GetVotingPeriod(ctx, proposal.GetContent()) + proposal.VotingEndTime = proposal.VotingStartTime.Add(votingPeriod) + keeper.SetProposal(ctx, proposal) keeper.RemoveFromInactiveProposalQueue(ctx, proposal.ProposalId, proposal.DepositEndTime) keeper.InsertActiveProposalQueue(ctx, proposal.ProposalId, proposal.VotingEndTime) } +// GetVotingPeriod returns the voting period for the given proposal Content. If +// the proposal type has a custom voting period registered, we return that. +// Otherwise, we use the default voting period. +func (keeper Keeper) GetVotingPeriod(ctx sdk.Context, content types.Content) time.Duration { + vpParams := keeper.GetVotingParams(ctx) + + // Check if there exists a registered custom voting period for the proposal + // type. + for _, pvp := range vpParams.ProposalVotingPeriods { + contentProto, ok := content.(proto.Message) + if ok && strings.EqualFold(pvp.ProposalType, proto.MessageName(contentProto)) { + return pvp.VotingPeriod + } + } + + return vpParams.VotingPeriod +} + func (keeper Keeper) MarshalProposal(proposal types.Proposal) ([]byte, error) { bz, err := keeper.cdc.Marshal(&proposal) if err != nil { diff --git a/x/gov/keeper/proposal_test.go b/x/gov/keeper/proposal_test.go index a40303fceb31..6dcc19cf1237 100644 --- a/x/gov/keeper/proposal_test.go +++ b/x/gov/keeper/proposal_test.go @@ -6,8 +6,11 @@ import ( "strings" "time" + "github.com/gogo/protobuf/proto" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" ) func (suite *KeeperTestSuite) TestGetSetProposal() { @@ -125,3 +128,27 @@ func (suite *KeeperTestSuite) TestGetProposalsFiltered() { }) } } + +func (suite *KeeperTestSuite) TestGetVotingPeriod() { + var ( + c types.Content + vp time.Duration + ) + + votingParams := suite.app.GovKeeper.GetVotingParams(suite.ctx) + votingParams.ProposalVotingPeriods = append(votingParams.ProposalVotingPeriods, types.ProposalVotingPeriod{ + ProposalType: proto.MessageName(¶mproposal.ParameterChangeProposal{}), + VotingPeriod: time.Hour, + }) + suite.app.GovKeeper.SetVotingParams(suite.ctx, votingParams) + + // require a non-registered proposal type returns the base voting period + c = &types.TextProposal{} + vp = suite.app.GovKeeper.GetVotingPeriod(suite.ctx, c) + suite.Require().Equal(votingParams.VotingPeriod, vp) + + // require a registered proposal type returns the custom voting period + c = ¶mproposal.ParameterChangeProposal{} + vp = suite.app.GovKeeper.GetVotingPeriod(suite.ctx, c) + suite.Require().Equal(time.Hour, vp) +} diff --git a/x/gov/legacy/v040/migrate_test.go b/x/gov/legacy/v040/migrate_test.go index 664696bf296e..cb47240973b9 100644 --- a/x/gov/legacy/v040/migrate_test.go +++ b/x/gov/legacy/v040/migrate_test.go @@ -231,6 +231,7 @@ func TestMigrate(t *testing.T) { }, "votes": [], "voting_params": { + "proposal_voting_periods": [], "voting_period": "0s" } }` diff --git a/x/gov/legacy/v043/json_test.go b/x/gov/legacy/v043/json_test.go index d9f045774661..39504a3cce36 100644 --- a/x/gov/legacy/v043/json_test.go +++ b/x/gov/legacy/v043/json_test.go @@ -118,6 +118,7 @@ func TestMigrateJSON(t *testing.T) { } ], "voting_params": { + "proposal_voting_periods": [], "voting_period": "0s" } }` diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 3f9ed2d086a7..ad7451294e58 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -94,10 +94,25 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { veto = GenTallyParamsVeto(r) }, ) + proposalVotingPeriods := []types.ProposalVotingPeriod{ + { + ProposalType: "cosmos.params.v1beta1.ParameterChangeProposal", + }, + } + for _, pvp := range proposalVotingPeriods { + var pvpDuration time.Duration + simState.AppParams.GetOrGenerate( + simState.Cdc, VotingParamsVotingPeriod, &pvpDuration, simState.Rand, + func(r *rand.Rand) { pvpDuration = GenVotingParamsVotingPeriod(r) }, + ) + + pvp.VotingPeriod = pvpDuration + } + govGenesis := types.NewGenesisState( startingProposalID, types.NewDepositParams(minDeposit, depositPeriod), - types.NewVotingParams(votingPeriod), + types.NewVotingParams(votingPeriod, proposalVotingPeriods), types.NewTallyParams(quorum, threshold, veto), ) diff --git a/x/gov/types/gov.pb.go b/x/gov/types/gov.pb.go index cc46f20a9c54..6cccc4e0e0ea 100644 --- a/x/gov/types/gov.pb.go +++ b/x/gov/types/gov.pb.go @@ -413,8 +413,10 @@ var xxx_messageInfo_DepositParams proto.InternalMessageInfo // VotingParams defines the params for voting on governance proposals. type VotingParams struct { - // Length of the voting period. + // voting_period defines the length of the voting period. VotingPeriod time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty" yaml:"voting_period"` + // proposal_voting_periods defines custom voting periods for proposal types. + ProposalVotingPeriods []ProposalVotingPeriod `protobuf:"bytes,2,rep,name=proposal_voting_periods,json=proposalVotingPeriods,proto3" json:"proposal_voting_periods"` } func (m *VotingParams) Reset() { *m = VotingParams{} } @@ -493,6 +495,45 @@ func (m *TallyParams) XXX_DiscardUnknown() { var xxx_messageInfo_TallyParams proto.InternalMessageInfo +// ProposalVotingPeriod defines custom voting periods for a unique governance +// proposal type. +type ProposalVotingPeriod struct { + ProposalType string `protobuf:"bytes,1,opt,name=proposal_type,json=proposalType,proto3" json:"proposal_type,omitempty"` + VotingPeriod time.Duration `protobuf:"bytes,2,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty" yaml:"voting_period"` +} + +func (m *ProposalVotingPeriod) Reset() { *m = ProposalVotingPeriod{} } +func (*ProposalVotingPeriod) ProtoMessage() {} +func (*ProposalVotingPeriod) Descriptor() ([]byte, []int) { + return fileDescriptor_6e82113c1a9a4b7c, []int{9} +} +func (m *ProposalVotingPeriod) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProposalVotingPeriod) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProposalVotingPeriod.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProposalVotingPeriod) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProposalVotingPeriod.Merge(m, src) +} +func (m *ProposalVotingPeriod) XXX_Size() int { + return m.Size() +} +func (m *ProposalVotingPeriod) XXX_DiscardUnknown() { + xxx_messageInfo_ProposalVotingPeriod.DiscardUnknown(m) +} + +var xxx_messageInfo_ProposalVotingPeriod proto.InternalMessageInfo + func init() { proto.RegisterEnum("cosmos.gov.v1beta1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("cosmos.gov.v1beta1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) @@ -505,103 +546,108 @@ func init() { proto.RegisterType((*DepositParams)(nil), "cosmos.gov.v1beta1.DepositParams") proto.RegisterType((*VotingParams)(nil), "cosmos.gov.v1beta1.VotingParams") proto.RegisterType((*TallyParams)(nil), "cosmos.gov.v1beta1.TallyParams") + proto.RegisterType((*ProposalVotingPeriod)(nil), "cosmos.gov.v1beta1.ProposalVotingPeriod") } func init() { proto.RegisterFile("cosmos/gov/v1beta1/gov.proto", fileDescriptor_6e82113c1a9a4b7c) } var fileDescriptor_6e82113c1a9a4b7c = []byte{ - // 1454 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x51, 0x68, 0xdb, 0x56, - 0x17, 0xb6, 0x6c, 0xc7, 0x89, 0xaf, 0x9d, 0x44, 0xbd, 0x49, 0x13, 0xc7, 0x7f, 0x7f, 0xc9, 0xbf, - 0xfe, 0x9f, 0x12, 0x4a, 0xeb, 0xb4, 0xf9, 0xc7, 0xc6, 0x52, 0xd8, 0x66, 0xc5, 0xca, 0xea, 0x51, - 0x6c, 0x23, 0xab, 0x0e, 0xed, 0x1e, 0x84, 0x62, 0xdf, 0x3a, 0xda, 0x2c, 0x5d, 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d, 0x1f, - 0x47, 0x59, 0x60, 0x51, 0x58, 0xbf, 0x04, 0xc0, 0xd2, 0x93, 0x97, 0x22, 0xa7, 0x02, 0x6a, 0x71, - 0x01, 0xd0, 0x04, 0x3c, 0x6b, 0x11, 0x1d, 0xd9, 0x75, 0x1a, 0x21, 0x76, 0x61, 0x84, 0xff, 0xb2, - 0x08, 0xcb, 0x34, 0xc2, 0x28, 0x03, 0x0d, 0x33, 0xc7, 0xcc, 0x8a, 0x5d, 0xf7, 0x42, 0x3d, 0xe6, - 0xc0, 0x2c, 0xc1, 0xc4, 0x68, 0xea, 0xec, 0x20, 0x35, 0x7d, 0x51, 0x23, 0xde, 0x61, 0x71, 0x16, - 0x69, 0x9c, 0x21, 0xb4, 0x34, 0x51, 0x83, 0x26, 0x3d, 0xac, 0x3f, 0x62, 0x4d, 0x70, 0x69, 0x0f, - 0x13, 0xd3, 0x6e, 0xb8, 0x3f, 0x6f, 0x9b, 0x09, 0x3b, 0x73, 0x61, 0xd9, 0xff, 0x63, 0xe9, 0xa4, - 0x68, 0x3a, 0x63, 0x14, 0xb4, 0xee, 0x79, 0x6a, 0xaf, 0xb8, 0x66, 0xaf, 0xf0, 0x87, 0x80, 0x99, - 0x06, 0x12, 0xc7, 0x2f, 0x8c, 0x25, 0xb1, 0x58, 0x4b, 0x43, 0xb1, 0x86, 0x15, 0x9e, 0xa5, 0x56, - 0x26, 0xf0, 0x46, 0xd4, 0xdd, 0x2a, 0xd2, 0x61, 0x18, 0x24, 0x82, 0xed, 0xf3, 0x01, 0x88, 0x1c, - 0x20, 0x87, 0x6e, 0x28, 0x39, 0x3b, 0xc1, 0x26, 0x2c, 0xd8, 0x44, 0x75, 0xa1, 0xf0, 0x0e, 0x98, - 0x36, 0x76, 0x1c, 0x62, 0x98, 0x6c, 0x97, 0x4d, 0xcc, 0xe2, 0xc3, 0xe1, 0x7b, 0x20, 0x6c, 0x63, - 0x6f, 0x20, 0x27, 0x27, 0x09, 0xdb, 0x18, 0x36,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7b, 0x49, - 0x4f, 0xdd, 0xa1, 0xe3, 0x2d, 0x63, 0xdf, 0x97, 0x8b, 0x9a, 0xbf, 0xe4, 0x40, 0xb2, 0xea, 0x4d, - 0x22, 0xd3, 0xef, 0x73, 0xc0, 0x26, 0xd3, 0xcf, 0x8d, 0xbb, 0x28, 0xb7, 0xdb, 0x2c, 0xb7, 0xe5, - 0x21, 0xdc, 0x50, 0x5a, 0x8b, 0x43, 0x8b, 0x20, 0x98, 0x51, 0x92, 0xda, 0x58, 0x36, 0xbf, 0xf9, - 0xf3, 0xcf, 0x92, 0x79, 0x00, 0x62, 0x9f, 0x75, 0x70, 0xbb, 0x63, 0x79, 0x59, 0x24, 0x65, 0x79, - 0xb2, 0x8f, 0xa1, 0x93, 0xbe, 0xc8, 0x53, 0xfc, 0x20, 0x1b, 0x95, 0x31, 0xc2, 0x1a, 0x88, 0x93, - 0xdd, 0x36, 0x72, 0x76, 0x71, 0x93, 0xfe, 0x00, 0xc9, 0x89, 0x86, 0x91, 0xd2, 0x2f, 0x9c, 0x51, - 0x04, 0x22, 0x0c, 0x78, 0x61, 0x97, 0x03, 0x73, 0xee, 0x84, 0xea, 0x83, 0x50, 0x11, 0x2f, 0x54, - 0x6d, 0xe2, 0x50, 0xa9, 0x61, 0x9e, 0x21, 0x7d, 0x2f, 0x33, 0x7d, 0x87, 0x3c, 0x24, 0x75, 0xd6, - 0x35, 0x68, 0xfe, 0xfb, 0xb5, 0x3f, 0x38, 0x00, 0x02, 0x5f, 0xa8, 0xd7, 0xc1, 0x72, 0xb5, 0xa4, - 0x29, 0x7a, 0xa9, 0xac, 0x15, 0x4a, 0x45, 0xfd, 0x5e, 0xb1, 0x52, 0x56, 0x36, 0x0b, 0x5b, 0x05, - 0x25, 0xcf, 0x87, 0xd2, 0xf3, 0xdd, 0x5e, 0x26, 0x41, 0x1d, 0x15, 0x37, 0x08, 0x94, 0xc0, 0x7c, - 0xd0, 0xfb, 0xbe, 0x52, 0xe1, 0xb9, 0xf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, 0x71, 0x50, - 0x1d, 0xde, 0x04, 0xa9, 0x51, 0x6f, 0x55, 0xf9, 0x48, 0xd9, 0xd4, 0x94, 0x3c, 0x1f, 0x4d, 0xc3, - 0x6e, 0x2f, 0x33, 0x47, 0xfd, 0x55, 0xf4, 0x09, 0xaa, 0x11, 0x74, 0x2e, 0xff, 0x56, 0xae, 0x70, - 0x57, 0xc9, 0xf3, 0x53, 0x41, 0xfe, 0x2d, 0xc3, 0x6c, 0xa2, 0x3a, 0x95, 0x53, 0x2e, 0x1e, 0xbe, - 0x12, 0x42, 0x2f, 0x5e, 0x09, 0xa1, 0x2f, 0x8e, 0x84, 0xd0, 0xe1, 0x91, 0xc0, 0x3d, 0x3f, 0x12, - 0xb8, 0xdf, 0x8f, 0x04, 0xee, 0xc9, 0xb1, 0x10, 0x7a, 0x7e, 0x2c, 0x84, 0x5e, 0x1c, 0x0b, 0xa1, - 0x07, 0x7f, 0xbf, 0x10, 0xf7, 0xbd, 0x7f, 0xff, 0xbc, 0x7e, 0xde, 0x89, 0x79, 0x3b, 0xe4, 0xff, - 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x14, 0xb4, 0xf2, 0xfe, 0x19, 0x0e, 0x00, 0x00, + // 1511 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x41, 0x6c, 0x1a, 0x47, + 0x17, 0x66, 0x01, 0x63, 0x33, 0x80, 0x4d, 0xc6, 0xc4, 0xc6, 0xfc, 0xf9, 0x59, 0xba, 0xa9, 0x22, + 0x2b, 0x4a, 0x70, 0xe2, 0x56, 0xad, 0xea, 0x48, 0x6d, 0xc1, 0xe0, 0x86, 0x2a, 0x02, 0xb4, 0x6c, + 0xb0, 0x92, 0x1e, 0x56, 0x6b, 0x18, 0xe3, 0x6d, 0xd9, 0x1d, 0xca, 0x0e, 0x8e, 0x51, 0x2f, 0x3d, + 0x46, 0x1c, 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 0xe5, 0xa2, + 0x5c, 0x62, 0xb9, 0xd7, 0x4f, 0x2d, 0x52, 0x88, 0xeb, 0xdc, 0x81, 0xef, 0x81, 0xff, 0x8f, 0x83, + 0xab, 0x25, 0xa9, 0x50, 0xfc, 0xc8, 0xc6, 0x7a, 0x13, 0x4b, 0xbd, 0x7e, 0x0a, 0x52, 0xac, 0xab, + 0x8b, 0xae, 0x81, 0xa5, 0x71, 0x68, 0x39, 0x53, 0xa9, 0xe4, 0x73, 0x51, 0x5f, 0x22, 0xda, 0xeb, + 0xa7, 0xc2, 0x14, 0x53, 0x56, 0x0c, 0x03, 0xd5, 0xe1, 0x0d, 0x10, 0x1f, 0xf7, 0x16, 0xf3, 0x1f, + 0xe7, 0x37, 0xa5, 0x7c, 0x2e, 0xea, 0x4f, 0xc0, 0x5e, 0x3f, 0x35, 0x4f, 0xfd, 0x45, 0xf4, 0x29, + 0xaa, 0x11, 0x74, 0x26, 0xff, 0x56, 0xa6, 0x70, 0x27, 0x9f, 0x8b, 0xce, 0x38, 0xf9, 0xb7, 0x14, + 0xb5, 0x89, 0xea, 0xb4, 0x9c, 0xd9, 0xe2, 0xe1, 0x8b, 0xa4, 0xe7, 0xd9, 0x8b, 0xa4, 0xe7, 0xcb, + 0xa3, 0xa4, 0xe7, 0xf0, 0x28, 0xc9, 0x3d, 0x3d, 0x4a, 0x72, 0x7f, 0x1c, 0x25, 0xb9, 0x47, 0xc7, + 0x49, 0xcf, 0xd3, 0xe3, 0xa4, 0xe7, 0xd9, 0x71, 0xd2, 0x73, 0xff, 0xd5, 0x77, 0xc6, 0x81, 0xf5, + 0x0f, 0xd9, 0x1a, 0xc5, 0x9d, 0x80, 0xd5, 0xe5, 0x6f, 0xfd, 0x13, 0x00, 0x00, 0xff, 0xff, 0xc4, + 0x8b, 0xaf, 0xee, 0x3c, 0x0f, 0x00, 0x00, } func (this *TextProposal) Equal(that interface{}) bool { @@ -1124,6 +1170,20 @@ func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ProposalVotingPeriods) > 0 { + for iNdEx := len(m.ProposalVotingPeriods) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProposalVotingPeriods[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) if err8 != nil { return 0, err8 @@ -1188,6 +1248,44 @@ func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ProposalVotingPeriod) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProposalVotingPeriod) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProposalVotingPeriod) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + n9, err9 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.VotingPeriod, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintGov(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x12 + if len(m.ProposalType) > 0 { + i -= len(m.ProposalType) + copy(dAtA[i:], m.ProposalType) + i = encodeVarintGov(dAtA, i, uint64(len(m.ProposalType))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func encodeVarintGov(dAtA []byte, offset int, v uint64) int { offset -= sovGov(v) base := offset @@ -1354,6 +1452,12 @@ func (m *VotingParams) Size() (n int) { _ = l l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod) n += 1 + l + sovGov(uint64(l)) + if len(m.ProposalVotingPeriods) > 0 { + for _, e := range m.ProposalVotingPeriods { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } return n } @@ -1372,6 +1476,21 @@ func (m *TallyParams) Size() (n int) { return n } +func (m *ProposalVotingPeriod) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ProposalType) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + return n +} + func sovGov(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2572,6 +2691,40 @@ func (m *VotingParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalVotingPeriods", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ProposalVotingPeriods = append(m.ProposalVotingPeriods, ProposalVotingPeriod{}) + if err := m.ProposalVotingPeriods[len(m.ProposalVotingPeriods)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) @@ -2742,6 +2895,121 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { } return nil } +func (m *ProposalVotingPeriod) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProposalVotingPeriod: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProposalVotingPeriod: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalType", 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 + } + m.ProposalType = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGov(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/gov/types/params.go b/x/gov/types/params.go index 95621e100f8e..45b1f86d90cb 100644 --- a/x/gov/types/params.go +++ b/x/gov/types/params.go @@ -1,7 +1,10 @@ package types import ( + "errors" "fmt" + "sort" + "strings" "time" yaml "gopkg.in/yaml.v2" @@ -30,6 +33,32 @@ var ( ParamStoreKeyTallyParams = []byte("tallyparams") ) +// Params returns all of the governance params +type Params struct { + VotingParams VotingParams `json:"voting_params" yaml:"voting_params"` + TallyParams TallyParams `json:"tally_params" yaml:"tally_params"` + DepositParams DepositParams `json:"deposit_params" yaml:"deposit_params"` +} + +func (gp Params) String() string { + return gp.VotingParams.String() + "\n" + + gp.TallyParams.String() + "\n" + gp.DepositParams.String() +} + +// NewParams creates a new gov Params instance +func NewParams(vp VotingParams, tp TallyParams, dp DepositParams) Params { + return Params{ + VotingParams: vp, + DepositParams: dp, + TallyParams: tp, + } +} + +// DefaultParams default governance params +func DefaultParams() Params { + return NewParams(DefaultVotingParams(), DefaultTallyParams(), DefaultDepositParams()) +} + // ParamKeyTable - Key declaration for parameters func ParamKeyTable() paramtypes.KeyTable { return paramtypes.NewKeyTable( @@ -136,20 +165,22 @@ func validateTallyParams(i interface{}) error { } // NewVotingParams creates a new VotingParams object -func NewVotingParams(votingPeriod time.Duration) VotingParams { +func NewVotingParams(votingPeriod time.Duration, pvps []ProposalVotingPeriod) VotingParams { return VotingParams{ - VotingPeriod: votingPeriod, + VotingPeriod: votingPeriod, + ProposalVotingPeriods: pvps, } } // DefaultVotingParams default parameters for voting func DefaultVotingParams() VotingParams { - return NewVotingParams(DefaultPeriod) + return NewVotingParams(DefaultPeriod, []ProposalVotingPeriod{}) } // Equal checks equality of TallyParams func (vp VotingParams) Equal(other VotingParams) bool { - return vp.VotingPeriod == other.VotingPeriod + return vp.VotingPeriod == other.VotingPeriod && + ProposalVotingPeriods(vp.ProposalVotingPeriods).Equal(ProposalVotingPeriods(other.ProposalVotingPeriods)) } // String implements stringer interface @@ -168,31 +199,48 @@ func validateVotingParams(i interface{}) error { return fmt.Errorf("voting period must be positive: %s", v.VotingPeriod) } + for _, pvp := range v.ProposalVotingPeriods { + if pvp.ProposalType == "" { + return errors.New("empty proposal type for proposal voting period") + } + if pvp.VotingPeriod <= 0 { + return fmt.Errorf("voting period must be positive for proposal voting period: %s", pvp.VotingPeriod) + } + } + return nil } -// Params returns all of the governance params -type Params struct { - VotingParams VotingParams `json:"voting_params" yaml:"voting_params"` - TallyParams TallyParams `json:"tally_params" yaml:"tally_params"` - DepositParams DepositParams `json:"deposit_params" yaml:"deposit_params"` +func (pvp ProposalVotingPeriod) String() string { + out, _ := yaml.Marshal(pvp) + return string(out) } -func (gp Params) String() string { - return gp.VotingParams.String() + "\n" + - gp.TallyParams.String() + "\n" + gp.DepositParams.String() -} +// ProposalVotingPeriods defines a type alias for a slice of ProposalVotingPeriod +// objects. +type ProposalVotingPeriods []ProposalVotingPeriod -// NewParams creates a new gov Params instance -func NewParams(vp VotingParams, tp TallyParams, dp DepositParams) Params { - return Params{ - VotingParams: vp, - DepositParams: dp, - TallyParams: tp, +func (pvps ProposalVotingPeriods) Equal(other ProposalVotingPeriods) bool { + sort.Slice(pvps, func(i, j int) bool { + return strings.Compare(pvps[i].ProposalType, pvps[j].ProposalType) < 0 + }) + + sort.Slice(other, func(i, j int) bool { + return strings.Compare(other[i].ProposalType, other[j].ProposalType) < 0 + }) + + if len(pvps) != len(other) { + return false } -} -// DefaultParams default governance params -func DefaultParams() Params { - return NewParams(DefaultVotingParams(), DefaultTallyParams(), DefaultDepositParams()) + for i := 0; i < len(pvps); i++ { + a := pvps[i] + b := other[i] + + if strings.Compare(a.ProposalType, b.ProposalType) != 0 || a.VotingPeriod != b.VotingPeriod { + return false + } + } + + return true } diff --git a/x/gov/types/params_test.go b/x/gov/types/params_test.go new file mode 100644 index 000000000000..f2ee99437588 --- /dev/null +++ b/x/gov/types/params_test.go @@ -0,0 +1,93 @@ +package types_test + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +func TestProposalVotingPeriod_String(t *testing.T) { + pvp := types.ProposalVotingPeriod{ + ProposalType: "cosmos.params.v1beta1.ParameterChangeProposal", + VotingPeriod: time.Hour * 24 * 2, + } + expected := `proposaltype: cosmos.params.v1beta1.ParameterChangeProposal +voting_period: 48h0m0s +` + require.Equal(t, expected, pvp.String()) +} + +func TestProposalVotingPeriods_Equal(t *testing.T) { + testCases := []struct { + name string + input types.ProposalVotingPeriods + other types.ProposalVotingPeriods + expectEq bool + }{ + { + name: "equal", + input: []types.ProposalVotingPeriod{ + { + ProposalType: "cosmos.params.v1beta1.ParameterChangeProposal", + VotingPeriod: time.Hour * 24 * 2, + }, + { + ProposalType: "cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + VotingPeriod: time.Hour * 24, + }, + }, + other: []types.ProposalVotingPeriod{ + { + ProposalType: "cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + VotingPeriod: time.Hour * 24, + }, + { + ProposalType: "cosmos.params.v1beta1.ParameterChangeProposal", + VotingPeriod: time.Hour * 24 * 2, + }, + }, + expectEq: true, + }, + { + name: "empty equal", + input: []types.ProposalVotingPeriod{}, + other: []types.ProposalVotingPeriod{}, + expectEq: true, + }, + { + name: "not equal", + input: []types.ProposalVotingPeriod{ + { + ProposalType: "cosmos.params.v1beta1.ParameterChangeProposal", + VotingPeriod: time.Hour, + }, + { + ProposalType: "cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + VotingPeriod: time.Hour, + }, + }, + other: []types.ProposalVotingPeriod{ + { + ProposalType: "cosmos.params.v1beta1.ParameterChangeProposal", + VotingPeriod: time.Hour * 24 * 2, + }, + { + ProposalType: "cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + VotingPeriod: time.Hour * 24, + }, + }, + expectEq: false, + }, + } + + for _, tc := range testCases { + tc := tc + + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.expectEq, tc.input.Equal(tc.other)) + }) + } +} diff --git a/x/staking/types/staking.pb.go b/x/staking/types/staking.pb.go index 863eead66cd6..753f711f8342 100644 --- a/x/staking/types/staking.pb.go +++ b/x/staking/types/staking.pb.go @@ -846,7 +846,7 @@ type Params struct { BondDenom string `protobuf:"bytes,5,opt,name=bond_denom,json=bondDenom,proto3" json:"bond_denom,omitempty" yaml:"bond_denom"` // min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators MinCommissionRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=min_commission_rate,json=minCommissionRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_commission_rate" yaml:"min_commission_rate"` - // min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators + // min_self_delegation is the chain-wide minimum amount that a validator has to self delegate MinSelfDelegation github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,7,opt,name=min_self_delegation,json=minSelfDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"min_self_delegation" yaml:"min_self_delegation"` }