diff --git a/api/cosmos/gov/v1/gov.pulsar.go b/api/cosmos/gov/v1/gov.pulsar.go index ae8f3c9535e0..d3190cb35cfb 100644 --- a/api/cosmos/gov/v1/gov.pulsar.go +++ b/api/cosmos/gov/v1/gov.pulsar.go @@ -5197,7 +5197,7 @@ func (VoteOption) EnumDescriptor() ([]byte, []int) { type ProposalStatus int32 const ( - // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED ProposalStatus = 0 // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit // period. diff --git a/api/cosmos/gov/v1/query.pulsar.go b/api/cosmos/gov/v1/query.pulsar.go index 3774f0ffa052..6d6351b72e13 100644 --- a/api/cosmos/gov/v1/query.pulsar.go +++ b/api/cosmos/gov/v1/query.pulsar.go @@ -8014,7 +8014,7 @@ type QueryVoteRequest struct { // proposal_id defines the unique id of the proposal. ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // voter defines the oter address for the proposals. + // voter defines the voter address for the proposals. Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` } diff --git a/api/cosmos/gov/v1beta1/gov.pulsar.go b/api/cosmos/gov/v1beta1/gov.pulsar.go index 4bbb3bf88d0b..0dbe85e61535 100644 --- a/api/cosmos/gov/v1beta1/gov.pulsar.go +++ b/api/cosmos/gov/v1beta1/gov.pulsar.go @@ -5546,7 +5546,7 @@ func (VoteOption) EnumDescriptor() ([]byte, []int) { type ProposalStatus int32 const ( - // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED ProposalStatus = 0 // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit // period. diff --git a/api/cosmos/gov/v1beta1/query.pulsar.go b/api/cosmos/gov/v1beta1/query.pulsar.go index 87ef0ba3c9bf..9684b840fa02 100644 --- a/api/cosmos/gov/v1beta1/query.pulsar.go +++ b/api/cosmos/gov/v1beta1/query.pulsar.go @@ -8013,7 +8013,7 @@ type QueryVoteRequest struct { // proposal_id defines the unique id of the proposal. ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // voter defines the oter address for the proposals. + // voter defines the voter address for the proposals. Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` } diff --git a/proto/cosmos/gov/v1/gov.proto b/proto/cosmos/gov/v1/gov.proto index fb014d65ce6b..8a8572335d75 100644 --- a/proto/cosmos/gov/v1/gov.proto +++ b/proto/cosmos/gov/v1/gov.proto @@ -60,7 +60,7 @@ message Proposal { // ProposalStatus enumerates the valid statuses of a proposal. enum ProposalStatus { - // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. PROPOSAL_STATUS_UNSPECIFIED = 0; // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit // period. diff --git a/proto/cosmos/gov/v1/query.proto b/proto/cosmos/gov/v1/query.proto index ea46472aa723..b9d5914507d8 100644 --- a/proto/cosmos/gov/v1/query.proto +++ b/proto/cosmos/gov/v1/query.proto @@ -93,7 +93,7 @@ message QueryVoteRequest { // proposal_id defines the unique id of the proposal. uint64 proposal_id = 1; - // voter defines the oter address for the proposals. + // voter defines the voter address for the proposals. string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } diff --git a/proto/cosmos/gov/v1beta1/gov.proto b/proto/cosmos/gov/v1beta1/gov.proto index f1487fe4b56e..0e65d65b20d5 100644 --- a/proto/cosmos/gov/v1beta1/gov.proto +++ b/proto/cosmos/gov/v1beta1/gov.proto @@ -88,7 +88,7 @@ message Proposal { enum ProposalStatus { option (gogoproto.goproto_enum_prefix) = false; - // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. PROPOSAL_STATUS_UNSPECIFIED = 0 [(gogoproto.enumvalue_customname) = "StatusNil"]; // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit // period. diff --git a/proto/cosmos/gov/v1beta1/query.proto b/proto/cosmos/gov/v1beta1/query.proto index e8837fd275a7..168e1f5e077b 100644 --- a/proto/cosmos/gov/v1beta1/query.proto +++ b/proto/cosmos/gov/v1beta1/query.proto @@ -98,7 +98,7 @@ message QueryVoteRequest { // proposal_id defines the unique id of the proposal. uint64 proposal_id = 1; - // voter defines the oter address for the proposals. + // voter defines the voter address for the proposals. string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; } diff --git a/x/gov/client/cli/query.go b/x/gov/client/cli/query.go index 47fc0ce6a593..c0f2eeaf329e 100644 --- a/x/gov/client/cli/query.go +++ b/x/gov/client/cli/query.go @@ -90,8 +90,8 @@ $ %s query gov proposal 1 return cmd } -// GetCmdQueryProposals implements a query proposals command. Command to Get a -// Proposal Information. +// GetCmdQueryProposals implements a query proposals command. Command to Get +// Proposals Information. func GetCmdQueryProposals() *cobra.Command { cmd := &cobra.Command{ Use: "proposals", @@ -179,7 +179,7 @@ $ %s query gov proposals --page=2 --limit=100 } // GetCmdQueryVote implements the query proposal vote command. Command to Get a -// Proposal Information. +// Vote Information. func GetCmdQueryVote() *cobra.Command { cmd := &cobra.Command{ Use: "vote [proposal-id] [voter-addr]", @@ -337,7 +337,7 @@ $ %[1]s query gov votes 1 --page=2 --limit=100 } // GetCmdQueryDeposit implements the query proposal deposit command. Command to -// get a specific Deposit Information +// get a specific Deposit Information. func GetCmdQueryDeposit() *cobra.Command { cmd := &cobra.Command{ Use: "deposit [proposal-id] [depositer-addr]", diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index 4a6a37b4da8d..fcb030e146a1 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -48,7 +48,7 @@ var ProposalFlags = []string{ // NewTxCmd returns the transaction commands for this module // governance ModuleClient is slightly different from other ModuleClients in that // it contains a slice of "proposal" child commands. These commands are respective -// to proposal type handlers that are implemented in other modules but are mounted +// to the proposal type handlers that are implemented in other modules but are mounted // under the governance CLI (eg. parameter change proposals). func NewTxCmd(legacyPropCmds []*cobra.Command) *cobra.Command { govTxCmd := &cobra.Command{ diff --git a/x/gov/client/testutil/suite.go b/x/gov/client/testutil/suite.go index 94669734abf7..bbd5bbc2c275 100644 --- a/x/gov/client/testutil/suite.go +++ b/x/gov/client/testutil/suite.go @@ -282,7 +282,7 @@ func (s *IntegrationTestSuite) TestCmdTally() { func (s *IntegrationTestSuite) TestNewCmdSubmitProposal() { val := s.network.Validators[0] - // Create an legacy proposal JSON, make sure it doesn't pass this new CLI + // Create a legacy proposal JSON, make sure it doesn't pass this new CLI // command. invalidProp := `{ "title": "", diff --git a/x/gov/client/utils/query.go b/x/gov/client/utils/query.go index 8c440400d8be..97eb7e784cf2 100644 --- a/x/gov/client/utils/query.go +++ b/x/gov/client/utils/query.go @@ -34,7 +34,7 @@ func (p Proposer) String() string { } // QueryDepositsByTxQuery will query for deposits via a direct txs tags query. It -// will fetch and build deposits directly from the returned txs and return a +// will fetch and build deposits directly from the returned txs and returns a // JSON marshalled result or any error that occurred. // // NOTE: SearchTxs is used to facilitate the txs query which does not currently @@ -103,7 +103,7 @@ func QueryDepositsByTxQuery(clientCtx client.Context, params v1.QueryProposalPar } // QueryVotesByTxQuery will query for votes via a direct txs tags query. It -// will fetch and build votes directly from the returned txs and return a JSON +// will fetch and build votes directly from the returned txs and returns a JSON // marshalled result or any error that occurred. func QueryVotesByTxQuery(clientCtx client.Context, params v1.QueryProposalVotesParams) ([]byte, error) { var ( diff --git a/x/gov/keeper/deposit.go b/x/gov/keeper/deposit.go index 08a4bf6de6d8..2dcd50f9ff6a 100644 --- a/x/gov/keeper/deposit.go +++ b/x/gov/keeper/deposit.go @@ -73,7 +73,7 @@ func (keeper Keeper) DeleteAndBurnDeposits(ctx sdk.Context, proposalID uint64) { }) } -// IterateAllDeposits iterates over the all the stored deposits and performs a callback function +// IterateAllDeposits iterates over all the stored deposits and performs a callback function func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1.Deposit) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.DepositsKeyPrefix) @@ -91,7 +91,7 @@ func (keeper Keeper) IterateAllDeposits(ctx sdk.Context, cb func(deposit v1.Depo } } -// IterateDeposits iterates over the all the proposals deposits and performs a callback function +// IterateDeposits iterates over all the proposals deposits and performs a callback function func (keeper Keeper) IterateDeposits(ctx sdk.Context, proposalID uint64, cb func(deposit v1.Deposit) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.DepositsKey(proposalID)) diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index bc8cfa98676c..64088859c684 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -10,7 +10,7 @@ import ( v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) -// SubmitProposal create new proposal given an array of messages +// SubmitProposal creates a new proposal given an array of messages func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata string) (v1.Proposal, error) { err := keeper.assertMetadataLength(metadata) if err != nil { @@ -91,7 +91,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat return proposal, nil } -// GetProposal get proposal from store by ProposalID. +// GetProposal gets a proposal from store by ProposalID. // Panics if can't unmarshal the proposal. func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1.Proposal, bool) { store := ctx.KVStore(keeper.storeKey) @@ -109,7 +109,7 @@ func (keeper Keeper) GetProposal(ctx sdk.Context, proposalID uint64) (v1.Proposa return proposal, true } -// SetProposal set a proposal to store. +// SetProposal sets a proposal to store. // Panics if can't marshal the proposal. func (keeper Keeper) SetProposal(ctx sdk.Context, proposal v1.Proposal) { bz, err := keeper.MarshalProposal(proposal) diff --git a/x/gov/keeper/tally.go b/x/gov/keeper/tally.go index 2e088272f86f..52d7138e8388 100644 --- a/x/gov/keeper/tally.go +++ b/x/gov/keeper/tally.go @@ -53,7 +53,7 @@ func (keeper Keeper) Tally(ctx sdk.Context, proposal v1.Proposal) (passes bool, if val, ok := currValidators[valAddrStr]; ok { // There is no need to handle the special case that validator address equal to voter address. - // Because voter's voting power will tally again even if there will deduct voter's voting power from validator. + // Because voter's voting power will tally again even if there will be deduction of voter's voting power from validator. val.DelegatorDeductions = val.DelegatorDeductions.Add(delegation.GetShares()) currValidators[valAddrStr] = val diff --git a/x/gov/keeper/vote.go b/x/gov/keeper/vote.go index 742b1cc654b7..c37c143ce409 100644 --- a/x/gov/keeper/vote.go +++ b/x/gov/keeper/vote.go @@ -88,7 +88,7 @@ func (keeper Keeper) SetVote(ctx sdk.Context, vote v1.Vote) { store.Set(types.VoteKey(vote.ProposalId, addr), bz) } -// IterateAllVotes iterates over the all the stored votes and performs a callback function +// IterateAllVotes iterates over all the stored votes and performs a callback function func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote v1.Vote) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.VotesKeyPrefix) @@ -104,7 +104,7 @@ func (keeper Keeper) IterateAllVotes(ctx sdk.Context, cb func(vote v1.Vote) (sto } } -// IterateVotes iterates over the all the proposals votes and performs a callback function +// IterateVotes iterates over all the proposals votes and performs a callback function func (keeper Keeper) IterateVotes(ctx sdk.Context, proposalID uint64, cb func(vote v1.Vote) (stop bool)) { store := ctx.KVStore(keeper.storeKey) iterator := sdk.KVStorePrefixIterator(store, types.VotesKey(proposalID)) diff --git a/x/gov/simulation/genesis_test.go b/x/gov/simulation/genesis_test.go index 7167769b8e38..35de56cd2751 100644 --- a/x/gov/simulation/genesis_test.go +++ b/x/gov/simulation/genesis_test.go @@ -18,7 +18,7 @@ import ( ) // TestRandomizedGenState tests the normal scenario of applying RandomizedGenState. -// Abonormal scenarios are not tested here. +// Abnormal scenarios are not tested here. func TestRandomizedGenState(t *testing.T) { interfaceRegistry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(interfaceRegistry) diff --git a/x/gov/simulation/operations_test.go b/x/gov/simulation/operations_test.go index d005ce01328f..1d0ac256b49d 100644 --- a/x/gov/simulation/operations_test.go +++ b/x/gov/simulation/operations_test.go @@ -99,7 +99,7 @@ func TestWeightedOperations(t *testing.T) { } // TestSimulateMsgSubmitProposal tests the normal scenario of a valid message of type TypeMsgSubmitProposal. -// Abnormal scenarios, where the message is created by an errors are not tested here. +// Abnormal scenarios, where errors occur, are not tested here. func TestSimulateMsgSubmitProposal(t *testing.T) { app, ctx := createTestApp(t, false) @@ -131,7 +131,7 @@ func TestSimulateMsgSubmitProposal(t *testing.T) { } // TestSimulateMsgDeposit tests the normal scenario of a valid message of type TypeMsgDeposit. -// Abnormal scenarios, where the message is created by an errors are not tested here. +// Abnormal scenarios, where errors occur, are not tested here. func TestSimulateMsgDeposit(t *testing.T) { app, ctx := createTestApp(t, false) blockTime := time.Now().UTC() @@ -177,7 +177,7 @@ func TestSimulateMsgDeposit(t *testing.T) { } // TestSimulateMsgVote tests the normal scenario of a valid message of type TypeMsgVote. -// Abnormal scenarios, where the message is created by an errors are not tested here. +// Abnormal scenarios, where errors occur, are not tested here. func TestSimulateMsgVote(t *testing.T) { app, ctx := createTestApp(t, false) blockTime := time.Now().UTC() @@ -221,7 +221,7 @@ func TestSimulateMsgVote(t *testing.T) { } // TestSimulateMsgVoteWeighted tests the normal scenario of a valid message of type TypeMsgVoteWeighted. -// Abnormal scenarios, where the message is created by an errors are not tested here. +// Abnormal scenarios, where errors occur, are not tested here. func TestSimulateMsgVoteWeighted(t *testing.T) { app, ctx := createTestApp(t, false) blockTime := time.Now().UTC() diff --git a/x/gov/spec/01_concepts.md b/x/gov/spec/01_concepts.md index c1e3ed830dea..865eff89f663 100644 --- a/x/gov/spec/01_concepts.md +++ b/x/gov/spec/01_concepts.md @@ -67,7 +67,7 @@ according to the final tally of the proposal: * All refunded or burned deposits are removed from the state. Events are issued when burning or refunding a deposit. -## Voting +## Vote ### Participants @@ -169,7 +169,7 @@ Later, we may add permissioned keys that could only sign txs from certain module ## Software Upgrade If proposals are of type `SoftwareUpgradeProposal`, then nodes need to upgrade -their software to the new version that was voted. This process is divided in +their software to the new version that was voted. This process is divided into two steps. ### Signal diff --git a/x/gov/spec/02_state.md b/x/gov/spec/02_state.md index 06e1e6908e9e..7c071531f2fd 100644 --- a/x/gov/spec/02_state.md +++ b/x/gov/spec/02_state.md @@ -20,7 +20,7 @@ to discuss and debate the proposal. In most cases, it is encouraged to have an o system that supports the on-chain governance process. To accommodate for this, a proposal contains a special `metadata` field, an array of bytes, which can be used to add context to the proposal. The `metadata` field allows custom use for networks, however, -it is expected that the field contain a URL or some form of CID using a system such as +it is expected that the field contains a URL or some form of CID using a system such as [IPFS](https://docs.ipfs.io/concepts/content-addressing/). To support the case of interoperability across networks, the SDK recommends that the `metadata` represents the following `JSON` template: @@ -93,7 +93,7 @@ type ProposalStatus byte const ( - StatusNil ProposalStatus = 0x00 + StatusNil ProposalStatus = 0x00 StatusDepositPeriod ProposalStatus = 0x01 // Proposal is submitted. Participants can deposit on it but not vote StatusVotingPeriod ProposalStatus = 0x02 // MinDeposit is reached, participants can vote StatusPassed ProposalStatus = 0x03 // Proposal passed and successfully executed @@ -177,7 +177,7 @@ And the pseudocode for the `ProposalProcessingQueue`: tallyingParam = load(GlobalParams, 'TallyingParam') - // Update tally if validator voted they voted + // Update tally if validator voted for each validator in validators if tmpValMap(validator).HasVoted proposal.updateTally(tmpValMap(validator).Vote, (validator.TotalShares - tmpValMap(validator).Minus)) diff --git a/x/gov/spec/03_messages.md b/x/gov/spec/03_messages.md index 04fcbf1d9d69..f1cb432028e3 100644 --- a/x/gov/spec/03_messages.md +++ b/x/gov/spec/03_messages.md @@ -108,7 +108,7 @@ upon receiving txGovDeposit from sender do // There is no proposal for this proposalID throw - if (txGovDeposit.Deposit.Atoms <= 0) ORĀ (sender.AtomBalance < txGovDeposit.Deposit.Atoms) OR (proposal.CurrentStatus != ProposalStatusOpen) + if (txGovDeposit.Deposit.Atoms <= 0) OR (sender.AtomBalance < txGovDeposit.Deposit.Atoms) OR (proposal.CurrentStatus != ProposalStatusOpen) // deposit is negative or null // OR sender has insufficient funds diff --git a/x/gov/spec/07_client.md b/x/gov/spec/07_client.md index 578d80ad2275..900a6f690a64 100644 --- a/x/gov/spec/07_client.md +++ b/x/gov/spec/07_client.md @@ -135,28 +135,28 @@ simd query gov proposal 1 Example Output: ```bash -messages: [ - { - '@type': /cosmos.bank.v1beta1.MsgSend - from_address: "cosmos1..", - to_address: "cosmos1..", - amount: "100atom" - } -], -deposit_end_time: "2021-09-17T23:36:18.254995423Z" +deposit_end_time: "2022-03-30T11:50:20.819676256Z" final_tally_result: - abstain: "0" - "no": "0" - no_with_veto: "0" - "yes": "0" -proposal_id: "1" + abstain_count: "0" + no_count: "0" + no_with_veto_count: "0" + yes_count: "0" +id: "1" +messages: +- '@type': /cosmos.bank.v1beta1.MsgSend + amount: + - amount: "10" + denom: stake + from_address: cosmos1.. + to_address: cosmos1.. +metadata: AQ== status: PROPOSAL_STATUS_DEPOSIT_PERIOD -submit_time: "2021-09-15T23:36:18.254995423Z" +submit_time: "2022-03-28T11:50:20.819676256Z" total_deposit: -- amount: "100" +- amount: "10" denom: stake -voting_end_time: "0001-01-01T00:00:00Z" -voting_start_time: "0001-01-01T00:00:00Z" +voting_end_time: null +voting_start_time: null ``` #### proposals @@ -178,26 +178,52 @@ Example Output: ```bash pagination: next_key: null - total: "1" + total: "0" proposals: -- content: - '@type': /cosmos.gov.v1beta1.TextProposal - description: testing, testing, 1, 2, 3 - title: Test Proposal - deposit_end_time: "2021-09-17T23:36:18.254995423Z" +- deposit_end_time: "2022-03-30T11:50:20.819676256Z" final_tally_result: - abstain: "0" - "no": "0" - no_with_veto: "0" - "yes": "0" - proposal_id: "1" + abstain_count: "0" + no_count: "0" + no_with_veto_count: "0" + yes_count: "0" + id: "1" + messages: + - '@type': /cosmos.bank.v1beta1.MsgSend + amount: + - amount: "10" + denom: stake + from_address: cosmos1.. + to_address: cosmos1.. + metadata: AQ== status: PROPOSAL_STATUS_DEPOSIT_PERIOD - submit_time: "2021-09-15T23:36:18.254995423Z" + submit_time: "2022-03-28T11:50:20.819676256Z" total_deposit: - - amount: "100" + - amount: "10" + denom: stake + voting_end_time: null + voting_start_time: null +- deposit_end_time: "2022-03-30T14:02:41.165025015Z" + final_tally_result: + abstain_count: "0" + no_count: "0" + no_with_veto_count: "0" + yes_count: "0" + id: "2" + messages: + - '@type': /cosmos.bank.v1beta1.MsgSend + amount: + - amount: "10" + denom: stake + from_address: cosmos1.. + to_address: cosmos1.. + metadata: AQ== + status: PROPOSAL_STATUS_DEPOSIT_PERIOD + submit_time: "2022-03-28T14:02:41.165025015Z" + total_deposit: + - amount: "10" denom: stake - voting_end_time: "0001-01-01T00:00:00Z" - voting_start_time: "0001-01-01T00:00:00Z" + voting_end_time: null + voting_start_time: null ``` #### proposer @@ -218,7 +244,7 @@ Example Output: ```bash proposal_id: "1" -proposer: cosmos1r0tllwu5c9dtgwg3wr28lpvf76hg85f5zmh9l2 +proposer: cosmos1.. ``` #### tally @@ -295,7 +321,7 @@ votes: - option: VOTE_OPTION_YES weight: "1.000000000000000000" proposal_id: "1" - voter: cosmos1r0tllwu5c9dtgwg3wr28lpvf76hg85f5zmh9l2 + voter: cosmos1.. ``` ### Transactions @@ -322,34 +348,66 @@ simd tx gov deposit 1 10000000stake --from cosmos1.. #### submit-proposal -The `submit-proposal` command allows users to submit a governance proposal and to optionally include an initial deposit. +The `submit-proposal` command allows users to submit a governance proposal along with some messages and metadata. +Messages, metadata and deposit are defined in a JSON file. + +```bash +simd tx gov submit-proposal [path-to-proposal-json] [flags] +``` + +Example: + +```bash +simd tx gov submit-proposal /path/to/proposal.json --from cosmos1.. +``` + +where proposal.json contains: + +```bash +{ + "messages": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "from_address": "cosmos1...", + "to_address": "cosmos1...", + "amount":[{"denom": "stake","amount": "10"}] + } + ], + "metadata": "AQ==", + "deposit": "10stake" +} +``` + +#### submit-legacy-proposal + +The `submit-legacy-proposal` command allows users to submit a governance legacy proposal along with an initial deposit. ```bash -simd tx gov submit-proposal [command] [flags] +simd tx gov submit-legacy-proposal [command] [flags] ``` Example: ```bash -simd tx gov submit-proposal --title="Test Proposal" --description="testing, testing, 1, 2, 3" --type="Text" --deposit="10000000stake" --from cosmos1.. +simd tx gov submit-legacy-proposal --title="Test Proposal" --description="testing" --type="Text" --deposit="100000000stake" --from cosmos1.. ``` -Example (`cancel-software-upgrade`): +Example (`legacy-cancel-software-upgrade`): ```bash -simd tx gov submit-proposal cancel-software-upgrade --title="Test Proposal" --description="testing, testing, 1, 2, 3" --deposit="10000000stake" --from cosmos1.. +simd tx gov submit-legacy-proposal legacy-cancel-software-upgrade --title="Test Proposal" --description="testing" --deposit="100000000stake" --from cosmos1.. ``` Example (`community-pool-spend`): ```bash -simd tx gov submit-proposal community-pool-spend proposal.json --from cosmos1.. +simd tx gov submit-legacy-proposal community-pool-spend proposal.json --from cosmos1.. ``` ```json { "title": "Test Proposal", - "description": "testing, testing, 1, 2, 3", + "description": "testing, 1, 2, 3", "recipient": "cosmos1..", "amount": "10000000stake", "deposit": "10000000stake" @@ -359,7 +417,7 @@ simd tx gov submit-proposal community-pool-spend proposal.json --from cosmos1.. Example (`param-change`): ```bash -simd tx gov submit-proposal param-change proposal.json --from cosmos1.. +simd tx gov submit-legacy-proposal param-change proposal.json --from cosmos1.. ``` ```json @@ -377,10 +435,10 @@ simd tx gov submit-proposal param-change proposal.json --from cosmos1.. } ``` -Example (`software-upgrade`): +Example (`legacy-software-upgrade`): ```bash -simd tx gov submit-proposal software-upgrade v2 --title="Test Proposal" --description="testing, testing, 1, 2, 3" --upgrade-height 1000000 --from cosmos1.. +simd tx gov submit-legacy-proposal legacy-software-upgrade v2 --title="Test Proposal" --description="testing, testing, 1, 2, 3" --upgrade-height 1000000 --from cosmos1.. ``` #### vote @@ -402,13 +460,13 @@ simd tx gov vote 1 yes --from cosmos1.. The `weighted-vote` command allows users to submit a weighted vote for a given governance proposal. ```bash -simd tx gov weighted-vote [proposal-id] [weighted-options] +simd tx gov weighted-vote [proposal-id] [weighted-options] [flags] ``` Example: ```bash -simd tx gov weighted-vote 1 yes=0.5,no=0.5 --from cosmos1 +simd tx gov weighted-vote 1 yes=0.5,no=0.5 --from cosmos1.. ``` ## gRPC @@ -419,6 +477,8 @@ A user can query the `gov` module using gRPC endpoints. The `Proposal` endpoint allows users to query a given proposal. +Using legacy v1beta1: + ```bash cosmos.gov.v1beta1.Query/Proposal ``` @@ -460,10 +520,59 @@ Example Output: } ``` +Using v1: + +```bash +cosmos.gov.v1.Query/Proposal +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id":"1"}' \ + localhost:9090 \ + cosmos.gov.v1.Query/Proposal +``` + +Example Output: + +```bash +{ + "proposal": { + "id": "1", + "messages": [ + {"@type":"/cosmos.bank.v1beta1.MsgSend","amount":[{"denom":"stake","amount":"10"}],"fromAddress":"cosmos1..","toAddress":"cosmos1.."} + ], + "status": "PROPOSAL_STATUS_VOTING_PERIOD", + "finalTallyResult": { + "yesCount": "0", + "abstainCount": "0", + "noCount": "0", + "noWithVetoCount": "0" + }, + "submitTime": "2022-03-28T11:50:20.819676256Z", + "depositEndTime": "2022-03-30T11:50:20.819676256Z", + "totalDeposit": [ + { + "denom": "stake", + "amount": "10000000" + } + ], + "votingStartTime": "2022-03-28T14:25:26.644857113Z", + "votingEndTime": "2022-03-30T14:25:26.644857113Z", + "metadata": "AQ==" + } +} +``` + + ### Proposals The `Proposals` endpoint allows users to query all proposals with optional filters. +Using legacy v1beta1: + ```bash cosmos.gov.v1beta1.Query/Proposals ``` @@ -483,7 +592,6 @@ Example Output: "proposals": [ { "proposalId": "1", - "content": {"@type":"/cosmos.gov.v1beta1.TextProposal","description":"testing, testing, 1, 2, 3","title":"Test Proposal"}, "status": "PROPOSAL_STATUS_VOTING_PERIOD", "finalTallyResult": { "yes": "0", @@ -491,20 +599,19 @@ Example Output: "no": "0", "noWithVeto": "0" }, - "submitTime": "2021-09-16T19:40:08.712440474Z", - "depositEndTime": "2021-09-18T19:40:08.712440474Z", + "submitTime": "2022-03-28T11:50:20.819676256Z", + "depositEndTime": "2022-03-30T11:50:20.819676256Z", "totalDeposit": [ { "denom": "stake", - "amount": "10000000" + "amount": "10000000010" } ], - "votingStartTime": "2021-09-16T19:40:08.712440474Z", - "votingEndTime": "2021-09-18T19:40:08.712440474Z" + "votingStartTime": "2022-03-28T14:25:26.644857113Z", + "votingEndTime": "2022-03-30T14:25:26.644857113Z" }, { "proposalId": "2", - "content": {"@type":"/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal","description":"Test Proposal","title":"testing, testing, 1, 2, 3"}, "status": "PROPOSAL_STATUS_DEPOSIT_PERIOD", "finalTallyResult": { "yes": "0", @@ -512,8 +619,14 @@ Example Output: "no": "0", "noWithVeto": "0" }, - "submitTime": "2021-09-17T18:26:57.866854713Z", - "depositEndTime": "2021-09-19T18:26:57.866854713Z", + "submitTime": "2022-03-28T14:02:41.165025015Z", + "depositEndTime": "2022-03-30T14:02:41.165025015Z", + "totalDeposit": [ + { + "denom": "stake", + "amount": "10" + } + ], "votingStartTime": "0001-01-01T00:00:00Z", "votingEndTime": "0001-01-01T00:00:00Z" } @@ -522,12 +635,87 @@ Example Output: "total": "2" } } + +``` + +Using v1: + +```bash +cosmos.gov.v1.Query/Proposals +``` + +Example: + +```bash +grpcurl -plaintext \ + localhost:9090 \ + cosmos.gov.v1.Query/Proposals +``` + +Example Output: + +```bash +{ + "proposals": [ + { + "id": "1", + "messages": [ + {"@type":"/cosmos.bank.v1beta1.MsgSend","amount":[{"denom":"stake","amount":"10"}],"fromAddress":"cosmos1..","toAddress":"cosmos1.."} + ], + "status": "PROPOSAL_STATUS_VOTING_PERIOD", + "finalTallyResult": { + "yesCount": "0", + "abstainCount": "0", + "noCount": "0", + "noWithVetoCount": "0" + }, + "submitTime": "2022-03-28T11:50:20.819676256Z", + "depositEndTime": "2022-03-30T11:50:20.819676256Z", + "totalDeposit": [ + { + "denom": "stake", + "amount": "10000000010" + } + ], + "votingStartTime": "2022-03-28T14:25:26.644857113Z", + "votingEndTime": "2022-03-30T14:25:26.644857113Z", + "metadata": "AQ==" + }, + { + "id": "2", + "messages": [ + {"@type":"/cosmos.bank.v1beta1.MsgSend","amount":[{"denom":"stake","amount":"10"}],"fromAddress":"cosmos1..","toAddress":"cosmos1.."} + ], + "status": "PROPOSAL_STATUS_DEPOSIT_PERIOD", + "finalTallyResult": { + "yesCount": "0", + "abstainCount": "0", + "noCount": "0", + "noWithVetoCount": "0" + }, + "submitTime": "2022-03-28T14:02:41.165025015Z", + "depositEndTime": "2022-03-30T14:02:41.165025015Z", + "totalDeposit": [ + { + "denom": "stake", + "amount": "10" + } + ], + "metadata": "AQ==" + } + ], + "pagination": { + "total": "2" + } +} ``` ### Vote The `Vote` endpoint allows users to query a vote for a given proposal. +Using legacy v1beta1: + ```bash cosmos.gov.v1beta1.Query/Vote ``` @@ -559,10 +747,45 @@ Example Output: } ``` +Using v1: + +```bash +cosmos.gov.v1.Query/Vote +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id":"1","voter":"cosmos1.."}' \ + localhost:9090 \ + cosmos.gov.v1.Query/Vote +``` + +Example Output: + +```bash +{ + "vote": { + "proposalId": "1", + "voter": "cosmos1..", + "option": "VOTE_OPTION_YES", + "options": [ + { + "option": "VOTE_OPTION_YES", + "weight": "1.000000000000000000" + } + ] + } +} +``` + ### Votes The `Votes` endpoint allows users to query all votes for a given proposal. +Using legacy v1beta1: + ```bash cosmos.gov.v1beta1.Query/Votes ``` @@ -584,7 +807,6 @@ Example Output: { "proposalId": "1", "voter": "cosmos1..", - "option": "VOTE_OPTION_YES", "options": [ { "option": "VOTE_OPTION_YES", @@ -599,12 +821,51 @@ Example Output: } ``` +Using v1: + +```bash +cosmos.gov.v1.Query/Votes +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id":"1"}' \ + localhost:9090 \ + cosmos.gov.v1.Query/Votes +``` + +Example Output: + +```bash +{ + "votes": [ + { + "proposalId": "1", + "voter": "cosmos1..", + "options": [ + { + "option": "VOTE_OPTION_YES", + "weight": "1.000000000000000000" + } + ] + } + ], + "pagination": { + "total": "1" + } +} +``` + ### Params The `Params` endpoint allows users to query all parameters for the `gov` module. +Using legacy v1beta1: + ```bash cosmos.gov.v1beta1.Query/Params ``` @@ -636,10 +897,37 @@ Example Output: } ``` +Using v1: + +```bash +cosmos.gov.v1.Query/Params +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"params_type":"voting"}' \ + localhost:9090 \ + cosmos.gov.v1.Query/Params +``` + +Example Output: + +```bash +{ + "votingParams": { + "votingPeriod": "172800s" + } +} +``` + ### Deposit The `Deposit` endpoint allows users to query a deposit for a given proposal from a given depositor. +Using legacy v1beta1: + ```bash cosmos.gov.v1beta1.Query/Deposit ``` @@ -670,10 +958,44 @@ Example Output: } ``` +Using v1: + +```bash +cosmos.gov.v1.Query/Deposit +``` + +Example: + +```bash +grpcurl -plaintext \ + '{"proposal_id":"1","depositor":"cosmos1.."}' \ + localhost:9090 \ + cosmos.gov.v1.Query/Deposit +``` + +Example Output: + +```bash +{ + "deposit": { + "proposalId": "1", + "depositor": "cosmos1..", + "amount": [ + { + "denom": "stake", + "amount": "10000000" + } + ] + } +} +``` + ### deposits The `Deposits` endpoint allows users to query all deposits for a given proposal. +Using legacy v1beta1: + ```bash cosmos.gov.v1beta1.Query/Deposits ``` @@ -709,12 +1031,10 @@ Example Output: } ``` -### TallyResult - -The `TallyResult` endpoint allows users to query the tally of a given proposal. +Using v1: ```bash -cosmos.gov.v1beta1.Query/TallyResult +cosmos.gov.v1.Query/Deposits ``` Example: @@ -723,30 +1043,101 @@ Example: grpcurl -plaintext \ -d '{"proposal_id":"1"}' \ localhost:9090 \ - cosmos.gov.v1beta1.Query/TallyResult + cosmos.gov.v1.Query/Deposits ``` Example Output: ```bash { - "tally": { - "yes": "1000000", - "abstain": "0", - "no": "0", - "noWithVeto": "0" - } -} -``` - -## REST - -A user can query the `gov` module using REST endpoints. - + "deposits": [ + { + "proposalId": "1", + "depositor": "cosmos1..", + "amount": [ + { + "denom": "stake", + "amount": "10000000" + } + ] + } + ], + "pagination": { + "total": "1" + } +} +``` + +### TallyResult + +The `TallyResult` endpoint allows users to query the tally of a given proposal. + +Using legacy v1beta1: + +```bash +cosmos.gov.v1beta1.Query/TallyResult +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id":"1"}' \ + localhost:9090 \ + cosmos.gov.v1beta1.Query/TallyResult +``` + +Example Output: + +```bash +{ + "tally": { + "yes": "1000000", + "abstain": "0", + "no": "0", + "noWithVeto": "0" + } +} +``` + +Using v1: + +```bash +cosmos.gov.v1.Query/TallyResult +``` + +Example: + +```bash +grpcurl -plaintext \ + -d '{"proposal_id":"1"}' \ + localhost:9090 \ + cosmos.gov.v1.Query/TallyResult +``` + +Example Output: + +```bash +{ + "tally": { + "yes": "1000000", + "abstain": "0", + "no": "0", + "noWithVeto": "0" + } +} +``` + +## REST + +A user can query the `gov` module using REST endpoints. + ### proposal The `proposals` endpoint allows users to query a given proposal. +Using legacy v1beta1: + ```bash /cosmos/gov/v1beta1/proposals/{proposal_id} ``` @@ -763,11 +1154,7 @@ Example Output: { "proposal": { "proposal_id": "1", - "content": { - "@type": "/cosmos.gov.v1beta1.TextProposal", - "title": "Test Proposal", - "description": "testing, testing, 1, 2, 3" - }, + "content": null, "status": "PROPOSAL_STATUS_VOTING_PERIOD", "final_tally_result": { "yes": "0", @@ -775,16 +1162,69 @@ Example Output: "no": "0", "no_with_veto": "0" }, - "submit_time": "2021-09-16T19:40:08.712440474Z", - "deposit_end_time": "2021-09-18T19:40:08.712440474Z", + "submit_time": "2022-03-28T11:50:20.819676256Z", + "deposit_end_time": "2022-03-30T11:50:20.819676256Z", + "total_deposit": [ + { + "denom": "stake", + "amount": "10000000010" + } + ], + "voting_start_time": "2022-03-28T14:25:26.644857113Z", + "voting_end_time": "2022-03-30T14:25:26.644857113Z" + } +} +``` + +Using v1: + +```bash +/cosmos/gov/v1/proposals/{proposal_id} +``` + +Example: + +```bash +curl localhost:1317/cosmos/gov/v1/proposals/1 +``` + +Example Output: + +```bash +{ + "proposal": { + "id": "1", + "messages": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "from_address": "cosmos1..", + "to_address": "cosmos1..", + "amount": [ + { + "denom": "stake", + "amount": "10" + } + ] + } + ], + "status": "PROPOSAL_STATUS_VOTING_PERIOD", + "final_tally_result": { + "yes_count": "0", + "abstain_count": "0", + "no_count": "0", + "no_with_veto_count": "0" + }, + "submit_time": "2022-03-28T11:50:20.819676256Z", + "deposit_end_time": "2022-03-30T11:50:20.819676256Z", "total_deposit": [ { "denom": "stake", "amount": "10000000" } ], - "voting_start_time": "2021-09-16T19:40:08.712440474Z", - "voting_end_time": "2021-09-18T19:40:08.712440474Z" + "voting_start_time": "2022-03-28T14:25:26.644857113Z", + "voting_end_time": "2022-03-30T14:25:26.644857113Z", + "metadata": "AQ==" } } ``` @@ -793,6 +1233,8 @@ Example Output: The `proposals` endpoint also allows users to query all proposals with optional filters. +Using legacy v1beta1: + ```bash /cosmos/gov/v1beta1/proposals ``` @@ -810,11 +1252,7 @@ Example Output: "proposals": [ { "proposal_id": "1", - "content": { - "@type": "/cosmos.gov.v1beta1.TextProposal", - "title": "Test Proposal", - "description": "testing, testing, 1, 2, 3" - }, + "content": null, "status": "PROPOSAL_STATUS_VOTING_PERIOD", "final_tally_result": { "yes": "0", @@ -822,24 +1260,20 @@ Example Output: "no": "0", "no_with_veto": "0" }, - "submit_time": "2021-09-16T19:40:08.712440474Z", - "deposit_end_time": "2021-09-18T19:40:08.712440474Z", + "submit_time": "2022-03-28T11:50:20.819676256Z", + "deposit_end_time": "2022-03-30T11:50:20.819676256Z", "total_deposit": [ { "denom": "stake", "amount": "10000000" } ], - "voting_start_time": "2021-09-16T19:40:08.712440474Z", - "voting_end_time": "2021-09-18T19:40:08.712440474Z" + "voting_start_time": "2022-03-28T14:25:26.644857113Z", + "voting_end_time": "2022-03-30T14:25:26.644857113Z" }, { "proposal_id": "2", - "content": { - "@type": "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", - "title": "Test Proposal", - "description": "testing, testing, 1, 2, 3" - }, + "content": null, "status": "PROPOSAL_STATUS_DEPOSIT_PERIOD", "final_tally_result": { "yes": "0", @@ -847,9 +1281,13 @@ Example Output: "no": "0", "no_with_veto": "0" }, - "submit_time": "2021-09-17T18:26:57.866854713Z", - "deposit_end_time": "2021-09-19T18:26:57.866854713Z", + "submit_time": "2022-03-28T14:02:41.165025015Z", + "deposit_end_time": "2022-03-30T14:02:41.165025015Z", "total_deposit": [ + { + "denom": "stake", + "amount": "10" + } ], "voting_start_time": "0001-01-01T00:00:00Z", "voting_end_time": "0001-01-01T00:00:00Z" @@ -862,10 +1300,105 @@ Example Output: } ``` +Using v1: + +```bash +/cosmos/gov/v1/proposals +``` + +Example: + +```bash +curl localhost:1317/cosmos/gov/v1/proposals +``` + +Example Output: + +```bash +{ + "proposals": [ + { + "id": "1", + "messages": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "from_address": "cosmos1..", + "to_address": "cosmos1..", + "amount": [ + { + "denom": "stake", + "amount": "10" + } + ] + } + ], + "status": "PROPOSAL_STATUS_VOTING_PERIOD", + "final_tally_result": { + "yes_count": "0", + "abstain_count": "0", + "no_count": "0", + "no_with_veto_count": "0" + }, + "submit_time": "2022-03-28T11:50:20.819676256Z", + "deposit_end_time": "2022-03-30T11:50:20.819676256Z", + "total_deposit": [ + { + "denom": "stake", + "amount": "10000000010" + } + ], + "voting_start_time": "2022-03-28T14:25:26.644857113Z", + "voting_end_time": "2022-03-30T14:25:26.644857113Z", + "metadata": "AQ==" + }, + { + "id": "2", + "messages": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "from_address": "cosmos1..", + "to_address": "cosmos1..", + "amount": [ + { + "denom": "stake", + "amount": "10" + } + ] + } + ], + "status": "PROPOSAL_STATUS_DEPOSIT_PERIOD", + "final_tally_result": { + "yes_count": "0", + "abstain_count": "0", + "no_count": "0", + "no_with_veto_count": "0" + }, + "submit_time": "2022-03-28T14:02:41.165025015Z", + "deposit_end_time": "2022-03-30T14:02:41.165025015Z", + "total_deposit": [ + { + "denom": "stake", + "amount": "10" + } + ], + "voting_start_time": null, + "voting_end_time": null, + "metadata": "AQ==" + } + ], + "pagination": { + "next_key": null, + "total": "2" + } +} +``` + ### voter vote The `votes` endpoint allows users to query a vote for a given proposal. +Using legacy v1beta1: + ```bash /cosmos/gov/v1beta1/proposals/{proposal_id}/votes/{voter} ``` @@ -894,10 +1427,42 @@ Example Output: } ``` +Using v1: + +```bash +/cosmos/gov/v1/proposals/{proposal_id}/votes/{voter} +``` + +Example: + +```bash +curl localhost:1317/cosmos/gov/v1/proposals/1/votes/cosmos1.. +``` + +Example Output: + +```bash +{ + "vote": { + "proposal_id": "1", + "voter": "cosmos1..", + "options": [ + { + "option": "VOTE_OPTION_YES", + "weight": "1.000000000000000000" + } + ], + "metadata": "" + } +} +``` + ### votes The `votes` endpoint allows users to query all votes for a given proposal. +Using legacy v1beta1: + ```bash /cosmos/gov/v1beta1/proposals/{proposal_id}/votes ``` @@ -932,12 +1497,50 @@ Example Output: } ``` +Using v1: + +```bash +/cosmos/gov/v1/proposals/{proposal_id}/votes +``` + +Example: + +```bash +curl localhost:1317/cosmos/gov/v1/proposals/1/votes +``` + +Example Output: + +```bash +{ + "votes": [ + { + "proposal_id": "1", + "voter": "cosmos1..", + "options": [ + { + "option": "VOTE_OPTION_YES", + "weight": "1.000000000000000000" + } + ], + "metadata": "" + } + ], + "pagination": { + "next_key": null, + "total": "1" + } +} +``` + ### params The `params` endpoint allows users to query all parameters for the `gov` module. +Using legacy v1beta1: + ```bash /cosmos/gov/v1beta1/params/{params_type} ``` @@ -968,10 +1571,44 @@ Example Output: } ``` +Using v1: + +```bash +/cosmos/gov/v1/params/{params_type} +``` + +Example: + +```bash +curl localhost:1317/cosmos/gov/v1/params/voting +``` + +Example Output: + +```bash +{ + "voting_params": { + "voting_period": "172800s" + }, + "deposit_params": { + "min_deposit": [ + ], + "max_deposit_period": "0s" + }, + "tally_params": { + "quorum": "0.000000000000000000", + "threshold": "0.000000000000000000", + "veto_threshold": "0.000000000000000000" + } +} +``` + ### deposits The `deposits` endpoint allows users to query a deposit for a given proposal from a given depositor. +Using legacy v1beta1: + ```bash /cosmos/gov/v1beta1/proposals/{proposal_id}/deposits/{depositor} ``` @@ -999,10 +1636,41 @@ Example Output: } ``` +Using v1: + +```bash +/cosmos/gov/v1/proposals/{proposal_id}/deposits/{depositor} +``` + +Example: + +```bash +curl localhost:1317/cosmos/gov/v1/proposals/1/deposits/cosmos1.. +``` + +Example Output: + +```bash +{ + "deposit": { + "proposal_id": "1", + "depositor": "cosmos1..", + "amount": [ + { + "denom": "stake", + "amount": "10000000" + } + ] + } +} +``` + ### proposal deposits The `deposits` endpoint allows users to query all deposits for a given proposal. +Using legacy v1beta1: + ```bash /cosmos/gov/v1beta1/proposals/{proposal_id}/deposits ``` @@ -1036,10 +1704,47 @@ Example Output: } ``` +Using v1: + +```bash +/cosmos/gov/v1/proposals/{proposal_id}/deposits +``` + +Example: + +```bash +curl localhost:1317/cosmos/gov/v1/proposals/1/deposits +``` + +Example Output: + +```bash +{ + "deposits": [ + { + "proposal_id": "1", + "depositor": "cosmos1..", + "amount": [ + { + "denom": "stake", + "amount": "10000000" + } + ] + } + ], + "pagination": { + "next_key": null, + "total": "1" + } +} +``` + ### tally The `tally` endpoint allows users to query the tally of a given proposal. +Using legacy v1beta1: + ```bash /cosmos/gov/v1beta1/proposals/{proposal_id}/tally ``` @@ -1062,3 +1767,28 @@ Example Output: } } ``` + +Using v1: + +```bash +/cosmos/gov/v1/proposals/{proposal_id}/tally +``` + +Example: + +```bash +curl localhost:1317/cosmos/gov/v1/proposals/1/tally +``` + +Example Output: + +```bash +{ + "tally": { + "yes": "1000000", + "abstain": "0", + "no": "0", + "no_with_veto": "0" + } +} +``` diff --git a/x/gov/spec/README.md b/x/gov/spec/README.md index 897e9f936097..f0e1af55fb05 100644 --- a/x/gov/spec/README.md +++ b/x/gov/spec/README.md @@ -37,6 +37,7 @@ staking token of the chain. 1. **[Concepts](01_concepts.md)** * [Proposal submission](01_concepts.md#proposal-submission) + * [Deposit](01_concepts.md#Deposit) * [Vote](01_concepts.md#vote) * [Software Upgrade](01_concepts.md#software-upgrade) 2. **[State](02_state.md)** diff --git a/x/gov/types/v1/gov.pb.go b/x/gov/types/v1/gov.pb.go index ce404ad3e060..36b207454fff 100644 --- a/x/gov/types/v1/gov.pb.go +++ b/x/gov/types/v1/gov.pb.go @@ -75,7 +75,7 @@ func (VoteOption) EnumDescriptor() ([]byte, []int) { type ProposalStatus int32 const ( - // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED ProposalStatus = 0 // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit // period. diff --git a/x/gov/types/v1/query.pb.go b/x/gov/types/v1/query.pb.go index c120b6d45c53..2a7bbcc2fdf6 100644 --- a/x/gov/types/v1/query.pb.go +++ b/x/gov/types/v1/query.pb.go @@ -253,7 +253,7 @@ func (m *QueryProposalsResponse) GetPagination() *query.PageResponse { type QueryVoteRequest struct { // proposal_id defines the unique id of the proposal. ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // voter defines the oter address for the proposals. + // voter defines the voter address for the proposals. Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` } diff --git a/x/gov/types/v1beta1/gov.pb.go b/x/gov/types/v1beta1/gov.pb.go index 26d7447f3c5c..3fc60128b151 100644 --- a/x/gov/types/v1beta1/gov.pb.go +++ b/x/gov/types/v1beta1/gov.pb.go @@ -76,7 +76,7 @@ func (VoteOption) EnumDescriptor() ([]byte, []int) { type ProposalStatus int32 const ( - // PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal status. + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. StatusNil ProposalStatus = 0 // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit // period. diff --git a/x/gov/types/v1beta1/query.pb.go b/x/gov/types/v1beta1/query.pb.go index 3d3ccae4bfad..d50d02d22af8 100644 --- a/x/gov/types/v1beta1/query.pb.go +++ b/x/gov/types/v1beta1/query.pb.go @@ -226,7 +226,7 @@ func (m *QueryProposalsResponse) GetPagination() *query.PageResponse { type QueryVoteRequest struct { // proposal_id defines the unique id of the proposal. ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // voter defines the oter address for the proposals. + // voter defines the voter address for the proposals. Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` }