Merge branch 'master' into gov_split_vote_weighted_vote

This commit is contained in:
Sunny Aggarwal 2021-01-13 13:16:44 -05:00 committed by GitHub
commit ba96bbebdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 73 additions and 151 deletions

View File

@ -1,64 +0,0 @@
version: 2.1
executors:
docs:
docker:
- image: tendermintdev/docker-website-deployment
environment:
AWS_REGION: us-east-1
commands:
make:
parameters:
description:
type: string
target:
type: string
steps:
- attach_workspace:
at: /tmp/workspace
- restore_cache:
name: "Restore source code cache"
keys:
- go-src-v1-{{ .Revision }}
- checkout
- restore_cache:
name: "Restore go modules cache"
keys:
- go-mod-v2-{{ checksum "go.sum" }}
- run:
name: << parameters.description >>
command: |
make << parameters.target >>
jobs:
build-docs:
executor: docs
steps:
- checkout
- run:
name: "Build docs"
command: make build-docs LEDGER_ENABLED=false
- run:
name: "Upload docs to S3"
command: make sync-docs LEDGER_ENABLED=false
workflows:
version: 2
test-suite:
jobs:
- build-docs:
context: docs-deployment-master
filters:
branches:
only:
- docs-staging
- build-docs:
context: docs-deployment-release
filters:
branches:
only:
- master
tags:
only:
- /v.*/

31
.github/workflows/docs.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Documentation
# This job builds and deploys documenation to github pages.
# It runs on every push to master.
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
container:
image: tendermintdev/docker-website-deployment
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2.3.1
with:
persist-credentials: false
fetch-depth: 0
- name: Install and Build 🔧
run: |
apk add rsync
make build-docs LEDGER_ENABLED=false
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: ~/output

View File

