Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Nov 22, 2023
1 parent 9013310 commit 7eed169
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 194 deletions.
93 changes: 58 additions & 35 deletions api/cosmos/gov/v1/gov.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions proto/cosmos/gov/v1/gov.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,26 @@ enum ProposalType {

// VoteOption enumerates the valid vote options for a given governance proposal.
enum VoteOption {
option allow_alias = true;

Check failure on line 32 in proto/cosmos/gov/v1/gov.proto

View workflow job for this annotation

GitHub Actions / lint

Enum option "allow_alias" on enum "VoteOption" must be false.

// VOTE_OPTION_UNSPECIFIED defines a no-op vote option.
VOTE_OPTION_UNSPECIFIED = 0;
// VOTE_OPTION_ONE defines the first proposal vote option.
VOTE_OPTION_ONE = 1;
// VOTE_OPTION_YES defines the yes proposal vote option.
VOTE_OPTION_YES = 1;
// VOTE_OPTION_TWO defines the second proposal vote option.
VOTE_OPTION_TWO = 2;
// VOTE_OPTION_ABSTAIN defines the abstain proposal vote option.
VOTE_OPTION_ABSTAIN = 2;
// VOTE_OPTION_THREE defines the third proposal vote option.
VOTE_OPTION_THREE = 3;
// VOTE_OPTION_NO defines the no proposal vote option.
VOTE_OPTION_NO = 3;
// VOTE_OPTION_FOUR defines the fourth proposal vote option.
VOTE_OPTION_FOUR = 4;
// VOTE_OPTION_NO_WITH_VETO defines the no with veto proposal vote option.
VOTE_OPTION_NO_WITH_VETO = 4;
// VOTE_OPTION_SPAM defines the spam proposal vote option.
VOTE_OPTION_SPAM = 5;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/bank/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ func TestMsgSetSendEnabled(t *testing.T) {
"set default send enabled to true",
"Change send enabled",
"Modify send enabled and set to true",
false,
govv1.ProposalType_PROPOSAL_TYPE_STANDARD,
)
require.NoError(t, err, "making goodGovProp")

Expand Down
2 changes: 1 addition & 1 deletion x/gov/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### API Breaking Changes

* [#18532](https://github.com/cosmos/cosmos-sdk/pull/18532) All functions that were taking an expedited bool parameter now take a `ProposalType` parameter instead.
* [#17496](https://github.com/cosmos/cosmos-sdk/pull/17469) in `x/gov/types/v1beta1/vote.go` `NewVote` was removed, constructing the struct is required for this type.
* [#17496](https://github.com/cosmos/cosmos-sdk/pull/17496) in `x/gov/types/v1beta1/vote.go` `NewVote` was removed, constructing the struct is required for this type.

### Deprecated

Expand Down
75 changes: 35 additions & 40 deletions x/gov/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
sidebar_position: 1
---

<!--- TODO(@julienrbrt), describe spam votes and vote options changes -->

# `x/gov`

## Abstract
Expand Down Expand Up @@ -33,33 +35,33 @@ can be adapted to any Proof-Of-Stake blockchain by replacing *ATOM* with the nat
staking token of the chain.

* [Concepts](#concepts)
* [Proposal submission](#proposal-submission)
* [Deposit](#deposit)
* [Vote](#vote)
* [Software Upgrade](#software-upgrade)
* [Proposal submission](#proposal-submission)
* [Deposit](#deposit)
* [Vote](#vote)
* [Software Upgrade](#software-upgrade)
* [State](#state)
* [Proposals](#proposals)
* [Parameters and base types](#parameters-and-base-types)
* [Deposit](#deposit-1)
* [ValidatorGovInfo](#validatorgovinfo)
* [Stores](#stores)
* [Proposal Processing Queue](#proposal-processing-queue)
* [Legacy Proposal](#legacy-proposal)
* [Proposals](#proposals)
* [Parameters and base types](#parameters-and-base-types)
* [Deposit](#deposit-1)
* [ValidatorGovInfo](#validatorgovinfo)
* [Stores](#stores)
* [Proposal Processing Queue](#proposal-processing-queue)
* [Legacy Proposal](#legacy-proposal)
* [Messages](#messages)
* [Proposal Submission](#proposal-submission-1)
* [Deposit](#deposit-2)
* [Vote](#vote-1)
* [Proposal Submission](#proposal-submission-1)
* [Deposit](#deposit-2)
* [Vote](#vote-1)
* [Events](#events)
* [EndBlocker](#endblocker)
* [Handlers](#handlers)
* [EndBlocker](#endblocker)
* [Handlers](#handlers)
* [Parameters](#parameters)
* [Client](#client)
* [CLI](#cli)
* [gRPC](#grpc)
* [REST](#rest)
* [CLI](#cli)
* [gRPC](#grpc)
* [REST](#rest)
* [Metadata](#metadata)
* [Proposal](#proposal-3)
* [Vote](#vote-5)
* [Proposal](#proposal-3)
* [Vote](#vote-5)
* [Future Improvements](#future-improvements)

## Concepts
Expand Down Expand Up @@ -231,13 +233,13 @@ Later, we may add permissioned keys that could only sign txs from certain module

#### Burnable Params

There are three parameters that define if the deposit of a proposal should be burned or returned to the depositors.
There are three parameters that define if the deposit of a proposal should be burned or returned to the depositors.

* `BurnVoteVeto` burns the proposal deposit if the proposal gets vetoed.
* `BurnVoteVeto` burns the proposal deposit if the proposal gets vetoed.
* `BurnVoteQuorum` burns the proposal deposit if the proposal deposit if the vote does not reach quorum.
* `BurnProposalDepositPrevote` burns the proposal deposit if it does not enter the voting phase.
* `BurnProposalDepositPrevote` burns the proposal deposit if it does not enter the voting phase.

> Note: These parameters are modifiable via governance.
> Note: These parameters are modifiable via governance.
## State

Expand All @@ -253,12 +255,12 @@ There are three parameters that define if the deposit of a proposal should be bu
Since this is more of a social feature than a technical feature, we'll now get into some items that may have been useful to have in a genesis constitution:

* What limitations on governance exist, if any?
* is it okay for the community to slash the wallet of a whale that they no longer feel that they want around? (viz: Juno Proposal 4 and 16)
* can governance "socially slash" a validator who is using unapproved MEV? (viz: commonwealth.im/osmosis)
* In the event of an economic emergency, what should validators do?
* Terra crash of May, 2022, saw validators choose to run a new binary with code that had not been approved by governance, because the governance token had been inflated to nothing.
* is it okay for the community to slash the wallet of a whale that they no longer feel that they want around? (viz: Juno Proposal 4 and 16)
* can governance "socially slash" a validator who is using unapproved MEV? (viz: commonwealth.im/osmosis)
* In the event of an economic emergency, what should validators do?
* Terra crash of May, 2022, saw validators choose to run a new binary with code that had not been approved by governance, because the governance token had been inflated to nothing.
* What is the purpose of the chain, specifically?
* best example of this is the Cosmos hub, where different founding groups, have different interpertations of the purpose of the network.
* best example of this is the Cosmos hub, where different founding groups, have different interpertations of the purpose of the network.

This genesis entry, "constitution" hasn't been designed for existing chains, who should likely just ratify a constitution using their governance system. Instead, this is for new chains. It will allow for validators to have a much clearer idea of purpose and the expecations placed on them while operating thier nodes. Likewise, for community members, the constitution will give them some idea of what to expect from both the "chain team" and the validators, respectively.

Expand Down Expand Up @@ -358,13 +360,7 @@ const (
VoteNo = 0x2
VoteNoWithVeto = 0x3
VoteAbstain = 0x4
)

type ProposalType string

const (
ProposalTypePlainText = "Text"
ProposalTypeSoftwareUpgrade = "SoftwareUpgrade"
VoteSpam = 0x5
)

type ProposalStatus byte
Expand Down Expand Up @@ -527,7 +523,7 @@ The `initialDeposit` must be strictly positive and conform to the accepted denom
* Initialise `Proposal`'s attributes
* Decrease balance of sender by `InitialDeposit`
* If `MinDeposit` is reached:
* Push `proposalID` in `ProposalProcessingQueue`
* Push `proposalID` in `ProposalProcessingQueue`
* Transfer `InitialDeposit` from the `Proposer` to the governance `ModuleAccount`

### Deposit
Expand All @@ -551,7 +547,7 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/gov/v1/tx.pro
* Add `deposit` of sender in `proposal.Deposits`
* Increase `proposal.TotalDeposit` by sender's `deposit`
* If `MinDeposit` is reached:
* Push `proposalID` in `ProposalProcessingQueueEnd`
* Push `proposalID` in `ProposalProcessingQueueEnd`
* Transfer `Deposit` from the `proposer` to the governance `ModuleAccount`

### Vote
Expand Down Expand Up @@ -654,7 +650,6 @@ The governance module contains the following parameters:
| burn_vote_veto | bool | true |
| min_initial_deposit_ratio | string | "0.1" |


**NOTE**: The governance module contains parameters that are objects unlike other
modules. If only a subset of parameters are desired to be changed, only they need
to be included and not the entire parameter object structure.
Expand Down
5 changes: 4 additions & 1 deletion x/gov/migrations/v6/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ func MigrateStore(ctx sdk.Context, proposalCollection collections.Map[uint64, v1
} else {
proposal.ProposalType = v1.ProposalType_PROPOSAL_TYPE_STANDARD
}
proposalCollection.Set(ctx, key, proposal)

if err := proposalCollection.Set(ctx, key, proposal); err != nil {
return false, err
}

return false, nil
}); err != nil {
Expand Down
Loading

0 comments on commit 7eed169

Please sign in to comment.