Governance
Fluid's Governance module inherits from Cosmos SDK's gov module. This document is a stub, and covers mainly important Fluid-specific notes about how it is used.
Governance is the process through which members of the Fluid community can effect change on the protocol by submitting petitions known as "proposals" and arriving at a popular consensus when a threshold amount of support has been reached. The proposal structure is versatile and allows for holders of staked Luna (those who have an interest in the long-term viability of the network) to voice their opinion on both blockchain parameter updates as well as the future development of the Fluid protocol.
Check the Governance section of the Terrad Reference to see examples of how to participate in the Governance process.
To learn how to vote with your staked Luna or submit proposals, visit the Fluid Station governance guide.
Concepts
The following is the governance proposal procedure:
Deposit Period
After a proposal is submitted, it enters the deposit period, where it must reach a total minimum deposit of 512 Luna within 7 days from the time of its submission. The deposit threshold is reached when the sum of the initial deposit (from the proposer) and the deposits from all other interested network participants meet or exceed 512 Luna.
Deposits protect against unnecessary proposals and spam.
Deposits get refunded if all of the following conditions are met:
- The minimum deposit of 512 Luna is reached within the 7-day deposit period.
Quorumis met: the number of total votes is greater than 10% of all staked Luna- The total number of
NoWithVetovotes is less than 33.4% of the total vote. - A vote returns a majority of
YesorNovotes.
Deposits are burned under any of the following conditions:
- The minimum deposit of 512 Luna is not reached within the one-week deposit period.
Quorumis not met: the number of total votes after the one-week voting period is less than 10% of all staked Luna.- the number of
NoWithVetovotes is above 33.4% of the total vote.
Voting Period
If the minimum deposit has been reached before the end of the deposit period, then the proposal goes into a one-week voting period. While the proposal is in voting, holders of staked Luna can cast votes for the proposal. The 4 voting options available are:
Yes- in favorNo- not in favorNoWithVeto- vetoAbstain- does not influence vote
Voting is done by holders of bonded LUNA on a 1 bonded LUNA = 1 vote basis. As such, validators hold the most influence over the outcome of voting, and delegators by default inherit the vote of their validator if they don't vote.
Tallying
For a proposal to pass, the following conditions must be met:
-
Voter participation must be at least
quorum: -
The ratio of
NoWithVetovotes must be less thanveto: -
The ratio of
Yesvotes must be greater thanthreshold:
If any of the previous conditions are not met, the proposal is rejected. Proposals that get rejected with veto do not get their deposits refunded. The parameters quorum, veto, and threshold exist as blockchain parameters within the Governance module.
Deposits will not be refunded for proposals that are rejected with veto, do not meet quorum, or fail to reach the minimum deposit during the deposit period. Non-refunded deposits are burned.
Proposal Implementation
Once a governance proposal passes, the changes described are put into effect by the proposal handler. Generic proposals such as a TextProposal must be reviewed by Fluid protocol developers and the community for decisions on how to manually implement.
Although parameter changes get updated immediately, they generally are not put into effect until the next epoch operation. Epochs occur every 100800 blocks or roughly every 7.7 days, given a 6.6-second block time.
Data
Proposal
_14type Proposal struct {_14 Content `json:"content" yaml:"content"` // Proposal content interface_14_14 ProposalID uint64 `json:"id" yaml:"id"` // ID of the proposal_14 Status ProposalStatus `json:"proposal_status" yaml:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}_14 FinalTallyResult TallyResult `json:"final_tally_result" yaml:"final_tally_result"` // Result of Tallys_14_14 SubmitTime time.Time `json:"submit_time" yaml:"submit_time"` // Time of the block where TxGovSubmitProposal was included_14 DepositEndTime time.Time `json:"deposit_end_time" yaml:"deposit_end_time"` // Time that the Proposal would expire if deposit amount isn't met_14 TotalDeposit sdk.Coins `json:"total_deposit" yaml:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit_14_14 VotingStartTime time.Time `json:"voting_start_time" yaml:"voting_start_time"` // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached_14 VotingEndTime time.Time `json:"voting_end_time" yaml:"voting_end_time"` // Time that the VotingPeriod for this proposal will end and votes will be tallied_14}
A Proposal is a data structure representing a petition for a change that is submitted to the blockchain alongside a deposit. Once its deposit reaches a certain MinDeposit, the proposal is confirmed and voting opens. Bonded Luna holders can then send TxGovVote transactions to vote on the proposal. Fluid currently follows a simple voting scheme of 1 Bonded Luna = 1 Vote.
The Content of a proposal is the interface that contains the information about the Proposal, such as the title, description, and any notable changes. A Content type can be implemented by any module. The ProposalRoute of the Content returns a string which must be used to route the handler of the Content in the Governance keeper. This process allows the governance keeper to execute proposal logic implemented by any module. If a proposal passes, the handler is executed. Only if the handler is successful does the state get persisted and the proposal finally passes. Otherwise, the proposal is rejected.
Message Types
MsgSubmitProposal
_5type MsgSubmitProposal struct {_5 Content Content `json:"content" yaml:"content"`_5 InitialDeposit sdk.Coins `json:"initial_deposit" yaml:"initial_deposit"` // Initial deposit paid by sender. Must be strictly positive_5 Proposer sdk.AccAddress `json:"proposer" yaml:"proposer"` // Address of the proposer_5}
MsgDeposit
_5type MsgDeposit struct {_5 ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal_5 Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor_5 Amount sdk.Coins `json:"amount" yaml:"amount"` // Coins to add to the proposal's deposit_5}
MsgVote
_5type MsgVote struct {_5 ProposalID uint64 `json:"proposal_id" yaml:"proposal_id"` // ID of the proposal_5 Voter sdk.AccAddress `json:"voter" yaml:"voter"` // address of the voter_5 Option VoteOption `json:"option" yaml:"option"` // option from OptionSet chosen by the voter_5}
Proposals
Text Proposal
_4type TextProposal struct {_4 Title string `json:"title" yaml:"title"`_4 Description string `json:"description" yaml:"description"`_4}
Text Proposals are used to create general-purpose petitions, such as asking core developers or community members to implement a specific feature. The community can reference a passed Text Proposal to the core developers or community members to indicate that a feature that potentially requires a soft or hard fork is in significant demand.
Parameter Change Proposals
_12type ParameterChangeProposal struct {_12 Title string `json:"title" yaml:"title"`_12 Description string `json:"description" yaml:"description"`_12 Changes []ParamChange `json:"changes" yaml:"changes"`_12}_12_12type ParamChange struct {_12 Subspace string `json:"subspace" yaml:"subspace"`_12 Key string `json:"key" yaml:"key"`_12 Subkey string `json:"subkey,omitempty" yaml:"subkey,omitempty"`_12 Value string `json:"value" yaml:"value"`_12}
Parameter Change Proposals are a special type of proposal which, once passed, will automatically go into effect by directly altering the network's specified parameter.
Software Upgrade Proposals
This type of proposal requires validators to update their node software to a new version at a specified block height.
Software upgrade proposals can be difficult to execute. Exercise caution when using this proposal type, as you may lose your deposit due to an incorrect proposal.
Transitions
End-Block
This section was taken from the official Cosmos SDK docs and placed here for your convenience to understand the Governance process.
ProposalProcessingQueue is a queue (queue[proposalID]) containing all the ProposalIDs of proposals that reach MinDeposit. At the end of each block, all the proposals that have reached the end of their voting period are processed. To process a finished proposal, the application tallies the votes, computes the votes of each validator, and checks if every validator in the validator set has voted. If the proposal is accepted, deposits are refunded. Finally, the proposal content Handler is executed.
_52for finishedProposalID in GetAllFinishedProposalIDs(block.Time)_52 proposal = load(Governance, <proposalID|'proposal'>) // proposal is a const key_52_52 validators = Keeper.getAllValidators()_52 tmpValMap := map(sdk.AccAddress)ValidatorGovInfo_52_52 // Initiate mapping at 0. This is the amount of shares of the validator's vote that will be overridden by their delegator's votes_52 for each validator in validators_52 tmpValMap(validator.OperatorAddr).Minus = 0_52_52 // Tally_52 voterIterator = rangeQuery(Governance, <proposalID|'addresses'>) //return all the addresses that voted on the proposal_52 for each (voterAddress, vote) in voterIterator_52 delegations = stakingKeeper.getDelegations(voterAddress) // get all delegations for current voter_52_52 for each delegation in delegations_52 // make sure delegation.Shares does NOT include shares being unbonded_52 tmpValMap(delegation.ValidatorAddr).Minus += delegation.Shares_52 proposal.updateTally(vote, delegation.Shares)_52_52 _, isVal = stakingKeeper.getValidator(voterAddress)_52 if (isVal)_52 tmpValMap(voterAddress).Vote = vote_52_52 tallyingParam = load(GlobalParams, 'TallyingParam')_52_52 // Update tally if validator voted they voted_52 for each validator in validators_52 if tmpValMap(validator).HasVoted_52 proposal.updateTally(tmpValMap(validator).Vote, (validator.TotalShares - tmpValMap(validator).Minus))_52_52 // Check if proposal is accepted or rejected_52 totalNonAbstain := proposal.YesVotes + proposal.NoVotes + proposal.NoWithVetoVotes_52 if (proposal.Votes.YesVotes/totalNonAbstain > tallyingParam.Threshold AND proposal.Votes.NoWithVetoVotes/totalNonAbstain < tallyingParam.Veto)_52 // proposal was accepted at the end of the voting period_52 // refund deposits (non-voters already punished)_52 for each (amount, depositor) in proposal.Deposits_52 depositor.AtomBalance += amount_52_52 stateWriter, err := proposal.Handler()_52 if err != nil_52 // proposal passed but failed during state execution_52 proposal.CurrentStatus = ProposalStatusFailed_52 else_52 // proposal pass and state is persisted_52 proposal.CurrentStatus = ProposalStatusAccepted_52 stateWriter.save()_52 else_52 // proposal was rejected_52 proposal.CurrentStatus = ProposalStatusRejected_52_52 store(Governance, <proposalID|'proposal'>, proposal)
Parameters
The subspace for the Governance module is gov.
_14type DepositParams struct {_14 MinDeposit sdk.Coins `json:"min_deposit,omitempty" yaml:"min_deposit,omitempty"`_14 MaxDepositPeriod time.Duration `json:"max_deposit_period,omitempty" yaml:"max_deposit_period,omitempty"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months_14}_14_14type TallyParams struct {_14 Quorum sdk.Dec `json:"quorum,omitempty" yaml:"quorum,omitempty"`_14 Threshold sdk.Dec `json:"threshold,omitempty" yaml:"threshold,omitempty"`_14 Veto sdk.Dec `json:"veto,omitempty" yaml:"veto,omitempty"`_14}_14_14type VotingParams struct {_14 VotingPeriod time.Duration `json:"voting_period,omitempty" yaml:"voting_period,omitempty"`_14}
Genesis parameters
The genesis parameters for the governance module outlined in the Genesis Builder Script are as follows:
_20 # Gov: change min deposit to 512 LUNA and deposit period to 7 days_20 genesis['app_state']['gov']['deposit_params'] = {_20 'max_deposit_period': '604800s', # 7days_20 'min_deposit': [{_20 'denom': DENOM_LUNA,_20 'amount': '512000000'_20 }],_20 }_20_20 # Gov: set tally params quorum to 10%_20 genesis['app_state']['gov']['tally_params'] = {_20 'quorum': '0.100000000000000000',_20 'threshold': '0.500000000000000000',_20 'veto_threshold': '0.334000000000000000'_20 }_20_20 # Gov: set voting period to 7 days_20 genesis['app_state']['gov']['voting_params'] = {_20 'voting_period': '604800s'_20 }
MinDeposit
- type:
Coins - denom:
uluna - amount:
512000000
The minimum deposit amount for a proposal to enter a voting period. Currently 512 Luna.
MaxDepositPeriod
- type:
time.Duration(seconds) "max_deposit_period": "604800s"
Maximum period for Luna holders to deposit on a proposal. Currently 1 week.
Quorum
- type:
Dec "quorum": "0.100000000000000000",
Minimum percentage of total stake needed to vote for a result to be considered valid.
Threshold
- type:
Dec - default value: 50%
Minimum proportion of Yes votes for a proposal to pass.
Veto
- type:
Dec - default value:
0.33
Minimum value of Veto votes to Total votes ratio for proposal to be vetoed.
VotingPeriod
- type:
time.Duration(seconds) "voting_period": "604800s"
Length of the voting period. Currently 1 week.