@ -36,6 +36,10 @@ Ref: https://keepachangelog.com/en/1.0.0/
## [Unreleased] ## [Unreleased]
### Improvements
* (tendermint) [\#8316](https://github.com/cosmos/cosmos-sdk/pull/8316) Bump Tendermint version to [v0.34.2](https://github.com/tendermint/tendermint/releases/tag/v0.34.2)
### Bug Fixes ### Bug Fixes
* (x/auth) [\#8287](https://github.com/cosmos/cosmos-sdk/pull/8287) Fix `tx sign --signature-only` to return correct sequence value in signature. * (x/auth) [\#8287](https://github.com/cosmos/cosmos-sdk/pull/8287) Fix `tx sign --signature-only` to return correct sequence value in signature.

View File

@ -201,14 +201,7 @@ build-docs:
cp -r .vuepress/dist/* ~/output/$${path_prefix}/ ; \ cp -r .vuepress/dist/* ~/output/$${path_prefix}/ ; \
cp ~/output/$${path_prefix}/index.html ~/output ; \ cp ~/output/$${path_prefix}/index.html ~/output ; \
done < versions ; done < versions ;
.PHONY: build-docs
sync-docs:
cd ~/output && \
echo "role_arn = ${DEPLOYMENT_ROLE_ARN}" >> /root/.aws/config ; \
echo "CI job = ${CIRCLE_BUILD_URL}" >> version.html ; \
aws s3 sync . s3://${WEBSITE_BUCKET} --profile terraform --delete ; \
aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --profile terraform --path "/*" ;
.PHONY: sync-docs
############################################################################### ###############################################################################
### Tests & Simulation ### ### Tests & Simulation ###

View File

@ -87,7 +87,7 @@ software and restore to their latest snapshot before restarting their nodes.
1) If your chain is using IBC, make sure to add IBC initial genesis state to the genesis file. You can use the following command to add IBC initial genesis state to the genesis file. 1) If your chain is using IBC, make sure to add IBC initial genesis state to the genesis file. You can use the following command to add IBC initial genesis state to the genesis file.
```shell ```shell
cat new_040_genesis.json | jq '.app_state |= . + {"ibc":{"client_genesis":{"clients":[],"clients_consensus":[],"create_localhost":false},"connection_genesis":{"connections":[],"client_connection_paths":[]},"channel_genesis":{"channels":[],"acknowledgements":[],"commitments":[],"receipts":[],"send_sequences":[],"recv_sequences":[],"ack_sequences":[]}},"transfer":{"port_id":"transfer","denom_traces":[],"params":{"send_enabled":false,"receive_enabled":false}},"capability":{"index":"1","owners":[]}}' > new_040_genesis.json cat new_v040_genesis.json | jq '.app_state |= . + {"ibc":{"client_genesis":{"clients":[],"clients_consensus":[],"create_localhost":false},"connection_genesis":{"connections":[],"client_connection_paths":[]},"channel_genesis":{"channels":[],"acknowledgements":[],"commitments":[],"receipts":[],"send_sequences":[],"recv_sequences":[],"ack_sequences":[]}},"transfer":{"port_id":"transfer","denom_traces":[],"params":{"send_enabled":false,"receive_enabled":false}},"capability":{"index":"1","owners":[]}}' > new_v040_genesis.json
``` ```
**Note:** This would add IBC state with IBC's `send_enabled: false` and `receive_enabled: false`. Make sure to update them to `true` in the above command if are planning to enable IBC transactions with chain upgrade. Otherwise you can do it via a governance proposal. **Note:** This would add IBC state with IBC's `send_enabled: false` and `receive_enabled: false`. Make sure to update them to `true` in the above command if are planning to enable IBC transactions with chain upgrade. Otherwise you can do it via a governance proposal.

View File

@ -12,3 +12,4 @@ This folder contains documentation on how to run a node and interact with it.
1. [Running a Node](./run-node.md) 1. [Running a Node](./run-node.md)
1. [Interacting with a Node](./interact-node.md) 1. [Interacting with a Node](./interact-node.md)
1. [Generating, Signing and Broadcasting Transactions](./txs.md) 1. [Generating, Signing and Broadcasting Transactions](./txs.md)
1. [Cosmos Upgrade Manager](./cosmovisor.md)

View File

@ -7,4 +7,3 @@ parent:
- [Modules](../../x/README.md) - [Modules](../../x/README.md)
- [Simulation](./simulation.md) - [Simulation](./simulation.md)
- [Cosmos Upgrade Manager](./cosmovisor.md)

2
go.mod
View File

@ -46,7 +46,7 @@ require (
github.com/tendermint/btcd v0.1.1 github.com/tendermint/btcd v0.1.1
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
github.com/tendermint/go-amino v0.16.0 github.com/tendermint/go-amino v0.16.0
github.com/tendermint/tendermint v0.34.1 github.com/tendermint/tendermint v0.34.2
github.com/tendermint/tm-db v0.6.3 github.com/tendermint/tm-db v0.6.3
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 // indirect golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 // indirect

4
go.sum
View File

@ -562,8 +562,8 @@ github.com/tendermint/tendermint v0.34.0-rc4/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxm
github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg= github.com/tendermint/tendermint v0.34.0-rc6/go.mod h1:ugzyZO5foutZImv0Iyx/gOFCX6mjJTgbLHTwi17VDVg=
github.com/tendermint/tendermint v0.34.0 h1:eXCfMgoqVSzrjzOj6clI9GAejcHH0LvOlRjpCmMJksU= github.com/tendermint/tendermint v0.34.0 h1:eXCfMgoqVSzrjzOj6clI9GAejcHH0LvOlRjpCmMJksU=
github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= github.com/tendermint/tendermint v0.34.0/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ=
github.com/tendermint/tendermint v0.34.1 h1:TsJXY8+1NThc/XIENMv1ENzazriHBJJjeP6hN3kpC8g= github.com/tendermint/tendermint v0.34.2 h1:bB4xReGw4jalTDeNg0npYoONuZrD55F90LrWPF4m/PQ=
github.com/tendermint/tendermint v0.34.1/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ= github.com/tendermint/tendermint v0.34.2/go.mod h1:Aj3PIipBFSNO21r+Lq3TtzQ+uKESxkbA3yo/INM4QwQ=
github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI= github.com/tendermint/tm-db v0.6.2/go.mod h1:GYtQ67SUvATOcoY8/+x6ylk8Qo02BQyLrAs+yAcLvGI=
github.com/tendermint/tm-db v0.6.3 h1:ZkhQcKnB8/2jr5EaZwGndN4owkPsGezW2fSisS9zGbg= github.com/tendermint/tm-db v0.6.3 h1:ZkhQcKnB8/2jr5EaZwGndN4owkPsGezW2fSisS9zGbg=
github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8= github.com/tendermint/tm-db v0.6.3/go.mod h1:lfA1dL9/Y/Y8wwyPp2NMLyn5P5Ptr/gvDFNWtrCWSf8=

View File

@ -29,18 +29,24 @@ its unique `proposalID`.
### Proposal types ### Proposal types
In the initial version of the governance module, there are two types of In the initial version of the governance module, there are five types of
proposal: proposals:
- `PlainTextProposal` All the proposals that do not involve a modification of - `TextProposal` All the proposals that do not involve a modification of
the source code go under this type. For example, an opinion poll would use a the source code go under this type. For example, an opinion poll would use a
proposal of type `PlainTextProposal`. proposal of type `TextProposal`.
- `SoftwareUpgradeProposal`. If accepted, validators are expected to update - `SoftwareUpgradeProposal`. If accepted, validators are expected to update
their software in accordance with the proposal. They must do so by following their software in accordance with the proposal. They must do so by following
a 2-steps process described in the [Software Upgrade](#software-upgrade) a 2-steps process described in the [Software Upgrade](#software-upgrade)
section below. Software upgrade roadmap may be discussed and agreed on via section below. Software upgrade roadmap may be discussed and agreed on via
`PlainTextProposals`, but actual software upgrades must be performed via `TextProposals`, but actual software upgrades must be performed via
`SoftwareUpgradeProposals`. `SoftwareUpgradeProposals`.
- `CommunityPoolSpendProposal` details a proposal for use of community funds,
together with how many coins are proposed to be spent, and to which recipient account.
- `ParameterChangeProposal` defines a proposal to change one or
more parameters. If accepted, the requested parameter change is updated
automatically by the proposal handler upon conclusion of the voting period.
- `CancelSoftwareUpgradeProposal` is a gov Content type for cancelling a software upgrade.
Other modules may expand upon the governance module by implementing their own Other modules may expand upon the governance module by implementing their own
proposal types and handlers. These types are registered and processed through the proposal types and handlers. These types are registered and processed through the

View File

@ -11,26 +11,14 @@ be one active parameter set at any given time. If governance wants to change a
parameter set, either to modify a value or add/remove a parameter field, a new parameter set, either to modify a value or add/remove a parameter field, a new
parameter set has to be created and the previous one rendered inactive. parameter set has to be created and the previous one rendered inactive.
```go ### DepositParams
type DepositParams struct { +++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/gov/v1beta1/gov.proto#L127-L145
MinDeposit sdk.Coins // Minimum deposit for a proposal to enter voting period.
MaxDepositPeriod time.Time // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
}
```
```go ### VotingParams
type VotingParams struct { +++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/gov/v1beta1/gov.proto#L147-L156
VotingPeriod time.Time // Length of the voting period. Initial value: 2 weeks
}
```
```go ### TallyParams
type TallyParams struct { +++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/gov/v1beta1/gov.proto#L158-L183
Quorum sdk.Dec // Minimum percentage of stake that needs to vote for a proposal to be considered valid
Threshold sdk.Dec // Minimum proportion of Yes votes for proposal to pass. Initial value: 0.5
Veto sdk.Dec // Minimum proportion of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
}
```
Parameters are stored in a global `GlobalParams` KVStore. Parameters are stored in a global `GlobalParams` KVStore.
@ -68,12 +56,7 @@ const (
## Deposit ## Deposit
```go +++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/gov/v1beta1/gov.proto#L43-L53
type Deposit struct {
Amount sdk.Coins // Amount of coins deposited by depositor
Depositor crypto.address // Address of depositor
}
```
## ValidatorGovInfo ## ValidatorGovInfo
@ -92,22 +75,7 @@ This type is used in a temp map when tallying
what this proposal is about, and other fields, which are the mutable state of what this proposal is about, and other fields, which are the mutable state of
the governance process. the governance process.
```go +++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/gov/v1beta1/gov.proto#L55-L77
type Proposal struct {
Content // Proposal content interface
ProposalID uint64
Status ProposalStatus // Status of the Proposal {Pending, Active, Passed, Rejected}
FinalTallyResult TallyResult // Result of Tallies
SubmitTime time.Time // Time of the block where TxGovSubmitProposal was included
DepositEndTime time.Time // Time that the Proposal would expire if deposit amount isn't met
TotalDeposit sdk.Coins // Current deposit on this proposal. Initial value is set at InitialDeposit
VotingStartTime time.Time // Time of the block where MinDeposit was reached. -1 if MinDeposit is not reached
VotingEndTime time.Time // Time that the VotingPeriod for this proposal will end and votes will be tallied
}
```
```go ```go
type Content interface { type Content interface {

View File

@ -6,18 +6,12 @@ order: 3
## Proposal Submission ## Proposal Submission
Proposals can be submitted by any Atom holder via a `TxGovSubmitProposal` Proposals can be submitted by any account via a `MsgSubmitProposal`
transaction. transaction.
```go +++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/gov/v1beta1/tx.proto#L24-L39
type TxGovSubmitProposal struct {
Content Content
InitialDeposit sdk.Coins
Proposer sdk.AccAddress
}
```
The `Content` of a `TxGovSubmitProposal` message must have an appropriate router The `Content` of a `MsgSubmitProposal` message must have an appropriate router
set in the governance module. set in the governance module.
**State modifications:** **State modifications:**
@ -30,12 +24,12 @@ set in the governance module.
- Push `proposalID` in `ProposalProcessingQueue` - Push `proposalID` in `ProposalProcessingQueue`
- Transfer `InitialDeposit` from the `Proposer` to the governance `ModuleAccount` - Transfer `InitialDeposit` from the `Proposer` to the governance `ModuleAccount`
A `TxGovSubmitProposal` transaction can be handled according to the following A `MsgSubmitProposal` transaction can be handled according to the following
pseudocode. pseudocode.
```go ```go
// PSEUDOCODE // // PSEUDOCODE //
// Check if TxGovSubmitProposal is valid. If it is, create proposal // // Check if MsgSubmitProposal is valid. If it is, create proposal //
upon receiving txGovSubmitProposal from sender do upon receiving txGovSubmitProposal from sender do
@ -79,14 +73,9 @@ upon receiving txGovSubmitProposal from sender do
Once a proposal is submitted, if Once a proposal is submitted, if
`Proposal.TotalDeposit < ActiveParam.MinDeposit`, Atom holders can send `Proposal.TotalDeposit < ActiveParam.MinDeposit`, Atom holders can send
`TxGovDeposit` transactions to increase the proposal's deposit. `MsgDeposit` transactions to increase the proposal's deposit.
```go +++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/gov/v1beta1/tx.proto#L61-L72
type TxGovDeposit struct {
ProposalID int64 // ID of the proposal
Deposit sdk.Coins // Number of Atoms to add to the proposal's deposit
}
```
**State modifications:** **State modifications:**
@ -97,12 +86,12 @@ type TxGovDeposit struct {
- Push `proposalID` in `ProposalProcessingQueueEnd` - Push `proposalID` in `ProposalProcessingQueueEnd`
- Transfer `Deposit` from the `proposer` to the governance `ModuleAccount` - Transfer `Deposit` from the `proposer` to the governance `ModuleAccount`
A `TxGovDeposit` transaction has to go through a number of checks to be valid. A `MsgDeposit` transaction has to go through a number of checks to be valid.
These checks are outlined in the following pseudocode. These checks are outlined in the following pseudocode.
```go ```go
// PSEUDOCODE // // PSEUDOCODE //
// Check if TxGovDeposit is valid. If it is, increase deposit and check if MinDeposit is reached // Check if MsgDeposit is valid. If it is, increase deposit and check if MinDeposit is reached
upon receiving txGovDeposit from sender do upon receiving txGovDeposit from sender do
// check if proposal is correctly formatted. Includes fee payment. // check if proposal is correctly formatted. Includes fee payment.
@ -149,15 +138,10 @@ upon receiving txGovDeposit from sender do
## Vote ## Vote
Once `ActiveParam.MinDeposit` is reached, voting period starts. From there, Once `ActiveParam.MinDeposit` is reached, voting period starts. From there,
bonded Atom holders are able to send `TxGovVote` transactions to cast their bonded Atom holders are able to send `MsgVote` transactions to cast their
vote on the proposal. vote on the proposal.
```go +++ https://github.com/cosmos/cosmos-sdk/blob/v0.40.0/proto/cosmos/gov/v1beta1/tx.proto#L46-L56
type TxGovVote struct {
ProposalID int64 // proposalID of the proposal
Vote byte // option from OptionSet chosen by the voter
}
```
**State modifications:** **State modifications:**
@ -165,12 +149,12 @@ vote on the proposal.
_Note: Gas cost for this message has to take into account the future tallying of the vote in EndBlocker_ _Note: Gas cost for this message has to take into account the future tallying of the vote in EndBlocker_
Next is a pseudocode proposal of the way `TxGovVote` transactions are Next is a pseudocode outline of the way `MsgVote` transactions are
handled: handled:
```go ```go
// PSEUDOCODE // // PSEUDOCODE //
// Check if TxGovVote is valid. If it is, count vote// // Check if MsgVote is valid. If it is, count vote//
upon receiving txGovVote from sender do upon receiving txGovVote from sender do
// check if proposal is correctly formatted. Includes fee payment. // check if proposal is correctly formatted. Includes fee payment.