From 7a102b4000320ce337da9a5971b7b204cd882eed Mon Sep 17 00:00:00 2001 From: Adam Hanna Date: Tue, 17 Sep 2024 15:15:27 -0400 Subject: [PATCH] feat(x/gov): min amount per deposit (#13) Backport of https://github.com/cosmos/cosmos-sdk/pull/19312 Co-authored-by: Adam Hanna --- proto/atomone/gov/module/v1/module.proto | 7 +- proto/atomone/gov/v1/genesis.proto | 6 +- proto/atomone/gov/v1/gov.proto | 90 +++++--- proto/atomone/gov/v1/query.proto | 29 +-- proto/atomone/gov/v1/tx.proto | 83 +++---- proto/atomone/gov/v1beta1/genesis.proto | 30 ++- proto/atomone/gov/v1beta1/gov.proto | 178 ++++++++------- proto/atomone/gov/v1beta1/query.proto | 61 ++++-- proto/atomone/gov/v1beta1/tx.proto | 83 +++---- tests/e2e/genesis.go | 2 +- x/gov/abci_test.go | 10 +- x/gov/keeper/deposit.go | 50 ++++- x/gov/keeper/deposit_test.go | 79 +++++++ x/gov/keeper/msg_server.go | 15 ++ x/gov/keeper/msg_server_test.go | 26 ++- x/gov/simulation/genesis.go | 13 +- x/gov/simulation/operations.go | 12 +- x/gov/simulation/operations_test.go | 6 +- x/gov/types/v1/genesis.pb.go | 3 - x/gov/types/v1/gov.pb.go | 263 ++++++++++++++++------- x/gov/types/v1/params.go | 9 +- x/gov/types/v1/tx.pb.go | 12 +- x/gov/types/v1beta1/gov.pb.go | 7 +- x/gov/types/v1beta1/tx.pb.go | 9 +- 24 files changed, 736 insertions(+), 347 deletions(-) diff --git a/proto/atomone/gov/module/v1/module.proto b/proto/atomone/gov/module/v1/module.proto index 65d63782..ea133370 100644 --- a/proto/atomone/gov/module/v1/module.proto +++ b/proto/atomone/gov/module/v1/module.proto @@ -7,13 +7,14 @@ import "cosmos/app/v1alpha1/module.proto"; // Module is the config object of the gov module. message Module { option (cosmos.app.v1alpha1.module) = { - go_import: "github.com/atomone-hub/atomone/x/gov" + go_import : "github.com/atomone-hub/atomone/x/gov" }; - // max_metadata_len defines the maximum proposal metadata length. + // max_metadata_len defines the maximum proposal metadata length. // Defaults to 255 if not explicitly set. uint64 max_metadata_len = 1; - // authority defines the custom module authority. If not set, defaults to the governance module. + // authority defines the custom module authority. If not set, defaults to the + // governance module. string authority = 2; } diff --git a/proto/atomone/gov/v1/genesis.proto b/proto/atomone/gov/v1/genesis.proto index a153dba7..ebaddf79 100644 --- a/proto/atomone/gov/v1/genesis.proto +++ b/proto/atomone/gov/v1/genesis.proto @@ -19,13 +19,13 @@ message GenesisState { repeated Proposal proposals = 4; // Deprecated: Prefer to use `params` instead. // deposit_params defines all the paramaters of related to deposit. - DepositParams deposit_params = 5 [deprecated = true]; + DepositParams deposit_params = 5 [ deprecated = true ]; // Deprecated: Prefer to use `params` instead. // voting_params defines all the paramaters of related to voting. - VotingParams voting_params = 6 [deprecated = true]; + VotingParams voting_params = 6 [ deprecated = true ]; // Deprecated: Prefer to use `params` instead. // tally_params defines all the paramaters of related to tally. - TallyParams tally_params = 7 [deprecated = true]; + TallyParams tally_params = 7 [ deprecated = true ]; // params defines all the paramaters of x/gov module. // // Since: cosmos-sdk 0.47 diff --git a/proto/atomone/gov/v1/gov.proto b/proto/atomone/gov/v1/gov.proto index cae1b662..8780de15 100644 --- a/proto/atomone/gov/v1/gov.proto +++ b/proto/atomone/gov/v1/gov.proto @@ -26,56 +26,60 @@ enum VoteOption { // WeightedVoteOption defines a unit of vote for vote split. message WeightedVoteOption { - // option defines the valid vote options, it must not contain duplicate vote options. + // option defines the valid vote options, it must not contain duplicate vote + // options. VoteOption option = 1; // weight is the vote weight associated with the vote option. - string weight = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string weight = 2 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } // Deposit defines an amount deposited by an account address to an active // proposal. message Deposit { // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; - + uint64 proposal_id = 1; + // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string depositor = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // amount to be deposited by depositor. - repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated cosmos.base.v1beta1.Coin amount = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // Proposal defines the core field members of a governance proposal. message Proposal { // id defines the unique id of the proposal. - uint64 id = 1; + uint64 id = 1; // messages are the arbitrary messages to be executed if the proposal passes. repeated google.protobuf.Any messages = 2; // status defines the proposal status. - ProposalStatus status = 3; + ProposalStatus status = 3; // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. - TallyResult final_tally_result = 4; - + TallyResult final_tally_result = 4; + // submit_time is the time of proposal submission. - google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; - + google.protobuf.Timestamp submit_time = 5 [ (gogoproto.stdtime) = true ]; + // deposit_end_time is the end time for deposition. - google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; - + google.protobuf.Timestamp deposit_end_time = 6 [ (gogoproto.stdtime) = true ]; + // total_deposit is the total deposit on the proposal. - repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + repeated cosmos.base.v1beta1.Coin total_deposit = 7 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + // voting_start_time is the starting time to vote on a proposal. - google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true]; - + google.protobuf.Timestamp voting_start_time = 8 + [ (gogoproto.stdtime) = true ]; + // voting_end_time is the end time of voting on a proposal. - google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp voting_end_time = 9 [ (gogoproto.stdtime) = true ]; // metadata is any arbitrary metadata attached to the proposal. string metadata = 10; @@ -93,7 +97,7 @@ message Proposal { // Proposer is the address of the proposal sumbitter // // Since: cosmos-sdk 0.47 - string proposer = 13 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string proposer = 13 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // ProposalStatus enumerates the valid statuses of a proposal. @@ -120,9 +124,9 @@ enum ProposalStatus { // TallyResult defines a standard tally for a governance proposal. message TallyResult { // yes_count is the number of yes votes on a proposal. - string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"]; + string yes_count = 1 [ (cosmos_proto.scalar) = "cosmos.Int" ]; // abstain_count is the number of abstain votes on a proposal. - string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"]; + string abstain_count = 2 [ (cosmos_proto.scalar) = "cosmos.Int" ]; // no_count is the number of no votes on a proposal. string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; } @@ -134,8 +138,8 @@ message Vote { uint64 proposal_id = 1; // voter is the voter address of the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + reserved 3; // options is the weighted vote options. @@ -148,26 +152,30 @@ message Vote { // DepositParams defines the params for deposits on governance proposals. message DepositParams { // Minimum deposit for a proposal to enter voting period. - repeated cosmos.base.v1beta1.Coin min_deposit = 1 - [(gogoproto.nullable) = false, (gogoproto.jsontag) = "min_deposit,omitempty"]; + repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "min_deposit,omitempty" + ]; // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. - google.protobuf.Duration max_deposit_period = 2 - [(gogoproto.stdduration) = true, (gogoproto.jsontag) = "max_deposit_period,omitempty"]; + google.protobuf.Duration max_deposit_period = 2 [ + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "max_deposit_period,omitempty" + ]; } // VotingParams defines the params for voting on governance proposals. message VotingParams { // Duration of the voting period. - google.protobuf.Duration voting_period = 1 [(gogoproto.stdduration) = true]; + google.protobuf.Duration voting_period = 1 [ (gogoproto.stdduration) = true ]; } // TallyParams defines the params for tallying votes on governance proposals. message TallyParams { // Minimum percentage of total stake needed to vote for a result to be // considered valid. - string quorum = 1 [(cosmos_proto.scalar) = "cosmos.Dec"]; + string quorum = 1 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; // Minimum proportion of Yes votes for proposal to pass. Default value: 2/3. string threshold = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; @@ -178,14 +186,16 @@ message TallyParams { // Since: cosmos-sdk 0.47 message Params { // Minimum deposit for a proposal to enter voting period. - repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated cosmos.base.v1beta1.Coin min_deposit = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. - google.protobuf.Duration max_deposit_period = 2 [(gogoproto.stdduration) = true]; + google.protobuf.Duration max_deposit_period = 2 + [ (gogoproto.stdduration) = true ]; // Duration of the voting period. - google.protobuf.Duration voting_period = 3 [(gogoproto.stdduration) = true]; + google.protobuf.Duration voting_period = 3 [ (gogoproto.stdduration) = true ]; // Minimum percentage of total stake needed to vote for a result to be // considered valid. Default value: 0.25. @@ -202,4 +212,16 @@ message Params { // burn deposits if the proposal does not enter voting period bool burn_proposal_deposit_prevote = 14; + + // burn deposits if quorum with vote type no_veto is met + bool burn_vote_veto = 15; + + // The ratio representing the proportion of the deposit value minimum that + // must be met when making a deposit. Default value: 0.01. Meaning that for a + // chain with a min_deposit of 100stake, a deposit of 1stake would be + // required. + // + // Since: cosmos-sdk 0.50 + // NOTE: backported from v50 (https://github.com/cosmos/cosmos-sdk/pull/18146) + string min_deposit_ratio = 16 [ (cosmos_proto.scalar) = "cosmos.Dec" ]; } diff --git a/proto/atomone/gov/v1/query.proto b/proto/atomone/gov/v1/query.proto index 0a9ac285..59da0c67 100644 --- a/proto/atomone/gov/v1/query.proto +++ b/proto/atomone/gov/v1/query.proto @@ -29,12 +29,14 @@ service Query { // Vote queries voted information based on proposalID, voterAddr. rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) { - option (google.api.http).get = "/atomone/gov/v1/proposals/{proposal_id}/votes/{voter}"; + option (google.api.http).get = + "/atomone/gov/v1/proposals/{proposal_id}/votes/{voter}"; } // Votes queries votes of a given proposal. rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) { - option (google.api.http).get = "/atomone/gov/v1/proposals/{proposal_id}/votes"; + option (google.api.http).get = + "/atomone/gov/v1/proposals/{proposal_id}/votes"; } // Params queries all parameters of the gov module. @@ -44,17 +46,20 @@ service Query { // Deposit queries single deposit information based proposalID, depositAddr. rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { - option (google.api.http).get = "/atomone/gov/v1/proposals/{proposal_id}/deposits/{depositor}"; + option (google.api.http).get = + "/atomone/gov/v1/proposals/{proposal_id}/deposits/{depositor}"; } // Deposits queries all deposits of a single proposal. rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) { - option (google.api.http).get = "/atomone/gov/v1/proposals/{proposal_id}/deposits"; + option (google.api.http).get = + "/atomone/gov/v1/proposals/{proposal_id}/deposits"; } // TallyResult queries the tally of a proposal vote. rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) { - option (google.api.http).get = "/atomone/gov/v1/proposals/{proposal_id}/tally"; + option (google.api.http).get = + "/atomone/gov/v1/proposals/{proposal_id}/tally"; } } @@ -84,10 +89,10 @@ message QueryProposalsRequest { ProposalStatus proposal_status = 1; // voter defines the voter address for the proposals. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // depositor defines the deposit addresses from the proposals. - string depositor = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string depositor = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 4; @@ -109,7 +114,7 @@ message QueryVoteRequest { uint64 proposal_id = 1; // voter defines the voter address for the proposals. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // QueryVoteResponse is the response type for the Query/Vote RPC method. @@ -147,13 +152,13 @@ message QueryParamsRequest { message QueryParamsResponse { // Deprecated: Prefer to use `params` instead. // voting_params defines the parameters related to voting. - VotingParams voting_params = 1 [deprecated = true]; + VotingParams voting_params = 1 [ deprecated = true ]; // Deprecated: Prefer to use `params` instead. // deposit_params defines the parameters related to deposit. - DepositParams deposit_params = 2 [deprecated = true]; + DepositParams deposit_params = 2 [ deprecated = true ]; // Deprecated: Prefer to use `params` instead. // tally_params defines the parameters related to tally. - TallyParams tally_params = 3 [deprecated = true]; + TallyParams tally_params = 3 [ deprecated = true ]; // params defines all the paramaters of x/gov module. // // Since: cosmos-sdk 0.47 @@ -166,7 +171,7 @@ message QueryDepositRequest { uint64 proposal_id = 1; // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string depositor = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // QueryDepositResponse is the response type for the Query/Deposit RPC method. diff --git a/proto/atomone/gov/v1/tx.proto b/proto/atomone/gov/v1/tx.proto index da89a6a3..9d8b8e36 100644 --- a/proto/atomone/gov/v1/tx.proto +++ b/proto/atomone/gov/v1/tx.proto @@ -21,12 +21,14 @@ service Msg { // ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal // to execute a legacy content-based proposal. - rpc ExecLegacyContent(MsgExecLegacyContent) returns (MsgExecLegacyContentResponse); + rpc ExecLegacyContent(MsgExecLegacyContent) + returns (MsgExecLegacyContentResponse); // Vote defines a method to add a vote on a specific proposal. rpc Vote(MsgVote) returns (MsgVoteResponse); - // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // VoteWeighted defines a method to add a weighted vote on a specific + // proposal. rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse); // Deposit defines a method to add deposit on a specific proposal. @@ -43,17 +45,19 @@ service Msg { // proposal Content. message MsgSubmitProposal { option (cosmos.msg.v1.signer) = "proposer"; - option (amino.name) = "atomone/v1/MsgSubmitProposal"; + option (amino.name) = "atomone/v1/MsgSubmitProposal"; // messages are the arbitrary messages to be executed if proposal passes. - repeated google.protobuf.Any messages = 1; + repeated google.protobuf.Any messages = 1; + + // initial_deposit is the deposit value that must be paid at proposal + // submission. + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - // initial_deposit is the deposit value that must be paid at proposal submission. - repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - // proposer is the account address of the proposer. - string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string proposer = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // metadata is any arbitrary metadata attached to the proposal. string metadata = 4; @@ -78,10 +82,11 @@ message MsgSubmitProposalResponse { // This ensures backwards compatibility with v1beta1.MsgSubmitProposal. message MsgExecLegacyContent { option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "atomone/v1/MsgExecLegacyContent"; + option (amino.name) = "atomone/v1/MsgExecLegacyContent"; // content is the proposal's content. - google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "atomone.gov.v1beta1.Content"]; + google.protobuf.Any content = 1 + [ (cosmos_proto.accepts_interface) = "atomone.gov.v1beta1.Content" ]; // authority must be the gov module address. string authority = 2; } @@ -92,19 +97,20 @@ message MsgExecLegacyContentResponse {} // MsgVote defines a message to cast a vote. message MsgVote { option (cosmos.msg.v1.signer) = "voter"; - option (amino.name) = "atomone/v1/MsgVote"; + option (amino.name) = "atomone/v1/MsgVote"; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 + [ (gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true ]; + // voter is the voter address for the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // option defines the vote option. - VoteOption option = 3; - + VoteOption option = 3; + // metadata is any arbitrary metadata attached to the Vote. - string metadata = 4; + string metadata = 4; } // MsgVoteResponse defines the Msg/Vote response type. @@ -113,19 +119,20 @@ message MsgVoteResponse {} // MsgVoteWeighted defines a message to cast a vote. message MsgVoteWeighted { option (cosmos.msg.v1.signer) = "voter"; - option (amino.name) = "atomone/v1/MsgVoteWeighted"; + option (amino.name) = "atomone/v1/MsgVoteWeighted"; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 + [ (gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true ]; + // voter is the voter address for the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // options defines the weighted vote options. - repeated WeightedVoteOption options = 3; + repeated WeightedVoteOption options = 3; // metadata is any arbitrary metadata attached to the VoteWeighted. - string metadata = 4; + string metadata = 4; } // MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. @@ -134,16 +141,18 @@ message MsgVoteWeightedResponse {} // MsgDeposit defines a message to submit a deposit to an existing proposal. message MsgDeposit { option (cosmos.msg.v1.signer) = "depositor"; - option (amino.name) = "atomone/v1/MsgDeposit"; + option (amino.name) = "atomone/v1/MsgDeposit"; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 + [ (gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true ]; + // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string depositor = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // amount to be deposited by depositor. - repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated cosmos.base.v1beta1.Coin amount = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // MsgDepositResponse defines the Msg/Deposit response type. @@ -154,15 +163,17 @@ message MsgDepositResponse {} // Since: cosmos-sdk 0.47 message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "atomone/x/gov/v1/MsgUpdateParams"; + option (amino.name) = "atomone/x/gov/v1/MsgUpdateParams"; - // authority is the address that controls the module (defaults to x/gov unless overwritten). - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // params defines the x/gov parameters to update. // // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // MsgUpdateParamsResponse defines the response structure for executing a diff --git a/proto/atomone/gov/v1beta1/genesis.proto b/proto/atomone/gov/v1beta1/genesis.proto index 59687c53..27f944fb 100644 --- a/proto/atomone/gov/v1beta1/genesis.proto +++ b/proto/atomone/gov/v1beta1/genesis.proto @@ -13,18 +13,30 @@ message GenesisState { // starting_proposal_id is the ID of the starting proposal. uint64 starting_proposal_id = 1; // deposits defines all the deposits present at genesis. - repeated Deposit deposits = 2 - [(gogoproto.castrepeated) = "Deposits", (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Deposit deposits = 2 [ + (gogoproto.castrepeated) = "Deposits", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; // votes defines all the votes present at genesis. - repeated Vote votes = 3 - [(gogoproto.castrepeated) = "Votes", (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Vote votes = 3 [ + (gogoproto.castrepeated) = "Votes", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; // proposals defines all the proposals present at genesis. - repeated Proposal proposals = 4 - [(gogoproto.castrepeated) = "Proposals", (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Proposal proposals = 4 [ + (gogoproto.castrepeated) = "Proposals", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; // params defines all the parameters of related to deposit. - DepositParams deposit_params = 5 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + DepositParams deposit_params = 5 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; // params defines all the parameters of related to voting. - VotingParams voting_params = 6 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + VotingParams voting_params = 6 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; // params defines all the parameters of related to tally. - TallyParams tally_params = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + TallyParams tally_params = 7 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } diff --git a/proto/atomone/gov/v1beta1/gov.proto b/proto/atomone/gov/v1beta1/gov.proto index d355709f..f0923808 100644 --- a/proto/atomone/gov/v1beta1/gov.proto +++ b/proto/atomone/gov/v1beta1/gov.proto @@ -12,37 +12,41 @@ import "amino/amino.proto"; option go_package = "github.com/atomone-hub/atomone/x/gov/types/v1beta1"; option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = false; -option (gogoproto.goproto_getters_all) = false; +option (gogoproto.stringer_all) = false; +option (gogoproto.goproto_getters_all) = false; // VoteOption enumerates the valid vote options for a given governance proposal. enum VoteOption { option (gogoproto.goproto_enum_prefix) = false; // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - VOTE_OPTION_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "OptionEmpty"]; + VOTE_OPTION_UNSPECIFIED = 0 + [ (gogoproto.enumvalue_customname) = "OptionEmpty" ]; // VOTE_OPTION_YES defines a yes vote option. - VOTE_OPTION_YES = 1 [(gogoproto.enumvalue_customname) = "OptionYes"]; + VOTE_OPTION_YES = 1 [ (gogoproto.enumvalue_customname) = "OptionYes" ]; // VOTE_OPTION_ABSTAIN defines an abstain vote option. - VOTE_OPTION_ABSTAIN = 2 [(gogoproto.enumvalue_customname) = "OptionAbstain"]; + VOTE_OPTION_ABSTAIN = 2 + [ (gogoproto.enumvalue_customname) = "OptionAbstain" ]; // VOTE_OPTION_NO defines a no vote option. - VOTE_OPTION_NO = 3 [(gogoproto.enumvalue_customname) = "OptionNo"]; + VOTE_OPTION_NO = 3 [ (gogoproto.enumvalue_customname) = "OptionNo" ]; // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - VOTE_OPTION_NO_WITH_VETO = 4 [(gogoproto.enumvalue_customname) = "OptionNoWithVeto"]; + VOTE_OPTION_NO_WITH_VETO = 4 + [ (gogoproto.enumvalue_customname) = "OptionNoWithVeto" ]; } // WeightedVoteOption defines a unit of vote for vote split. // // Since: cosmos-sdk 0.43 message WeightedVoteOption { - // option defines the valid vote options, it must not contain duplicate vote options. + // option defines the valid vote options, it must not contain duplicate vote + // options. VoteOption option = 1; - // weight is the vote weight associated with the vote option. - string weight = 2 [ - (cosmos_proto.scalar) = "cosmos.Dec", + // weight is the vote weight associated with the vote option. + string weight = 2 [ + (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; } @@ -50,12 +54,12 @@ message WeightedVoteOption { // manually updated in case of approval. message TextProposal { option (cosmos_proto.implements_interface) = "atomone.gov.v1beta1.Content"; - option (amino.name) = "atomone/TextProposal"; + option (amino.name) = "atomone/TextProposal"; option (gogoproto.equal) = true; // title of the proposal. - string title = 1; + string title = 1; // description associated with the proposal. string description = 2; @@ -65,18 +69,18 @@ message TextProposal { // proposal. message Deposit { option (gogoproto.goproto_getters) = false; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; - + uint64 proposal_id = 1; + // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string depositor = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // amount to be deposited by depositor. repeated cosmos.base.v1beta1.Coin amount = 3 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } @@ -86,40 +90,54 @@ message Proposal { option (gogoproto.equal) = true; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; + uint64 proposal_id = 1; // content is the proposal's content. - google.protobuf.Any content = 2 [(cosmos_proto.accepts_interface) = "atomone.gov.v1beta1.Content"]; + google.protobuf.Any content = 2 + [ (cosmos_proto.accepts_interface) = "atomone.gov.v1beta1.Content" ]; // status defines the proposal status. - ProposalStatus status = 3; - + ProposalStatus status = 3; + // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. - TallyResult final_tally_result = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + TallyResult final_tally_result = 4 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; + // submit_time is the time of proposal submission. - google.protobuf.Timestamp submit_time = 5 - [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + google.protobuf.Timestamp submit_time = 5 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + // deposit_end_time is the end time for deposition. - google.protobuf.Timestamp deposit_end_time = 6 - [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + google.protobuf.Timestamp deposit_end_time = 6 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + // total_deposit is the total deposit on the proposal. repeated cosmos.base.v1beta1.Coin total_deposit = 7 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; // voting_start_time is the starting time to vote on a proposal. - google.protobuf.Timestamp voting_start_time = 8 - [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - + google.protobuf.Timestamp voting_start_time = 8 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + // voting_end_time is the end time of voting on a proposal. - google.protobuf.Timestamp voting_end_time = 9 - [(gogoproto.stdtime) = true, (gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + google.protobuf.Timestamp voting_end_time = 9 [ + (gogoproto.stdtime) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; } // ProposalStatus enumerates the valid statuses of a proposal. @@ -127,22 +145,28 @@ enum ProposalStatus { option (gogoproto.goproto_enum_prefix) = false; // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - PROPOSAL_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusNil"]; + PROPOSAL_STATUS_UNSPECIFIED = 0 + [ (gogoproto.enumvalue_customname) = "StatusNil" ]; // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit // period. - PROPOSAL_STATUS_DEPOSIT_PERIOD = 1 [(gogoproto.enumvalue_customname) = "StatusDepositPeriod"]; + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1 + [ (gogoproto.enumvalue_customname) = "StatusDepositPeriod" ]; // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting // period. - PROPOSAL_STATUS_VOTING_PERIOD = 2 [(gogoproto.enumvalue_customname) = "StatusVotingPeriod"]; + PROPOSAL_STATUS_VOTING_PERIOD = 2 + [ (gogoproto.enumvalue_customname) = "StatusVotingPeriod" ]; // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has // passed. - PROPOSAL_STATUS_PASSED = 3 [(gogoproto.enumvalue_customname) = "StatusPassed"]; + PROPOSAL_STATUS_PASSED = 3 + [ (gogoproto.enumvalue_customname) = "StatusPassed" ]; // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has // been rejected. - PROPOSAL_STATUS_REJECTED = 4 [(gogoproto.enumvalue_customname) = "StatusRejected"]; + PROPOSAL_STATUS_REJECTED = 4 + [ (gogoproto.enumvalue_customname) = "StatusRejected" ]; // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has // failed. - PROPOSAL_STATUS_FAILED = 5 [(gogoproto.enumvalue_customname) = "StatusFailed"]; + PROPOSAL_STATUS_FAILED = 5 + [ (gogoproto.enumvalue_customname) = "StatusFailed" ]; } // TallyResult defines a standard tally for a governance proposal. @@ -151,30 +175,30 @@ message TallyResult { // yes is the number of yes votes on a proposal. string yes = 1 [ - (cosmos_proto.scalar) = "cosmos.Int", + (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; // abstain is the number of abstain votes on a proposal. string abstain = 2 [ - (cosmos_proto.scalar) = "cosmos.Int", + (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; // no is the number of no votes on a proposal. string no = 3 [ - (cosmos_proto.scalar) = "cosmos.Int", + (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; // no_with_veto is the number of no with veto votes on a proposal. string no_with_veto = 4 [ - (cosmos_proto.scalar) = "cosmos.Int", + (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", - (gogoproto.nullable) = false + (gogoproto.nullable) = false ]; } @@ -182,47 +206,55 @@ message TallyResult { // A Vote consists of a proposal ID, the voter, and the vote option. message Vote { option (gogoproto.goproto_stringer) = false; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "id", (amino.field_name) = "id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 [ + (gogoproto.jsontag) = "id", + (amino.field_name) = "id", + (amino.dont_omitempty) = true + ]; + // voter is the voter address of the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // Deprecated: Prefer to use `options` instead. This field is set in queries // if and only if `len(options) == 1` and that option has weight 1. In all // other cases, this field will default to VOTE_OPTION_UNSPECIFIED. - VoteOption option = 3 [deprecated = true]; - + VoteOption option = 3 [ deprecated = true ]; + // options is the weighted vote options. // // Since: cosmos-sdk 0.43 - repeated WeightedVoteOption options = 4 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated WeightedVoteOption options = 4 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // DepositParams defines the params for deposits on governance proposals. message DepositParams { // Minimum deposit for a proposal to enter voting period. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", - (gogoproto.jsontag) = "min_deposit,omitempty" + (gogoproto.jsontag) = "min_deposit,omitempty" ]; // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 // months. google.protobuf.Duration max_deposit_period = 2 [ - (gogoproto.nullable) = false, + (gogoproto.nullable) = false, (gogoproto.stdduration) = true, - (gogoproto.jsontag) = "max_deposit_period,omitempty" + (gogoproto.jsontag) = "max_deposit_period,omitempty" ]; } // VotingParams defines the params for voting on governance proposals. message VotingParams { // Duration of the voting period. - google.protobuf.Duration voting_period = 1 - [(gogoproto.nullable) = false, (gogoproto.stdduration) = true, (gogoproto.jsontag) = "voting_period,omitempty"]; + google.protobuf.Duration voting_period = 1 [ + (gogoproto.nullable) = false, + (gogoproto.stdduration) = true, + (gogoproto.jsontag) = "voting_period,omitempty" + ]; } // TallyParams defines the params for tallying votes on governance proposals. @@ -231,22 +263,22 @@ message TallyParams { // considered valid. bytes quorum = 1 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "quorum,omitempty" + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "quorum,omitempty" ]; // Minimum proportion of Yes votes for proposal to pass. Default value: 2/3. bytes threshold = 2 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "threshold,omitempty" + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "threshold,omitempty" ]; // Minimum value of Veto votes to Total votes ratio for proposal to be // vetoed. Default value: 0 (disabled). bytes veto_threshold = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "veto_threshold,omitempty" + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "veto_threshold,omitempty" ]; } diff --git a/proto/atomone/gov/v1beta1/query.proto b/proto/atomone/gov/v1beta1/query.proto index d2a11157..3922ce9d 100644 --- a/proto/atomone/gov/v1beta1/query.proto +++ b/proto/atomone/gov/v1beta1/query.proto @@ -14,7 +14,8 @@ option go_package = "github.com/atomone-hub/atomone/x/gov/types/v1beta1"; service Query { // Proposal queries proposal details based on ProposalID. rpc Proposal(QueryProposalRequest) returns (QueryProposalResponse) { - option (google.api.http).get = "/atomone/gov/v1beta1/proposals/{proposal_id}"; + option (google.api.http).get = + "/atomone/gov/v1beta1/proposals/{proposal_id}"; } // Proposals queries all proposals based on given status. @@ -24,12 +25,14 @@ service Query { // Vote queries voted information based on proposalID, voterAddr. rpc Vote(QueryVoteRequest) returns (QueryVoteResponse) { - option (google.api.http).get = "/atomone/gov/v1beta1/proposals/{proposal_id}/votes/{voter}"; + option (google.api.http).get = + "/atomone/gov/v1beta1/proposals/{proposal_id}/votes/{voter}"; } // Votes queries votes of a given proposal. rpc Votes(QueryVotesRequest) returns (QueryVotesResponse) { - option (google.api.http).get = "/atomone/gov/v1beta1/proposals/{proposal_id}/votes"; + option (google.api.http).get = + "/atomone/gov/v1beta1/proposals/{proposal_id}/votes"; } // Params queries all parameters of the gov module. @@ -39,17 +42,20 @@ service Query { // Deposit queries single deposit information based proposalID, depositAddr. rpc Deposit(QueryDepositRequest) returns (QueryDepositResponse) { - option (google.api.http).get = "/atomone/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}"; + option (google.api.http).get = + "/atomone/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor}"; } // Deposits queries all deposits of a single proposal. rpc Deposits(QueryDepositsRequest) returns (QueryDepositsResponse) { - option (google.api.http).get = "/atomone/gov/v1beta1/proposals/{proposal_id}/deposits"; + option (google.api.http).get = + "/atomone/gov/v1beta1/proposals/{proposal_id}/deposits"; } // TallyResult queries the tally of a proposal vote. rpc TallyResult(QueryTallyResultRequest) returns (QueryTallyResultResponse) { - option (google.api.http).get = "/atomone/gov/v1beta1/proposals/{proposal_id}/tally"; + option (google.api.http).get = + "/atomone/gov/v1beta1/proposals/{proposal_id}/tally"; } } @@ -61,22 +67,23 @@ message QueryProposalRequest { // QueryProposalResponse is the response type for the Query/Proposal RPC method. message QueryProposalResponse { - Proposal proposal = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Proposal proposal = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // QueryProposalsRequest is the request type for the Query/Proposals RPC method. message QueryProposalsRequest { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // proposal_status defines the status of the proposals. ProposalStatus proposal_status = 1; // voter defines the voter address for the proposals. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // depositor defines the deposit addresses from the proposals. - string depositor = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string depositor = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // pagination defines an optional pagination for the request. cosmos.base.query.v1beta1.PageRequest pagination = 4; @@ -86,7 +93,8 @@ message QueryProposalsRequest { // method. message QueryProposalsResponse { // proposals defines all the requested governance proposals. - repeated Proposal proposals = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Proposal proposals = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -94,20 +102,20 @@ message QueryProposalsResponse { // QueryVoteRequest is the request type for the Query/Vote RPC method. message QueryVoteRequest { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; // proposal_id defines the unique id of the proposal. uint64 proposal_id = 1; // voter defines the voter address for the proposals. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // QueryVoteResponse is the response type for the Query/Vote RPC method. message QueryVoteResponse { // vote defines the queried vote. - Vote vote = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Vote vote = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // QueryVotesRequest is the request type for the Query/Votes RPC method. @@ -122,7 +130,8 @@ message QueryVotesRequest { // QueryVotesResponse is the response type for the Query/Votes RPC method. message QueryVotesResponse { // votes defines the queried votes. - repeated Vote votes = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Vote votes = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -138,29 +147,33 @@ message QueryParamsRequest { // QueryParamsResponse is the response type for the Query/Params RPC method. message QueryParamsResponse { // voting_params defines the parameters related to voting. - VotingParams voting_params = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + VotingParams voting_params = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; // deposit_params defines the parameters related to deposit. - DepositParams deposit_params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + DepositParams deposit_params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; // tally_params defines the parameters related to tally. - TallyParams tally_params = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + TallyParams tally_params = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // QueryDepositRequest is the request type for the Query/Deposit RPC method. message QueryDepositRequest { option (gogoproto.goproto_getters) = false; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; // proposal_id defines the unique id of the proposal. uint64 proposal_id = 1; // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string depositor = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // QueryDepositResponse is the response type for the Query/Deposit RPC method. message QueryDepositResponse { // deposit defines the requested deposit. - Deposit deposit = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Deposit deposit = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // QueryDepositsRequest is the request type for the Query/Deposits RPC method. @@ -175,7 +188,8 @@ message QueryDepositsRequest { // QueryDepositsResponse is the response type for the Query/Deposits RPC method. message QueryDepositsResponse { // deposits defines the requested deposits. - repeated Deposit deposits = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + repeated Deposit deposits = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; // pagination defines the pagination in the response. cosmos.base.query.v1beta1.PageResponse pagination = 2; @@ -190,5 +204,6 @@ message QueryTallyResultRequest { // QueryTallyResultResponse is the response type for the Query/Tally RPC method. message QueryTallyResultResponse { // tally defines the requested tally. - TallyResult tally = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + TallyResult tally = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } diff --git a/proto/atomone/gov/v1beta1/tx.proto b/proto/atomone/gov/v1beta1/tx.proto index 138f721b..97e4f7f9 100644 --- a/proto/atomone/gov/v1beta1/tx.proto +++ b/proto/atomone/gov/v1beta1/tx.proto @@ -21,7 +21,8 @@ service Msg { // Vote defines a method to add a vote on a specific proposal. rpc Vote(MsgVote) returns (MsgVoteResponse); - // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // VoteWeighted defines a method to add a weighted vote on a specific + // proposal. // // Since: cosmos-sdk 0.43 rpc VoteWeighted(MsgVoteWeighted) returns (MsgVoteWeightedResponse); @@ -34,50 +35,53 @@ service Msg { // proposal Content. message MsgSubmitProposal { option (cosmos.msg.v1.signer) = "proposer"; - option (amino.name) = "atomone/MsgSubmitProposal"; + option (amino.name) = "atomone/MsgSubmitProposal"; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; // content is the proposal's content. - google.protobuf.Any content = 1 [(cosmos_proto.accepts_interface) = "atomone.gov.v1beta1.Content"]; - // initial_deposit is the deposit value that must be paid at proposal submission. + google.protobuf.Any content = 1 + [ (cosmos_proto.accepts_interface) = "atomone.gov.v1beta1.Content" ]; + // initial_deposit is the deposit value that must be paid at proposal + // submission. repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; // proposer is the account address of the proposer. - string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string proposer = 3 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; } // MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. message MsgSubmitProposalResponse { // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + uint64 proposal_id = 1 + [ (gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true ]; } // MsgVote defines a message to cast a vote. message MsgVote { option (cosmos.msg.v1.signer) = "voter"; - option (amino.name) = "atomone/MsgVote"; + option (amino.name) = "atomone/MsgVote"; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; + uint64 proposal_id = 1; // voter is the voter address for the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // option defines the vote option. - VoteOption option = 3; + VoteOption option = 3; } // MsgVoteResponse defines the Msg/Vote response type. @@ -88,21 +92,23 @@ message MsgVoteResponse {} // Since: cosmos-sdk 0.43 message MsgVoteWeighted { option (cosmos.msg.v1.signer) = "voter"; - option (amino.name) = "atomone/MsgVoteWeighted"; + option (amino.name) = "atomone/MsgVoteWeighted"; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + uint64 proposal_id = 1 + [ (gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true ]; // voter is the voter address for the proposal. - string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // options defines the weighted vote options. - repeated WeightedVoteOption options = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + string voter = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + + // options defines the weighted vote options. + repeated WeightedVoteOption options = 3 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. @@ -113,23 +119,24 @@ message MsgVoteWeightedResponse {} // MsgDeposit defines a message to submit a deposit to an existing proposal. message MsgDeposit { option (cosmos.msg.v1.signer) = "depositor"; - option (amino.name) = "atomone/MsgDeposit"; + option (amino.name) = "atomone/MsgDeposit"; - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.stringer) = false; + option (gogoproto.goproto_getters) = false; // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - + uint64 proposal_id = 1 + [ (gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true ]; + // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - + string depositor = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // amount to be deposited by depositor. repeated cosmos.base.v1beta1.Coin amount = 3 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } diff --git a/tests/e2e/genesis.go b/tests/e2e/genesis.go index d876f8d9..e7dfcb1a 100644 --- a/tests/e2e/genesis.go +++ b/tests/e2e/genesis.go @@ -134,7 +134,7 @@ func modifyGenesis(path, moniker, amountStr string, addrAll []sdk.AccAddress, de votingPeriod, quorum.String(), threshold.String(), sdk.ZeroDec().String(), - false, false, + false, false, govv1.DefaultMinDepositRatio.String(), ), ) govGenStateBz, err := cdc.MarshalJSON(govGenState) diff --git a/x/gov/abci_test.go b/x/gov/abci_test.go index fd740141..4a54262c 100644 --- a/x/gov/abci_test.go +++ b/x/gov/abci_test.go @@ -42,7 +42,7 @@ func TestTickExpiredDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, addrs[0].String(), "", "Proposal", @@ -98,7 +98,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, addrs[0].String(), "", "Proposal", @@ -124,7 +124,7 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) { newProposalMsg2, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, addrs[0].String(), "", "Proposal", @@ -185,7 +185,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { newProposalMsg, err := v1.NewMsgSubmitProposal( []sdk.Msg{mkTestLegacyContent(t)}, - sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}, + sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}, addrs[0].String(), "", "Proposal", @@ -211,7 +211,7 @@ func TestTickPassedDepositPeriod(t *testing.T) { require.False(t, inactiveQueue.Valid()) inactiveQueue.Close() - newDepositMsg := v1.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 5)}) + newDepositMsg := v1.NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin(sdk.DefaultBondDenom, 100000)}) res1, err := govMsgSvr.Deposit(sdk.WrapSDKContext(ctx), newDepositMsg) require.NoError(t, err) diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index cdaa532c..450487b3 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -2,10 +2,12 @@ package keeper import ( "fmt" + "strings" sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors1 "github.com/cosmos/cosmos-sdk/types/errors" "github.com/atomone-hub/atomone/x/gov/types" v1 "github.com/atomone-hub/atomone/x/gov/types/v1" @@ -120,8 +122,50 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd return false, sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID) } + // Check coins to be deposited match the proposal's deposit params + params := keeper.GetParams(ctx) + + // NOTE: backported from v50 + // v47 does not have expedited proposals so we always use params.MinDeposit + minDepositAmount := params.MinDeposit + minDepositRatio, err := sdk.NewDecFromStr(params.GetMinDepositRatio()) + if err != nil { + return false, err + } + + // If minDepositRatio is set, the deposit must be equal or greater than minDepositAmount*minDepositRatio + // for at least one denom. If minDepositRatio is zero we skip this check. + if !minDepositRatio.IsZero() { + var ( + depositThresholdMet bool + thresholds []string + ) + for _, minDep := range minDepositAmount { + // calculate the threshold for this denom, and hold a list to later return a useful error message + threshold := sdk.NewCoin(minDep.GetDenom(), minDep.Amount.ToLegacyDec().Mul(minDepositRatio).TruncateInt()) + thresholds = append(thresholds, threshold.String()) + + found, deposit := depositAmount.Find(minDep.Denom) + if !found { // if not found, continue, as we know the deposit contains at least 1 valid denom + continue + } + + // Once we know at least one threshold has been met, we can break. The deposit + // might contain other denoms but we don't care. + if deposit.IsGTE(threshold) { + depositThresholdMet = true + break + } + } + + // the threshold must be met with at least one denom, if not, return the list of minimum deposits + if !depositThresholdMet { + return false, sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "received %s but need at least one of the following: %s", depositAmount, strings.Join(thresholds, ",")) + } + } + // update the governance module's account coins pool - err := keeper.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, types.ModuleName, depositAmount) + err = keeper.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, types.ModuleName, depositAmount) if err != nil { return false, err } @@ -185,6 +229,10 @@ func (keeper Keeper) RefundAndDeleteDeposits(ctx sdk.Context, proposalID uint64) // 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 { + if !initialDeposit.IsValid() || initialDeposit.IsAnyNegative() { + return sdkerrors.Wrapf(sdkerrors1.ErrInvalidCoins, initialDeposit.String()) + } + params := keeper.GetParams(ctx) minInitialDepositRatio, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) if err != nil { diff --git a/x/gov/keeper/deposit_test.go b/x/gov/keeper/deposit_test.go index dfdc54f8..25e578d2 100644 --- a/x/gov/keeper/deposit_test.go +++ b/x/gov/keeper/deposit_test.go @@ -213,3 +213,82 @@ func TestValidateInitialDeposit(t *testing.T) { }) } } + +func TestDepositAmount(t *testing.T) { + testcases := []struct { + name string + deposit sdk.Coins + minDepositRatio string + err string + }{ + { + name: "good amount and denoms", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000)), + minDepositRatio: "0.001", + }, + { + name: "good amount and denoms but not enough balance for zcoin", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("zcoin", 1)), + minDepositRatio: "0.001", + err: "not enough balance", + }, + { + name: "too small amount", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10)), + minDepositRatio: "0.001", + err: "received 10stake but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", + }, + { + name: "too small amount with another coin", + deposit: sdk.NewCoins(sdk.NewInt64Coin("zcoin", 1)), + minDepositRatio: "0.001", + err: "received 1zcoin but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", + }, + { + name: "bad denom", + deposit: sdk.NewCoins(sdk.NewInt64Coin("euro", 10000)), + minDepositRatio: "0.001", + err: "received 10000euro but need at least one of the following: 10000stake,10zcoin: minimum deposit is too small", + }, + { + name: "mix containing bad and good denom", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10000), sdk.NewInt64Coin("euro", 10000)), + minDepositRatio: "0.001", + err: "not enough balance", + }, + { + name: "minDepositRatio is zero", + deposit: sdk.NewCoins(sdk.NewInt64Coin("stake", 10)), + minDepositRatio: "0.0", + }, + } + + for _, tc := range testcases { + t.Run(tc.name, func(t *testing.T) { + govKeeper, mocks, _, ctx := setupGovKeeper(t) + bankKeeper, stakingKeeper := mocks.bankKeeper, mocks.stakingKeeper + trackMockBalances(bankKeeper) + + testAddrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(1000000000000000)) + + params := v1.DefaultParams() + params.MinDepositRatio = tc.minDepositRatio + params.MinDeposit = sdk.NewCoins(params.MinDeposit...).Add(sdk.NewCoin("zcoin", sdk.NewInt(10000))) // coins must be sorted by denom + err := govKeeper.SetParams(ctx, params) + require.NoError(t, err) + + tp := TestProposal + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "summary", testAddrs[0]) + require.NoError(t, err) + proposalID := proposal.Id + + _, err = govKeeper.AddDeposit(ctx, proposalID, testAddrs[0], tc.deposit) + if tc.err != "" { + require.Error(t, err) + require.Equal(t, tc.err, err.Error()) + } else { + require.NoError(t, err) + } + }) + } +} diff --git a/x/gov/keeper/msg_server.go b/x/gov/keeper/msg_server.go index a6f43c81..e3e6f28a 100644 --- a/x/gov/keeper/msg_server.go +++ b/x/gov/keeper/msg_server.go @@ -7,6 +7,7 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors1 "github.com/cosmos/cosmos-sdk/types/errors" govtypes "github.com/atomone-hub/atomone/x/gov/types" v1 "github.com/atomone-hub/atomone/x/gov/types/v1" @@ -143,6 +144,11 @@ func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDe if err != nil { return nil, err } + + if err := validateDeposit(msg.Amount); err != nil { + return nil, err + } + votingStarted, err := k.Keeper.AddDeposit(ctx, msg.ProposalId, accAddr, msg.Amount) if err != nil { return nil, err @@ -160,6 +166,15 @@ func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDe return &v1.MsgDepositResponse{}, nil } +// validateDeposit validates the deposit amount, do not use for initial deposit. +func validateDeposit(amount sdk.Coins) error { + if !amount.IsValid() || !amount.IsAllPositive() { + return sdkerrors1.ErrInvalidCoins.Wrap(amount.String()) + } + + return nil +} + // UpdateParams implements the MsgServer.UpdateParams method. func (k msgServer) UpdateParams(goCtx context.Context, msg *v1.MsgUpdateParams) (*v1.MsgUpdateParamsResponse, error) { if k.authority != msg.Authority { diff --git a/x/gov/keeper/msg_server_test.go b/x/gov/keeper/msg_server_test.go index 4010b8b7..6dc5f289 100644 --- a/x/gov/keeper/msg_server_test.go +++ b/x/gov/keeper/msg_server_test.go @@ -20,7 +20,7 @@ func (suite *KeeperTestSuite) TestSubmitProposalReq() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) initialDeposit := coins minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit bankMsg := &banktypes.MsgSend{ @@ -140,7 +140,7 @@ func (suite *KeeperTestSuite) TestVoteReq() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), @@ -259,7 +259,7 @@ func (suite *KeeperTestSuite) TestVoteWeightedReq() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), @@ -378,8 +378,8 @@ func (suite *KeeperTestSuite) TestDepositReq() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) - minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) + minDeposit := sdk.Coins(suite.govKeeper.GetParams(suite.ctx).MinDeposit) bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), ToAddress: proposer.String(), @@ -427,6 +427,14 @@ func (suite *KeeperTestSuite) TestDepositReq() { expErr: false, options: v1.NewNonSplitVoteOption(v1.OptionYes), }, + "invalid deposited coin ": { + preRun: func() uint64 { + return pId + }, + depositor: proposer, + deposit: minDeposit.Add(sdk.NewCoin("ibc/badcoin", sdk.NewInt(1000))), expErr: true, + options: v1.NewNonSplitVoteOption(v1.OptionYes), + }, } for name, tc := range cases { @@ -448,7 +456,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgSubmitProposal() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) initialDeposit := coins minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit @@ -498,7 +506,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgVote() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), @@ -607,7 +615,7 @@ func (suite *KeeperTestSuite) TestLegacyVoteWeighted() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), @@ -716,7 +724,7 @@ func (suite *KeeperTestSuite) TestLegacyMsgDeposit() { addrs := suite.addrs proposer := addrs[0] - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100))) + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) minDeposit := suite.govKeeper.GetParams(suite.ctx).MinDeposit bankMsg := &banktypes.MsgSend{ FromAddress: govAcct.String(), diff --git a/x/gov/simulation/genesis.go b/x/gov/simulation/genesis.go index 2cc793dd..7b16b031 100644 --- a/x/gov/simulation/genesis.go +++ b/x/gov/simulation/genesis.go @@ -27,6 +27,9 @@ const ( TallyParamsQuorum = "tally_params_quorum" TallyParamsThreshold = "tally_params_threshold" TallyParamsVeto = "tally_params_veto" + + // NOTE: backport from v50 + MinDepositRatio = "min_deposit_ratio" ) // GenDepositParamsDepositPeriod returns randomized DepositParamsDepositPeriod @@ -59,6 +62,11 @@ func GenTallyParamsThreshold(r *rand.Rand) math.LegacyDec { return sdk.NewDecWithPrec(int64(simulation.RandIntBetween(r, 550, 700)), 3) } +// GenMinDepositRatio returns randomized DepositMinRatio +func GenMinDepositRatio(r *rand.Rand) math.LegacyDec { + return math.LegacyMustNewDecFromStr("0.01") +} + // RandomizedGenState generates a random GenesisState for gov func RandomizedGenState(simState *module.SimulationState) { startingProposalID := uint64(simState.Rand.Intn(100)) @@ -99,9 +107,12 @@ func RandomizedGenState(simState *module.SimulationState) { func(r *rand.Rand) { threshold = GenTallyParamsThreshold(r) }, ) + var minDepositRatio math.LegacyDec + simState.AppParams.GetOrGenerate(simState.Cdc, MinDepositRatio, &minDepositRatio, simState.Rand, func(r *rand.Rand) { minDepositRatio = GenMinDepositRatio(r) }) + govGenesis := v1.NewGenesisState( startingProposalID, - v1.NewParams(minDeposit, depositPeriod, votingPeriod, quorum.String(), threshold.String(), minInitialDepositRatio.String(), simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0), + v1.NewParams(minDeposit, depositPeriod, votingPeriod, quorum.String(), threshold.String(), minInitialDepositRatio.String(), simState.Rand.Intn(2) == 0, simState.Rand.Intn(2) == 0, minDepositRatio.String()), ) bz, err := json.MarshalIndent(&govGenesis, "", " ") diff --git a/x/gov/simulation/operations.go b/x/gov/simulation/operations.go index 91990efa..bce8b8fe 100644 --- a/x/gov/simulation/operations.go +++ b/x/gov/simulation/operations.go @@ -452,6 +452,13 @@ func randomDeposit( minDepositAmount := minDeposit[denomIndex].Amount + minDepositRatio, err := sdk.NewDecFromStr(params.GetMinDepositRatio()) + if err != nil { + return nil, false, err + } + + threshold := minDepositAmount.ToLegacyDec().Mul(minDepositRatio).TruncateInt() + minAmount := sdk.ZeroInt() if useMinAmount { minDepositPercent, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) @@ -468,7 +475,10 @@ func randomDeposit( } amount = amount.Add(minAmount) - if amount.GT(spendableBalance) { + // NOTE: backport from v50 + amount = amount.MulRaw(3) // 3x what's required // TODO: this is a hack, we need to be able to calculate the correct amount using params + + if amount.GT(spendableBalance) || amount.LT(threshold) { return nil, true, nil } diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index a0000f33..7a487789 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -155,7 +155,7 @@ func TestSimulateMsgSubmitProposal(t *testing.T) { require.True(t, operationMsg.OK) require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Proposer) require.NotEqual(t, len(msg.InitialDeposit), 0) - require.Equal(t, "560969stake", msg.InitialDeposit[0].String()) + require.Equal(t, "1682907stake", msg.InitialDeposit[0].String()) require.Equal(t, simulation.TypeMsgSubmitProposal, sdk.MsgTypeURL(&msg)) } @@ -185,7 +185,7 @@ func TestSimulateMsgSubmitLegacyProposal(t *testing.T) { require.True(t, operationMsg.OK) require.Equal(t, "cosmos1p8wcgrjr4pjju90xg6u9cgq55dxwq8j7u4x9a0", msg.Proposer) require.NotEqual(t, len(msg.InitialDeposit), 0) - require.Equal(t, "2686011stake", msg.InitialDeposit[0].String()) + require.Equal(t, "8058033stake", msg.InitialDeposit[0].String()) require.Equal(t, "title-3: ZBSpYuLyYggwexjxusrBqDOTtGTOWeLrQKjLxzIivHSlcxgdXhhuTSkuxKGLwQvuyNhYFmBZHeAerqyNEUzXPFGkqEGqiQWIXnku", msg.Messages[0].GetCachedValue().(*v1.MsgExecLegacyContent).Content.GetCachedValue().(v1beta1.Content).GetTitle()) require.Equal(t, "description-3: NJWzHdBNpAXKJPHWQdrGYcAHSctgVlqwqHoLfHsXUdStwfefwzqLuKEhmMyYLdbZrcPgYqjNHxPexsruwEGStAneKbWkQDDIlCWBLSiAASNhZqNFlPtfqPJoxKsgMdzjWqLWdqKQuJqWPMvwPQWZUtVMOTMYKJbfdlZsjdsomuScvDmbDkgRualsxDvRJuCAmPOXitIbcyWsKGSdrEunFAOdmXnsuyFVgJqEjbklvmwrUlsxjRSfKZxGcpayDdgoFcnVSutxjRgOSFzPwidAjubMncNweqpbxhXGchpZUxuFDOtpnhNUycJICRYqsPhPSCjPTWZFLkstHWJxvdPEAyEIxXgLwbNOjrgzmaujiBABBIXvcXpLrbcEWNNQsbjvgJFgJkflpRohHUutvnaUqoopuKjTDaemDeSdqbnOzcfJpcTuAQtZoiLZOoAIlboFDAeGmSNwkvObPRvRWQgWkGkxwtPauY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rWbaoLTVpQoottZyPFfNOoMioXHRuFwMRYUiKvcWPkrayyTLOCFJlAyslDameIuqVAuxErqFPEWIScKpBORIuZqoXlZuTvAjEdlEWDODFRregDTqGNoFBIHxvimmIZwLfFyKUfEWAnNBdtdzDmTPXtpHRGdIbuucfTjOygZsTxPjfweXhSUkMhPjMaxKlMIJMOXcnQfyzeOcbWwNbeH", msg.Messages[0].GetCachedValue().(*v1.MsgExecLegacyContent).Content.GetCachedValue().(v1beta1.Content).GetDescription()) require.Equal(t, "gov", msg.Route()) @@ -234,7 +234,7 @@ func TestSimulateMsgDeposit(t *testing.T) { require.Equal(t, uint64(1), msg.ProposalId) require.Equal(t, "cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r", msg.Depositor) require.NotEqual(t, len(msg.Amount), 0) - require.Equal(t, "560969stake", msg.Amount[0].String()) + require.Equal(t, "1682907stake", msg.Amount[0].String()) require.Equal(t, "gov", msg.Route()) require.Equal(t, simulation.TypeMsgDeposit, msg.Type()) } diff --git a/x/gov/types/v1/genesis.pb.go b/x/gov/types/v1/genesis.pb.go index 661c9bc5..3e6dc87b 100644 --- a/x/gov/types/v1/genesis.pb.go +++ b/x/gov/types/v1/genesis.pb.go @@ -46,9 +46,6 @@ type GenesisState struct { // Since: cosmos-sdk 0.47 Params *Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params,omitempty"` // The constitution allows builders to lay a foundation and define purpose. - // This is an immutable string set in genesis. - // There are no amendments, to go outside of scope, just fork. - // constitution is an immutable string in genesis for a chain builder to lay out their vision, ideas and ideals. // // Since: cosmos-sdk 0.48 Constitution string `protobuf:"bytes,9,opt,name=constitution,proto3" json:"constitution,omitempty"` diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index 737ff57e..ca88d4ad 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -119,7 +119,8 @@ func (ProposalStatus) EnumDescriptor() ([]byte, []int) { // WeightedVoteOption defines a unit of vote for vote split. type WeightedVoteOption struct { - // option defines the valid vote options, it must not contain duplicate vote options. + // option defines the valid vote options, it must not contain duplicate vote + // options. Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=atomone.gov.v1.VoteOption" json:"option,omitempty"` // weight is the vote weight associated with the vote option. Weight string `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` @@ -707,7 +708,7 @@ type Params struct { // Duration of the voting period. VotingPeriod *time.Duration `protobuf:"bytes,3,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` // Minimum percentage of total stake needed to vote for a result to be - // considered valid. + // considered valid. Default value: 0.25. Quorum string `protobuf:"bytes,4,opt,name=quorum,proto3" json:"quorum,omitempty"` // Minimum proportion of Yes votes for proposal to pass. Default value: 2/3. Threshold string `protobuf:"bytes,5,opt,name=threshold,proto3" json:"threshold,omitempty"` @@ -717,6 +718,16 @@ type Params struct { BurnVoteQuorum bool `protobuf:"varint,13,opt,name=burn_vote_quorum,json=burnVoteQuorum,proto3" json:"burn_vote_quorum,omitempty"` // burn deposits if the proposal does not enter voting period BurnProposalDepositPrevote bool `protobuf:"varint,14,opt,name=burn_proposal_deposit_prevote,json=burnProposalDepositPrevote,proto3" json:"burn_proposal_deposit_prevote,omitempty"` + // burn deposits if quorum with vote type no_veto is met + BurnVoteVeto bool `protobuf:"varint,15,opt,name=burn_vote_veto,json=burnVoteVeto,proto3" json:"burn_vote_veto,omitempty"` + // The ratio representing the proportion of the deposit value minimum that + // must be met when making a deposit. Default value: 0.01. Meaning that for a + // chain with a min_deposit of 100stake, a deposit of 1stake would be + // required. + // + // Since: cosmos-sdk 0.50 + // NOTE: backported from v50 (https://github.com/cosmos/cosmos-sdk/pull/18146) + MinDepositRatio string `protobuf:"bytes,16,opt,name=min_deposit_ratio,json=minDepositRatio,proto3" json:"min_deposit_ratio,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -808,6 +819,20 @@ func (m *Params) GetBurnProposalDepositPrevote() bool { return false } +func (m *Params) GetBurnVoteVeto() bool { + if m != nil { + return m.BurnVoteVeto + } + return false +} + +func (m *Params) GetMinDepositRatio() string { + if m != nil { + return m.MinDepositRatio + } + return "" +} + func init() { proto.RegisterEnum("atomone.gov.v1.VoteOption", VoteOption_name, VoteOption_value) proto.RegisterEnum("atomone.gov.v1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) @@ -825,83 +850,85 @@ func init() { func init() { proto.RegisterFile("atomone/gov/v1/gov.proto", fileDescriptor_ecf0f9950ff6986c) } var fileDescriptor_ecf0f9950ff6986c = []byte{ - // 1208 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x6f, 0x13, 0xc7, - 0x17, 0xcf, 0xfa, 0x57, 0x9c, 0xe7, 0xc4, 0x2c, 0x43, 0xbe, 0xb0, 0x31, 0x60, 0xe7, 0x6b, 0x55, - 0x28, 0xa5, 0xc4, 0x6e, 0x42, 0xc5, 0x89, 0x8b, 0x13, 0x2f, 0x74, 0x11, 0x8d, 0xdd, 0xb5, 0x49, - 0x45, 0x2f, 0xab, 0x71, 0x76, 0x70, 0x46, 0xf5, 0xee, 0xb8, 0x3b, 0xe3, 0x14, 0xff, 0x17, 0x1c, - 0xab, 0x9e, 0x7a, 0xec, 0xb1, 0x07, 0xa4, 0xfe, 0x01, 0xbd, 0x70, 0xaa, 0x10, 0xa7, 0xf6, 0x42, - 0x2b, 0x38, 0x54, 0xe2, 0xd8, 0xbf, 0xa0, 0x9a, 0xd9, 0x59, 0xc7, 0x71, 0x52, 0x39, 0x70, 0x49, - 0x76, 0xde, 0xfb, 0x7c, 0xde, 0x7b, 0xf3, 0xe6, 0xf3, 0x66, 0x0c, 0x16, 0x16, 0x2c, 0x60, 0x21, - 0xa9, 0xf7, 0xd9, 0x51, 0xfd, 0x68, 0x4b, 0xfe, 0xab, 0x0d, 0x23, 0x26,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0x82, 0xe2, 0xb4, 0x63, 0xaf, - 0x65, 0xa6, 0x6f, 0xfe, 0x66, 0x40, 0xf1, 0xe4, 0x4b, 0x8d, 0x2a, 0x70, 0xb5, 0xed, 0xb6, 0xda, - 0xad, 0x4e, 0xe3, 0xa1, 0xd7, 0xe9, 0x36, 0xba, 0x8f, 0x3a, 0x33, 0x59, 0xab, 0x50, 0x9e, 0x05, - 0x34, 0xed, 0x76, 0xab, 0xe3, 0x74, 0xbd, 0xb6, 0xed, 0x3a, 0xad, 0xa6, 0x69, 0xa0, 0xff, 0xc3, - 0xf5, 0x59, 0xcc, 0x7e, 0xab, 0xeb, 0xec, 0xdd, 0x4f, 0x20, 0x29, 0x54, 0x82, 0xcb, 0xb3, 0x90, - 0x76, 0xa3, 0xd3, 0xb1, 0x9b, 0x66, 0x1a, 0x5d, 0x03, 0x6b, 0xd6, 0xe7, 0xda, 0x0f, 0xec, 0xdd, - 0xae, 0xdd, 0x34, 0x33, 0x67, 0x31, 0xef, 0x35, 0x9c, 0x87, 0x76, 0xd3, 0xcc, 0xee, 0xdc, 0x7f, - 0xf1, 0xa6, 0x6c, 0xbc, 0x7c, 0x53, 0x36, 0xfe, 0x7a, 0x53, 0x36, 0x9e, 0xbd, 0x2d, 0x2f, 0xbc, - 0x7c, 0x5b, 0x5e, 0xf8, 0xfd, 0x6d, 0x79, 0xe1, 0xeb, 0xcd, 0x3e, 0x15, 0x87, 0xa3, 0x5e, 0xed, - 0x80, 0x05, 0x75, 0x7d, 0x79, 0x6e, 0x1e, 0x8e, 0x7a, 0xc9, 0x77, 0xfd, 0xa9, 0xfa, 0x61, 0x2c, - 0xc6, 0x43, 0xc2, 0xe5, 0x8f, 0xde, 0x9c, 0xd2, 0xee, 0xed, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0xec, 0xba, 0x74, 0x03, 0x37, 0x0b, 0x00, 0x00, + // 1242 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcf, 0x6e, 0xdb, 0xc6, + 0x13, 0x36, 0xf5, 0xcf, 0xf2, 0xc8, 0x96, 0x99, 0x8d, 0x7f, 0x09, 0xad, 0x24, 0x92, 0x7f, 0x42, + 0x10, 0xb8, 0x69, 0x2c, 0xd5, 0x4e, 0x91, 0x43, 0x91, 0x8b, 0x6c, 0x31, 0x29, 0x83, 0xd4, 0x52, + 0x29, 0xc5, 0x45, 0x7a, 0x21, 0x56, 0xe6, 0x46, 0x26, 0x2a, 0x72, 0x55, 0xee, 0x4a, 0x8d, 0xde, + 0x22, 0xc7, 0xa2, 0xa7, 0x1e, 0x7b, 0xec, 0x21, 0x40, 0x1f, 0xa0, 0x97, 0x9c, 0x8a, 0x20, 0xe8, + 0xa1, 0xbd, 0xa4, 0x45, 0x72, 0x28, 0x90, 0xa7, 0x28, 0x76, 0xb9, 0x94, 0x64, 0x59, 0x85, 0x9c, + 0x5c, 0x24, 0xee, 0xcc, 0xf7, 0xcd, 0xec, 0xcc, 0x7e, 0xb3, 0x24, 0x18, 0x98, 0x53, 0x9f, 0x06, + 0xa4, 0xda, 0xa5, 0xc3, 0xea, 0x70, 0x57, 0xfc, 0x55, 0xfa, 0x21, 0xe5, 0x14, 0xe5, 0x95, 0xa7, + 0x22, 0x4c, 0xc3, 0xdd, 0x42, 0xf1, 0x98, 0x32, 0x9f, 0xb2, 0x6a, 0x07, 0x33, 0x52, 0x1d, 0xee, + 0x76, 0x08, 0xc7, 0xbb, 0xd5, 0x63, 0xea, 0x05, 0x11, 0xbe, 0xb0, 0xd1, 0xa5, 0x5d, 0x2a, 0x1f, + 0xab, 0xe2, 0x49, 0x59, 0x4b, 0x5d, 0x4a, 0xbb, 0x3d, 0x52, 0x95, 0xab, 0xce, 0xe0, 0x49, 0x95, + 0x7b, 0x3e, 0x61, 0x1c, 0xfb, 0x7d, 0x05, 0xd8, 0x9c, 0x05, 0xe0, 0x60, 0xa4, 0x5c, 0xc5, 0x59, + 0x97, 0x3b, 0x08, 0x31, 0xf7, 0x68, 0x9c, 0x71, 0x33, 0xda, 0x91, 0x13, 0x25, 0x8d, 0x16, 0xca, + 0x75, 0x01, 0xfb, 0x5e, 0x40, 0xab, 0xf2, 0x37, 0x32, 0x95, 0xfb, 0x80, 0xbe, 0x22, 0x5e, 0xf7, + 0x84, 0x13, 0xf7, 0x88, 0x72, 0xd2, 0xe8, 0x8b, 0x48, 0x68, 0x0f, 0x32, 0x54, 0x3e, 0x19, 0xda, + 0x96, 0xb6, 0x9d, 0xdf, 0x2b, 0x54, 0x4e, 0x97, 0x5d, 0x99, 0x60, 0x6d, 0x85, 0x44, 0x37, 0x20, + 0xf3, 0x9d, 0x8c, 0x64, 0x24, 0xb6, 0xb4, 0xed, 0x95, 0xfd, 0xfc, 0xab, 0xe7, 0x3b, 0xa0, 0xd2, + 0xd7, 0xc9, 0xb1, 0xad, 0xbc, 0xe5, 0x1f, 0x35, 0x58, 0xae, 0x93, 0x3e, 0x65, 0x1e, 0x47, 0x25, + 0xc8, 0xf5, 0x43, 0xda, 0xa7, 0x0c, 0xf7, 0x1c, 0xcf, 0x95, 0xc9, 0x52, 0x36, 0xc4, 0x26, 0xcb, + 0x45, 0x77, 0x60, 0xc5, 0x8d, 0xb0, 0x34, 0x54, 0x71, 0x8d, 0x57, 0xcf, 0x77, 0x36, 0x54, 0xdc, + 0x9a, 0xeb, 0x86, 0x84, 0xb1, 0x16, 0x0f, 0xbd, 0xa0, 0x6b, 0x4f, 0xa0, 0xe8, 0x2e, 0x64, 0xb0, + 0x4f, 0x07, 0x01, 0x37, 0x92, 0x5b, 0xc9, 0xed, 0xdc, 0xde, 0x66, 0x45, 0x31, 0xc4, 0x39, 0x55, + 0xd4, 0x39, 0x55, 0x0e, 0xa8, 0x17, 0xec, 0xaf, 0xbc, 0x78, 0x5d, 0x5a, 0xfa, 0xe9, 0x9f, 0x9f, + 0x6f, 0x6a, 0xb6, 0xe2, 0x94, 0x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 0xcd, 0x64, 0x2d, 0x43, + 0x71, 0x16, 0x50, 0x37, 0x9b, 0x8d, 0x96, 0xd5, 0x76, 0x9a, 0xa6, 0x6d, 0x35, 0xea, 0xba, 0x86, + 0xfe, 0x0f, 0xd7, 0x66, 0x31, 0x47, 0x8d, 0xb6, 0x75, 0x78, 0x3f, 0x86, 0x24, 0x50, 0x01, 0x2e, + 0xcd, 0x42, 0x9a, 0xb5, 0x56, 0xcb, 0xac, 0xeb, 0x49, 0x74, 0x15, 0x8c, 0x59, 0x9f, 0x6d, 0x3e, + 0x30, 0x0f, 0xda, 0x66, 0x5d, 0x4f, 0xcd, 0x63, 0xde, 0xab, 0x59, 0x0f, 0xcd, 0xba, 0x9e, 0xde, + 0xbf, 0xff, 0xe2, 0x4d, 0x51, 0x7b, 0xf9, 0xa6, 0xa8, 0xfd, 0xfd, 0xa6, 0xa8, 0x3d, 0x7b, 0x5b, + 0x5c, 0x7a, 0xf9, 0xb6, 0xb8, 0xf4, 0xc7, 0xdb, 0xe2, 0xd2, 0xd7, 0x3b, 0x5d, 0x8f, 0x9f, 0x0c, + 0x3a, 0x95, 0x63, 0xea, 0x57, 0xd5, 0xf5, 0xbc, 0x73, 0x32, 0xe8, 0xc4, 0xcf, 0xd5, 0xa7, 0xf2, + 0xd3, 0x9b, 0x8f, 0xfa, 0x84, 0x89, 0xcf, 0xea, 0x8c, 0x9c, 0x8e, 0xdb, 0xff, 0x06, 0x00, 0x00, + 0xff, 0xff, 0xdf, 0x70, 0xb9, 0x59, 0x99, 0x0b, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { @@ -1366,6 +1393,25 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.MinDepositRatio) > 0 { + i -= len(m.MinDepositRatio) + copy(dAtA[i:], m.MinDepositRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinDepositRatio))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + if m.BurnVoteVeto { + i-- + if m.BurnVoteVeto { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x78 + } if m.BurnProposalDepositPrevote { i-- if m.BurnProposalDepositPrevote { @@ -1690,6 +1736,13 @@ func (m *Params) Size() (n int) { if m.BurnProposalDepositPrevote { n += 2 } + if m.BurnVoteVeto { + n += 2 + } + l = len(m.MinDepositRatio) + if l > 0 { + n += 2 + l + sovGov(uint64(l)) + } return n } @@ -3303,6 +3356,58 @@ func (m *Params) Unmarshal(dAtA []byte) error { } } m.BurnProposalDepositPrevote = bool(v != 0) + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteVeto", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnVoteVeto = bool(v != 0) + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDepositRatio", 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.MinDepositRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/x/gov/types/v1/params.go b/x/gov/types/v1/params.go index fad5365a..d1b7c902 100644 --- a/x/gov/types/v1/params.go +++ b/x/gov/types/v1/params.go @@ -23,8 +23,9 @@ var ( DefaultQuorum = sdk.NewDecWithPrec(25, 2) DefaultThreshold = sdk.NewDecWithPrec(667, 3) DefaultMinInitialDepositRatio = sdk.ZeroDec() - DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47) - DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) + DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47) + DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) + DefaultMinDepositRatio = sdk.MustNewDecFromStr("0.01") // NOTE: backport from v50 ) // Deprecated: NewDepositParams creates a new DepositParams object @@ -53,7 +54,7 @@ func NewVotingParams(votingPeriod *time.Duration) VotingParams { // NewParams creates a new Params instance with given values. func NewParams( minDeposit sdk.Coins, maxDepositPeriod, votingPeriod time.Duration, - quorum, threshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum bool, + quorum, threshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum bool, minDepositRatio string, ) Params { return Params{ MinDeposit: minDeposit, @@ -64,6 +65,7 @@ func NewParams( MinInitialDepositRatio: minInitialDepositRatio, BurnProposalDepositPrevote: burnProposalDeposit, BurnVoteQuorum: burnVoteQuorum, + MinDepositRatio: minDepositRatio, } } @@ -78,6 +80,7 @@ func DefaultParams() Params { DefaultMinInitialDepositRatio.String(), DefaultBurnProposalPrevote, DefaultBurnVoteQuorom, + DefaultMinDepositRatio.String(), ) } diff --git a/x/gov/types/v1/tx.pb.go b/x/gov/types/v1/tx.pb.go index b9585162..24d9e3e3 100644 --- a/x/gov/types/v1/tx.pb.go +++ b/x/gov/types/v1/tx.pb.go @@ -38,7 +38,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgSubmitProposal struct { // messages are the arbitrary messages to be executed if proposal passes. Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - // initial_deposit is the deposit value that must be paid at proposal submission. + // initial_deposit is the deposit value that must be paid at proposal + // submission. InitialDeposit []types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit"` // proposer is the account address of the proposer. Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` @@ -593,7 +594,8 @@ var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo // // Since: cosmos-sdk 0.47 type MsgUpdateParams struct { - // authority is the address that controls the module (defaults to x/gov unless overwritten). + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // params defines the x/gov parameters to update. // @@ -785,7 +787,8 @@ type MsgClient interface { ExecLegacyContent(ctx context.Context, in *MsgExecLegacyContent, opts ...grpc.CallOption) (*MsgExecLegacyContentResponse, error) // Vote defines a method to add a vote on a specific proposal. Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) - // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // VoteWeighted defines a method to add a weighted vote on a specific + // proposal. VoteWeighted(ctx context.Context, in *MsgVoteWeighted, opts ...grpc.CallOption) (*MsgVoteWeightedResponse, error) // Deposit defines a method to add deposit on a specific proposal. Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) @@ -867,7 +870,8 @@ type MsgServer interface { ExecLegacyContent(context.Context, *MsgExecLegacyContent) (*MsgExecLegacyContentResponse, error) // Vote defines a method to add a vote on a specific proposal. Vote(context.Context, *MsgVote) (*MsgVoteResponse, error) - // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // VoteWeighted defines a method to add a weighted vote on a specific + // proposal. VoteWeighted(context.Context, *MsgVoteWeighted) (*MsgVoteWeightedResponse, error) // Deposit defines a method to add deposit on a specific proposal. Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) diff --git a/x/gov/types/v1beta1/gov.pb.go b/x/gov/types/v1beta1/gov.pb.go index b252ac39..074b74fa 100644 --- a/x/gov/types/v1beta1/gov.pb.go +++ b/x/gov/types/v1beta1/gov.pb.go @@ -126,7 +126,8 @@ func (ProposalStatus) EnumDescriptor() ([]byte, []int) { // // Since: cosmos-sdk 0.43 type WeightedVoteOption struct { - // option defines the valid vote options, it must not contain duplicate vote options. + // option defines the valid vote options, it must not contain duplicate vote + // options. Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=atomone.gov.v1beta1.VoteOption" json:"option,omitempty"` // weight is the vote weight associated with the vote option. Weight github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=weight,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"weight"` @@ -481,10 +482,10 @@ type TallyParams struct { // Minimum percentage of total stake needed to vote for a result to be // considered valid. Quorum github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=quorum,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"quorum,omitempty"` - // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + // Minimum proportion of Yes votes for proposal to pass. Default value: 2/3. Threshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=threshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"threshold,omitempty"` // Minimum value of Veto votes to Total votes ratio for proposal to be - // vetoed. Default value: 1/3. + // vetoed. Default value: 0 (disabled). VetoThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"veto_threshold,omitempty"` } diff --git a/x/gov/types/v1beta1/tx.pb.go b/x/gov/types/v1beta1/tx.pb.go index 5bdb9bf8..af73a84c 100644 --- a/x/gov/types/v1beta1/tx.pb.go +++ b/x/gov/types/v1beta1/tx.pb.go @@ -39,7 +39,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgSubmitProposal struct { // content is the proposal's content. Content *types.Any `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` - // initial_deposit is the deposit value that must be paid at proposal submission. + // initial_deposit is the deposit value that must be paid at proposal + // submission. InitialDeposit github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"initial_deposit"` // proposer is the account address of the proposer. Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` @@ -444,7 +445,8 @@ type MsgClient interface { SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) // Vote defines a method to add a vote on a specific proposal. Vote(ctx context.Context, in *MsgVote, opts ...grpc.CallOption) (*MsgVoteResponse, error) - // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // VoteWeighted defines a method to add a weighted vote on a specific + // proposal. // // Since: cosmos-sdk 0.43 VoteWeighted(ctx context.Context, in *MsgVoteWeighted, opts ...grpc.CallOption) (*MsgVoteWeightedResponse, error) @@ -502,7 +504,8 @@ type MsgServer interface { SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) // Vote defines a method to add a vote on a specific proposal. Vote(context.Context, *MsgVote) (*MsgVoteResponse, error) - // VoteWeighted defines a method to add a weighted vote on a specific proposal. + // VoteWeighted defines a method to add a weighted vote on a specific + // proposal. // // Since: cosmos-sdk 0.43 VoteWeighted(context.Context, *MsgVoteWeighted) (*MsgVoteWeightedResponse, error)