Merge branch 'develop' into rigel/minor
This commit is contained in:
commit
32f1576e82
55
PENDING.md
55
PENDING.md
|
@ -8,32 +8,33 @@ BREAKING CHANGES
|
||||||
* Gaia CLI (`gaiacli`)
|
* Gaia CLI (`gaiacli`)
|
||||||
* [x/stake] Validator.Owner renamed to Validator.Operator
|
* [x/stake] Validator.Owner renamed to Validator.Operator
|
||||||
* [cli] unsafe_reset_all, show_validator, and show_node_id have been renamed to unsafe-reset-all, show-validator, and show-node-id
|
* [cli] unsafe_reset_all, show_validator, and show_node_id have been renamed to unsafe-reset-all, show-validator, and show-node-id
|
||||||
* [cli] \#1983 --print-response now defaults to true in commands that create and send a transaction
|
* [cli] [\#1983](https://github.com/cosmos/cosmos-sdk/issues/1983) --print-response now defaults to true in commands that create and send a transaction
|
||||||
* [cli] \#1983 you can now pass --pubkey or --address to gaiacli keys show to return a plaintext representation of the key's address or public key for use with other commands
|
* [cli] [\#1983](https://github.com/cosmos/cosmos-sdk/issues/1983) you can now pass --pubkey or --address to gaiacli keys show to return a plaintext representation of the key's address or public key for use with other commands
|
||||||
* [cli] \#2061 changed proposalID in governance REST endpoints to proposal-id
|
* [cli] [\#2061](https://github.com/cosmos/cosmos-sdk/issues/2061) changed proposalID in governance REST endpoints to proposal-id
|
||||||
* [cli] \#2014 `gaiacli advanced` no longer exists - to access `ibc`, `rest-server`, and `validator-set` commands use `gaiacli ibc`, `gaiacli rest-server`, and `gaiacli tendermint`, respectively
|
* [cli] [\#2014](https://github.com/cosmos/cosmos-sdk/issues/2014) `gaiacli advanced` no longer exists - to access `ibc`, `rest-server`, and `validator-set` commands use `gaiacli ibc`, `gaiacli rest-server`, and `gaiacli tendermint`, respectively
|
||||||
* [makefile] `get_vendor_deps` no longer updates lock file it just updates vendor directory. Use `update_vendor_deps` to update the lock file. [#2152](https://github.com/cosmos/cosmos-sdk/pull/2152)
|
* [makefile] `get_vendor_deps` no longer updates lock file it just updates vendor directory. Use `update_vendor_deps` to update the lock file. [#2152](https://github.com/cosmos/cosmos-sdk/pull/2152)
|
||||||
* [cli] \#2190 `gaiacli init --gen-txs` is now `gaiacli init --with-txs` to reduce confusion
|
* [cli] [\#2190](https://github.com/cosmos/cosmos-sdk/issues/2190) `gaiacli init --gen-txs` is now `gaiacli init --with-txs` to reduce confusion
|
||||||
* \#2040 All commands that utilize a validator's address must now use the new
|
* [\#2040](https://github.com/cosmos/cosmos-sdk/issues/2040) All commands that utilize a validator's address must now use the new
|
||||||
bech32 prefix, `cosmosval`. A validator's Tendermint signing key and address
|
bech32 prefix, `cosmosval`. A validator's Tendermint signing key and address
|
||||||
now use a new bech32 prefix, `cosmoscons`.
|
now use a new bech32 prefix, `cosmoscons`.
|
||||||
|
|
||||||
* Gaia
|
* Gaia
|
||||||
* Make the transient store key use a distinct store key. [#2013](https://github.com/cosmos/cosmos-sdk/pull/2013)
|
* Make the transient store key use a distinct store key. [#2013](https://github.com/cosmos/cosmos-sdk/pull/2013)
|
||||||
* [x/stake] \#1901 Validator type's Owner field renamed to Operator; Validator's GetOwner() renamed accordingly to comply with the SDK's Validator interface.
|
* [x/stake] [\#1901](https://github.com/cosmos/cosmos-sdk/issues/1901) Validator type's Owner field renamed to Operator; Validator's GetOwner() renamed accordingly to comply with the SDK's Validator interface.
|
||||||
* [docs] [#2001](https://github.com/cosmos/cosmos-sdk/pull/2001) Update slashing spec for slashing period
|
* [docs] [#2001](https://github.com/cosmos/cosmos-sdk/pull/2001) Update slashing spec for slashing period
|
||||||
* [x/stake, x/slashing] [#1305](https://github.com/cosmos/cosmos-sdk/issues/1305) - Rename "revoked" to "jailed"
|
* [x/stake, x/slashing] [#1305](https://github.com/cosmos/cosmos-sdk/issues/1305) - Rename "revoked" to "jailed"
|
||||||
* [x/stake] [#1676] Revoked and jailed validators put into the unbonding state
|
* [x/stake] [#1676] Revoked and jailed validators put into the unbonding state
|
||||||
* [x/stake] [#1877] Redelegations/unbonding-delegation from unbonding validator have reduced time
|
* [x/stake] [#1877] Redelegations/unbonding-delegation from unbonding validator have reduced time
|
||||||
* [x/stake] \#2040 Validator operator type has now changed to `sdk.ValAddress`
|
* [x/stake] [\#2040](https://github.com/cosmos/cosmos-sdk/issues/2040) Validator operator type has now changed to `sdk.ValAddress`
|
||||||
* A new bech32 prefix has been introduced for Tendermint signing keys and
|
* A new bech32 prefix has been introduced for Tendermint signing keys and
|
||||||
addresses, `cosmosconspub` and `cosmoscons` respectively.
|
addresses, `cosmosconspub` and `cosmoscons` respectively.
|
||||||
|
* [x/gov] \#2195 Made governance use BFT Time instead of Block Heights for deposit and voting periods.
|
||||||
|
|
||||||
* SDK
|
* SDK
|
||||||
* [core] \#1807 Switch from use of rational to decimal
|
* [core] [\#1807](https://github.com/cosmos/cosmos-sdk/issues/1807) Switch from use of rational to decimal
|
||||||
* [types] \#1901 Validator interface's GetOwner() renamed to GetOperator()
|
* [types] [\#1901](https://github.com/cosmos/cosmos-sdk/issues/1901) Validator interface's GetOwner() renamed to GetOperator()
|
||||||
* [x/slashing] [#2122](https://github.com/cosmos/cosmos-sdk/pull/2122) - Implement slashing period
|
* [x/slashing] [#2122](https://github.com/cosmos/cosmos-sdk/pull/2122) - Implement slashing period
|
||||||
* [types] \#2119 Parsed error messages and ABCI log errors to make them more human readable.
|
* [types] [\#2119](https://github.com/cosmos/cosmos-sdk/issues/2119) Parsed error messages and ABCI log errors to make them more human readable.
|
||||||
* [simulation] Rename TestAndRunTx to Operation [#2153](https://github.com/cosmos/cosmos-sdk/pull/2153)
|
* [simulation] Rename TestAndRunTx to Operation [#2153](https://github.com/cosmos/cosmos-sdk/pull/2153)
|
||||||
* [tools] Removed gocyclo [#2211](https://github.com/cosmos/cosmos-sdk/issues/2211)
|
* [tools] Removed gocyclo [#2211](https://github.com/cosmos/cosmos-sdk/issues/2211)
|
||||||
* [baseapp] Remove `SetTxDecoder` in favor of requiring the decoder be set in baseapp initialization. [#1441](https://github.com/cosmos/cosmos-sdk/issues/1441)
|
* [baseapp] Remove `SetTxDecoder` in favor of requiring the decoder be set in baseapp initialization. [#1441](https://github.com/cosmos/cosmos-sdk/issues/1441)
|
||||||
|
@ -45,26 +46,26 @@ FEATURES
|
||||||
|
|
||||||
* Gaia REST API (`gaiacli advanced rest-server`)
|
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||||
* [lcd] Endpoints to query staking pool and params
|
* [lcd] Endpoints to query staking pool and params
|
||||||
* [lcd] \#2110 Add support for `simulate=true` requests query argument to endpoints that send txs to run simulations of transactions
|
* [lcd] [\#2110](https://github.com/cosmos/cosmos-sdk/issues/2110) Add support for `simulate=true` requests query argument to endpoints that send txs to run simulations of transactions
|
||||||
* [lcd] \#966 Add support for `generate_only=true` query argument to generate offline unsigned transactions
|
* [lcd] [\#966](https://github.com/cosmos/cosmos-sdk/issues/966) Add support for `generate_only=true` query argument to generate offline unsigned transactions
|
||||||
|
|
||||||
* Gaia CLI (`gaiacli`)
|
* Gaia CLI (`gaiacli`)
|
||||||
* [cli] Cmds to query staking pool and params
|
* [cli] Cmds to query staking pool and params
|
||||||
* [gov][cli] #2062 added `--proposal` flag to `submit-proposal` that allows a JSON file containing a proposal to be passed in
|
* [gov][cli] #2062 added `--proposal` flag to `submit-proposal` that allows a JSON file containing a proposal to be passed in
|
||||||
* \#2040 Add `--bech` to `gaiacli keys show` and respective REST endpoint to
|
* [\#2040](https://github.com/cosmos/cosmos-sdk/issues/2040) Add `--bech` to `gaiacli keys show` and respective REST endpoint to
|
||||||
provide desired Bech32 prefix encoding
|
provide desired Bech32 prefix encoding
|
||||||
* [cli] \#2047 Setting the --gas flag value to 0 triggers a simulation of the tx before the actual execution. The gas estimate obtained via the simulation will be used as gas limit in the actual execution.
|
* [cli] [\#2047](https://github.com/cosmos/cosmos-sdk/issues/2047) Setting the --gas flag value to 0 triggers a simulation of the tx before the actual execution. The gas estimate obtained via the simulation will be used as gas limit in the actual execution.
|
||||||
* [cli] \#2047 The --gas-adjustment flag can be used to adjust the estimate obtained via the simulation triggered by --gas=0.
|
* [cli] [\#2047](https://github.com/cosmos/cosmos-sdk/issues/2047) The --gas-adjustment flag can be used to adjust the estimate obtained via the simulation triggered by --gas=0.
|
||||||
* [cli] \#2110 Add --dry-run flag to perform a simulation of a transaction without broadcasting it. The --gas flag is ignored as gas would be automatically estimated.
|
* [cli] [\#2110](https://github.com/cosmos/cosmos-sdk/issues/2110) Add --dry-run flag to perform a simulation of a transaction without broadcasting it. The --gas flag is ignored as gas would be automatically estimated.
|
||||||
* [cli] \#966 Add --generate-only flag to build an unsigned transaction and write it to STDOUT.
|
* [cli] [\#966](https://github.com/cosmos/cosmos-sdk/issues/966) Add --generate-only flag to build an unsigned transaction and write it to STDOUT.
|
||||||
|
|
||||||
* Gaia
|
* Gaia
|
||||||
* [cli] #2170 added ability to show the node's address via `gaiad tendermint show-address`
|
* [cli] #2170 added ability to show the node's address via `gaiad tendermint show-address`
|
||||||
|
|
||||||
* SDK
|
* SDK
|
||||||
* [querier] added custom querier functionality, so ABCI query requests can be handled by keepers
|
* [querier] added custom querier functionality, so ABCI query requests can be handled by keepers
|
||||||
* [simulation] \#1924 allow operations to specify future operations
|
* [simulation] [\#1924](https://github.com/cosmos/cosmos-sdk/issues/1924) allow operations to specify future operations
|
||||||
* [simulation] \#1924 Add benchmarking capabilities, with makefile commands "test_sim_gaia_benchmark, test_sim_gaia_profile"
|
* [simulation] [\#1924](https://github.com/cosmos/cosmos-sdk/issues/1924) Add benchmarking capabilities, with makefile commands "test_sim_gaia_benchmark, test_sim_gaia_profile"
|
||||||
|
|
||||||
* Tendermint
|
* Tendermint
|
||||||
|
|
||||||
|
@ -74,7 +75,7 @@ IMPROVEMENTS
|
||||||
* [tools] Added ansible script to enable process core dumps
|
* [tools] Added ansible script to enable process core dumps
|
||||||
|
|
||||||
* Gaia REST API (`gaiacli advanced rest-server`)
|
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||||
* [x/stake] \#2000 Added tests for new staking endpoints
|
* [x/stake] [\#2000](https://github.com/cosmos/cosmos-sdk/issues/2000) Added tests for new staking endpoints
|
||||||
|
|
||||||
* Gaia CLI (`gaiacli`)
|
* Gaia CLI (`gaiacli`)
|
||||||
* [cli] #2060 removed `--select` from `block` command
|
* [cli] #2060 removed `--select` from `block` command
|
||||||
|
@ -88,7 +89,7 @@ IMPROVEMENTS
|
||||||
* SDK
|
* SDK
|
||||||
* [tools] Make get_vendor_deps deletes `.vendor-new` directories, in case scratch files are present.
|
* [tools] Make get_vendor_deps deletes `.vendor-new` directories, in case scratch files are present.
|
||||||
* [spec] Added simple piggy bank distribution spec
|
* [spec] Added simple piggy bank distribution spec
|
||||||
* [cli] \#1632 Add integration tests to ensure `basecoind init && basecoind` start sequences run successfully for both `democoin` and `basecoin` examples.
|
* [cli] [\#1632](https://github.com/cosmos/cosmos-sdk/issues/1632) Add integration tests to ensure `basecoind init && basecoind` start sequences run successfully for both `democoin` and `basecoin` examples.
|
||||||
* [store] Speedup IAVL iteration, and consequently everything that requires IAVL iteration. [#2143](https://github.com/cosmos/cosmos-sdk/issues/2143)
|
* [store] Speedup IAVL iteration, and consequently everything that requires IAVL iteration. [#2143](https://github.com/cosmos/cosmos-sdk/issues/2143)
|
||||||
* [store] \#1952 Update IAVL dependency to v0.10.0
|
* [store] \#1952 Update IAVL dependency to v0.10.0
|
||||||
* [simulation] Make timestamps randomized [#2153](https://github.com/cosmos/cosmos-sdk/pull/2153)
|
* [simulation] Make timestamps randomized [#2153](https://github.com/cosmos/cosmos-sdk/pull/2153)
|
||||||
|
@ -100,15 +101,15 @@ BUG FIXES
|
||||||
* Gaia REST API (`gaiacli advanced rest-server`)
|
* Gaia REST API (`gaiacli advanced rest-server`)
|
||||||
|
|
||||||
* Gaia CLI (`gaiacli`)
|
* Gaia CLI (`gaiacli`)
|
||||||
* [cli] \#1997 Handle panics gracefully when `gaiacli stake {delegation,unbond}` fail to unmarshal delegation.
|
* [cli] [\#1997](https://github.com/cosmos/cosmos-sdk/issues/1997) Handle panics gracefully when `gaiacli stake {delegation,unbond}` fail to unmarshal delegation.
|
||||||
|
|
||||||
* Gaia
|
* Gaia
|
||||||
|
|
||||||
* SDK
|
* SDK
|
||||||
* \#1988 Make us compile on OpenBSD (disable ledger) [#1988] (https://github.com/cosmos/cosmos-sdk/issues/1988)
|
* [\#1988](https://github.com/cosmos/cosmos-sdk/issues/1988) Make us compile on OpenBSD (disable ledger) [#1988] (https://github.com/cosmos/cosmos-sdk/issues/1988)
|
||||||
* \#2105 Fix DB Iterator leak, which may leak a go routine.
|
* [\#2105](https://github.com/cosmos/cosmos-sdk/issues/2105) Fix DB Iterator leak, which may leak a go routine.
|
||||||
* [ledger] \#2064 Fix inability to sign and send transactions via the LCD by
|
* [ledger] [\#2064](https://github.com/cosmos/cosmos-sdk/issues/2064) Fix inability to sign and send transactions via the LCD by
|
||||||
loading a Ledger device at runtime.
|
loading a Ledger device at runtime.
|
||||||
* \#2158 Fix non-deterministic ordering of validator iteration when slashing in `gov EndBlocker`
|
* [\#2158](https://github.com/cosmos/cosmos-sdk/issues/2158) Fix non-deterministic ordering of validator iteration when slashing in `gov EndBlocker`
|
||||||
|
|
||||||
* Tendermint
|
* Tendermint
|
||||||
|
|
|
@ -224,9 +224,15 @@ func (kb dbKeybase) Sign(name, passphrase string, msg []byte) (sig []byte, pub t
|
||||||
}
|
}
|
||||||
case offlineInfo:
|
case offlineInfo:
|
||||||
linfo := info.(offlineInfo)
|
linfo := info.(offlineInfo)
|
||||||
fmt.Fprintf(os.Stderr, "Bytes to sign:\n%s", msg)
|
_, err := fmt.Fprintf(os.Stderr, "Bytes to sign:\n%s", msg)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
buf := bufio.NewReader(os.Stdin)
|
buf := bufio.NewReader(os.Stdin)
|
||||||
fmt.Fprintf(os.Stderr, "\nEnter Amino-encoded signature:\n")
|
_, err = fmt.Fprintf(os.Stderr, "\nEnter Amino-encoded signature:\n")
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
// Will block until user inputs the signature
|
// Will block until user inputs the signature
|
||||||
signed, err := buf.ReadString('\n')
|
signed, err := buf.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
- [ ] 3. Merge items in `PENDING.md` into the `CHANGELOG.md`. While doing this make sure that each entry contains links to issues/PRs for each item
|
- [ ] 3. Merge items in `PENDING.md` into the `CHANGELOG.md`. While doing this make sure that each entry contains links to issues/PRs for each item
|
||||||
- [ ] 4. Summarize breaking API changes section under “Breaking Changes” section to the `CHANGELOG.md` to bring attention to any breaking API changes that affect RPC consumers.
|
- [ ] 4. Summarize breaking API changes section under “Breaking Changes” section to the `CHANGELOG.md` to bring attention to any breaking API changes that affect RPC consumers.
|
||||||
- [ ] 5. Tag the commit `{ .Release.Name }-rcN`
|
- [ ] 5. Tag the commit `{ .Release.Name }-rcN`
|
||||||
- [ ] 6. Kick off 1 day of automated fuzz testing
|
- [ ] 6. Open a branch & PR to merge the pending release back into `develop`. If any changes are made to the release branch, they must also be made to the pending develop merge, and both must pass tests.
|
||||||
- [ ] 7. Release Lead assigns 2 people to perform [buddy testing script](/docs/RELEASE_TEST_SCRIPT.md) and update the relevant documentation
|
- [ ] 7. Kick off 1 day of automated fuzz testing
|
||||||
- [ ] 8. If errors are found in either #6 or #7 go back to #2 (*NOTE*: be sure to increment the `rcN`)
|
- [ ] 8. Release Lead assigns 2 people to perform [buddy testing script](/docs/RELEASE_TEST_SCRIPT.md) and update the relevant documentation
|
||||||
- [ ] 9. After #6 and #7 have successfully completed then merge the release PR and push the final release tag
|
- [ ] 9. If errors are found in either #6 or #7 go back to #2 (*NOTE*: be sure to increment the `rcN`)
|
||||||
|
- [ ] 10. After #6 and #7 have successfully completed then merge the release PR and push the final release tag
|
||||||
|
|
|
@ -13,13 +13,13 @@ has to be created and the previous one rendered inactive.
|
||||||
```go
|
```go
|
||||||
type DepositProcedure struct {
|
type DepositProcedure struct {
|
||||||
MinDeposit sdk.Coins // Minimum deposit for a proposal to enter voting period.
|
MinDeposit sdk.Coins // Minimum deposit for a proposal to enter voting period.
|
||||||
MaxDepositPeriod int64 // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
|
MaxDepositPeriod time.Time // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```go
|
```go
|
||||||
type VotingProcedure struct {
|
type VotingProcedure struct {
|
||||||
VotingPeriod int64 // Length of the voting period. Initial value: 2 weeks
|
VotingPeriod time.Time // Length of the voting period. Initial value: 2 weeks
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ type TallyingProcedure struct {
|
||||||
Threshold sdk.Dec // Minimum propotion of Yes votes for proposal to pass. Initial value: 0.5
|
Threshold sdk.Dec // Minimum propotion 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
|
Veto sdk.Dec // Minimum proportion of Veto votes to Total votes ratio for proposal to be vetoed. Initial value: 1/3
|
||||||
GovernancePenalty sdk.Dec // Penalty if validator does not vote
|
GovernancePenalty sdk.Dec // Penalty if validator does not vote
|
||||||
GracePeriod int64 // If validator entered validator set in this period of blocks before vote ended, governance penalty does not apply
|
GracePeriod time.Time // If validator entered validator set in this period of blocks before vote ended, governance penalty does not apply
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -97,10 +97,10 @@ type Proposal struct {
|
||||||
Type ProposalType // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
|
Type ProposalType // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal}
|
||||||
TotalDeposit sdk.Coins // Current deposit on this proposal. Initial value is set at InitialDeposit
|
TotalDeposit sdk.Coins // Current deposit on this proposal. Initial value is set at InitialDeposit
|
||||||
Deposits []Deposit // List of deposits on the proposal
|
Deposits []Deposit // List of deposits on the proposal
|
||||||
SubmitBlock int64 // Height of the block where TxGovSubmitProposal was included
|
SubmitTime time.Time // Time of the block where TxGovSubmitProposal was included
|
||||||
Submitter sdk.Address // Address of the submitter
|
Submitter sdk.Address // Address of the submitter
|
||||||
|
|
||||||
VotingStartBlock int64 // Height of the block where MinDeposit was reached. -1 if MinDeposit is not reached
|
VotingStartTime time.Time // Time of the block where MinDeposit was reached. time.Time{} if MinDeposit is not reached
|
||||||
CurrentStatus ProposalStatus // Current status of the proposal
|
CurrentStatus ProposalStatus // Current status of the proposal
|
||||||
|
|
||||||
YesVotes sdk.Dec
|
YesVotes sdk.Dec
|
||||||
|
@ -137,7 +137,7 @@ For pseudocode purposes, here are the two function we will use to read or write
|
||||||
* `ProposalProcessingQueue`: A queue `queue[proposalID]` containing all the
|
* `ProposalProcessingQueue`: A queue `queue[proposalID]` containing all the
|
||||||
`ProposalIDs` of proposals that reached `MinDeposit`. Each round, the oldest
|
`ProposalIDs` of proposals that reached `MinDeposit`. Each round, the oldest
|
||||||
element of `ProposalProcessingQueue` is checked during `BeginBlock` to see if
|
element of `ProposalProcessingQueue` is checked during `BeginBlock` to see if
|
||||||
`CurrentBlock == VotingStartBlock + activeProcedure.VotingPeriod`. If it is,
|
`CurrentTime == VotingStartTime + activeProcedure.VotingPeriod`. If it is,
|
||||||
then the application tallies the votes, compute the votes of each validator and checks if every validator in the valdiator set have voted
|
then the application tallies the votes, compute the votes of each validator and checks if every validator in the valdiator set have voted
|
||||||
and, if not, applies `GovernancePenalty`. If the proposal is accepted, deposits are refunded.
|
and, if not, applies `GovernancePenalty`. If the proposal is accepted, deposits are refunded.
|
||||||
After that proposal is ejected from `ProposalProcessingQueue` and the next element of the queue is evaluated.
|
After that proposal is ejected from `ProposalProcessingQueue` and the next element of the queue is evaluated.
|
||||||
|
@ -159,7 +159,7 @@ And the pseudocode for the `ProposalProcessingQueue`:
|
||||||
proposal = load(Governance, <proposalID|'proposal'>) // proposal is a const key
|
proposal = load(Governance, <proposalID|'proposal'>) // proposal is a const key
|
||||||
votingProcedure = load(GlobalParams, 'VotingProcedure')
|
votingProcedure = load(GlobalParams, 'VotingProcedure')
|
||||||
|
|
||||||
if (CurrentBlock == proposal.VotingStartBlock + votingProcedure.VotingPeriod && proposal.CurrentStatus == ProposalStatusActive)
|
if (CurrentTime == proposal.VotingStartTime + votingProcedure.VotingPeriod && proposal.CurrentStatus == ProposalStatusActive)
|
||||||
|
|
||||||
// End of voting period, tally
|
// End of voting period, tally
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ And the pseudocode for the `ProposalProcessingQueue`:
|
||||||
|
|
||||||
// Slash validators that did not vote, or update tally if they voted
|
// Slash validators that did not vote, or update tally if they voted
|
||||||
for each validator in validators
|
for each validator in validators
|
||||||
if (validator.bondHeight < CurrentBlock - tallyingProcedure.GracePeriod)
|
if (validator.bondTime < CurrentTime - tallyingProcedure.GracePeriod)
|
||||||
// only slash if validator entered validator set before grace period
|
// only slash if validator entered validator set before grace period
|
||||||
if (!tmpValMap(validator).HasVoted)
|
if (!tmpValMap(validator).HasVoted)
|
||||||
slash validator by tallyingProcedure.GovernancePenalty
|
slash validator by tallyingProcedure.GovernancePenalty
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import fileinput
|
||||||
|
import re
|
||||||
|
|
||||||
|
# This script goes through the provided file, and replaces any " \#<number>",
|
||||||
|
# with the valid mark down formatted link to it. e.g.
|
||||||
|
# " [\#number](https://github.com/cosmos/cosmos-sdk/issues/<number>)
|
||||||
|
# Note that if the number is for a PR, github will auto-redirect you when you click the link.
|
||||||
|
# It is safe to run the script multiple times in succession.
|
||||||
|
#
|
||||||
|
# Example usage $ python3 linkify_changelog.py ../PENDING.md
|
||||||
|
for line in fileinput.input(inplace=1):
|
||||||
|
line = re.sub(r"\s\\#([0-9]*)", r" [\\#\1](https://github.com/cosmos/cosmos-sdk/issues/\1)", line.rstrip())
|
||||||
|
print(line)
|
|
@ -2,6 +2,7 @@ package gov
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
@ -28,12 +29,18 @@ func TestTickExpiredDepositPeriod(t *testing.T) {
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(10)
|
newHeader := ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(time.Duration(1) * time.Second)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(250)
|
newHeader = ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(keeper.GetDepositProcedure(ctx).MaxDepositPeriod)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.True(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.True(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
|
@ -59,7 +66,10 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) {
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(10)
|
newHeader := ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(time.Duration(2) * time.Second)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
|
@ -68,14 +78,20 @@ func TestTickMultipleExpiredDepositPeriod(t *testing.T) {
|
||||||
res = govHandler(ctx, newProposalMsg2)
|
res = govHandler(ctx, newProposalMsg2)
|
||||||
require.True(t, res.IsOK())
|
require.True(t, res.IsOK())
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(205)
|
newHeader = ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(keeper.GetDepositProcedure(ctx).MaxDepositPeriod).Add(time.Duration(-1) * time.Second)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.True(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.True(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(215)
|
newHeader = ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(time.Duration(5) * time.Second)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.True(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.True(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
|
@ -105,7 +121,10 @@ func TestTickPassedDepositPeriod(t *testing.T) {
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(10)
|
newHeader := ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(time.Duration(1) * time.Second)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.InactiveProposalQueuePeek(ctx))
|
||||||
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
require.False(t, shouldPopInactiveProposalQueue(ctx, keeper))
|
||||||
|
@ -146,14 +165,20 @@ func TestTickPassedVotingPeriod(t *testing.T) {
|
||||||
var proposalID int64
|
var proposalID int64
|
||||||
keeper.cdc.UnmarshalBinaryBare(res.Data, &proposalID)
|
keeper.cdc.UnmarshalBinaryBare(res.Data, &proposalID)
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(10)
|
newHeader := ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(time.Duration(1) * time.Second)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
newDepositMsg := NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin("steak", 5)})
|
newDepositMsg := NewMsgDeposit(addrs[1], proposalID, sdk.Coins{sdk.NewInt64Coin("steak", 5)})
|
||||||
res = govHandler(ctx, newDepositMsg)
|
res = govHandler(ctx, newDepositMsg)
|
||||||
require.True(t, res.IsOK())
|
require.True(t, res.IsOK())
|
||||||
|
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(215)
|
newHeader = ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(keeper.GetDepositProcedure(ctx).MaxDepositPeriod).Add(keeper.GetDepositProcedure(ctx).MaxDepositPeriod)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
require.True(t, shouldPopActiveProposalQueue(ctx, keeper))
|
require.True(t, shouldPopActiveProposalQueue(ctx, keeper))
|
||||||
depositsIterator := keeper.GetDeposits(ctx, proposalID)
|
depositsIterator := keeper.GetDeposits(ctx, proposalID)
|
||||||
require.True(t, depositsIterator.Valid())
|
require.True(t, depositsIterator.Valid())
|
||||||
|
@ -197,7 +222,10 @@ func TestSlashing(t *testing.T) {
|
||||||
var proposalID int64
|
var proposalID int64
|
||||||
keeper.cdc.UnmarshalBinaryBare(res.Data, &proposalID)
|
keeper.cdc.UnmarshalBinaryBare(res.Data, &proposalID)
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(10)
|
newHeader := ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(time.Duration(1) * time.Second)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
require.Equal(t, StatusVotingPeriod, keeper.GetProposal(ctx, proposalID).GetStatus())
|
require.Equal(t, StatusVotingPeriod, keeper.GetProposal(ctx, proposalID).GetStatus())
|
||||||
|
|
||||||
newVoteMsg := NewMsgVote(addrs[0], proposalID, OptionYes)
|
newVoteMsg := NewMsgVote(addrs[0], proposalID, OptionYes)
|
||||||
|
@ -206,7 +234,10 @@ func TestSlashing(t *testing.T) {
|
||||||
|
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
|
|
||||||
ctx = ctx.WithBlockHeight(215)
|
newHeader = ctx.BlockHeader()
|
||||||
|
newHeader.Time = ctx.BlockHeader().Time.Add(keeper.GetDepositProcedure(ctx).MaxDepositPeriod).Add(keeper.GetDepositProcedure(ctx).MaxDepositPeriod)
|
||||||
|
ctx = ctx.WithBlockHeader(newHeader)
|
||||||
|
|
||||||
require.Equal(t, StatusVotingPeriod, keeper.GetProposal(ctx, proposalID).GetStatus())
|
require.Equal(t, StatusVotingPeriod, keeper.GetProposal(ctx, proposalID).GetStatus())
|
||||||
|
|
||||||
EndBlocker(ctx, keeper)
|
EndBlocker(ctx, keeper)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package gov
|
package gov
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,10 +29,10 @@ func DefaultGenesisState() GenesisState {
|
||||||
StartingProposalID: 1,
|
StartingProposalID: 1,
|
||||||
DepositProcedure: DepositProcedure{
|
DepositProcedure: DepositProcedure{
|
||||||
MinDeposit: sdk.Coins{sdk.NewInt64Coin("steak", 10)},
|
MinDeposit: sdk.Coins{sdk.NewInt64Coin("steak", 10)},
|
||||||
MaxDepositPeriod: 200,
|
MaxDepositPeriod: time.Duration(172800) * time.Second,
|
||||||
},
|
},
|
||||||
VotingProcedure: VotingProcedure{
|
VotingProcedure: VotingProcedure{
|
||||||
VotingPeriod: 200,
|
VotingPeriod: time.Duration(172800) * time.Second,
|
||||||
},
|
},
|
||||||
TallyingProcedure: TallyingProcedure{
|
TallyingProcedure: TallyingProcedure{
|
||||||
Threshold: sdk.NewDecWithPrec(5, 1),
|
Threshold: sdk.NewDecWithPrec(5, 1),
|
||||||
|
|
|
@ -122,9 +122,9 @@ func EndBlocker(ctx sdk.Context, keeper Keeper) (resTags sdk.Tags) {
|
||||||
for shouldPopActiveProposalQueue(ctx, keeper) {
|
for shouldPopActiveProposalQueue(ctx, keeper) {
|
||||||
activeProposal := keeper.ActiveProposalQueuePop(ctx)
|
activeProposal := keeper.ActiveProposalQueuePop(ctx)
|
||||||
|
|
||||||
proposalStartBlock := activeProposal.GetVotingStartBlock()
|
proposalStartTime := activeProposal.GetVotingStartTime()
|
||||||
votingPeriod := keeper.GetVotingProcedure(ctx).VotingPeriod
|
votingPeriod := keeper.GetVotingProcedure(ctx).VotingPeriod
|
||||||
if ctx.BlockHeight() < proposalStartBlock+votingPeriod {
|
if ctx.BlockHeader().Time.Before(proposalStartTime.Add(votingPeriod)) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ func shouldPopInactiveProposalQueue(ctx sdk.Context, keeper Keeper) bool {
|
||||||
return false
|
return false
|
||||||
} else if peekProposal.GetStatus() != StatusDepositPeriod {
|
} else if peekProposal.GetStatus() != StatusDepositPeriod {
|
||||||
return true
|
return true
|
||||||
} else if ctx.BlockHeight() >= peekProposal.GetSubmitBlock()+depositProcedure.MaxDepositPeriod {
|
} else if !ctx.BlockHeader().Time.Before(peekProposal.GetSubmitTime().Add(depositProcedure.MaxDepositPeriod)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -184,7 +184,7 @@ func shouldPopActiveProposalQueue(ctx sdk.Context, keeper Keeper) bool {
|
||||||
|
|
||||||
if peekProposal == nil {
|
if peekProposal == nil {
|
||||||
return false
|
return false
|
||||||
} else if ctx.BlockHeight() >= peekProposal.GetVotingStartBlock()+votingProcedure.VotingPeriod {
|
} else if !ctx.BlockHeader().Time.Before(peekProposal.GetVotingStartTime().Add(votingProcedure.VotingPeriod)) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -73,8 +73,7 @@ func (keeper Keeper) NewTextProposal(ctx sdk.Context, title string, description
|
||||||
Status: StatusDepositPeriod,
|
Status: StatusDepositPeriod,
|
||||||
TallyResult: EmptyTallyResult(),
|
TallyResult: EmptyTallyResult(),
|
||||||
TotalDeposit: sdk.Coins{},
|
TotalDeposit: sdk.Coins{},
|
||||||
SubmitBlock: ctx.BlockHeight(),
|
SubmitTime: ctx.BlockHeader().Time,
|
||||||
VotingStartBlock: -1, // TODO: Make Time
|
|
||||||
}
|
}
|
||||||
keeper.SetProposal(ctx, proposal)
|
keeper.SetProposal(ctx, proposal)
|
||||||
keeper.InactiveProposalQueuePush(ctx, proposal)
|
keeper.InactiveProposalQueuePush(ctx, proposal)
|
||||||
|
@ -200,7 +199,7 @@ func (keeper Keeper) peekCurrentProposalID(ctx sdk.Context) (proposalID int64, e
|
||||||
}
|
}
|
||||||
|
|
||||||
func (keeper Keeper) activateVotingPeriod(ctx sdk.Context, proposal Proposal) {
|
func (keeper Keeper) activateVotingPeriod(ctx sdk.Context, proposal Proposal) {
|
||||||
proposal.SetVotingStartBlock(ctx.BlockHeight())
|
proposal.SetVotingStartTime(ctx.BlockHeader().Time)
|
||||||
proposal.SetStatus(StatusVotingPeriod)
|
proposal.SetStatus(StatusVotingPeriod)
|
||||||
keeper.SetProposal(ctx, proposal)
|
keeper.SetProposal(ctx, proposal)
|
||||||
keeper.ActiveProposalQueuePush(ctx, proposal)
|
keeper.ActiveProposalQueuePush(ctx, proposal)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package gov
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
@ -45,12 +46,12 @@ func TestActivateVotingPeriod(t *testing.T) {
|
||||||
|
|
||||||
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
proposal := keeper.NewTextProposal(ctx, "Test", "description", ProposalTypeText)
|
||||||
|
|
||||||
require.Equal(t, int64(-1), proposal.GetVotingStartBlock())
|
require.True(t, proposal.GetVotingStartTime().Equal(time.Time{}))
|
||||||
require.Nil(t, keeper.ActiveProposalQueuePeek(ctx))
|
require.Nil(t, keeper.ActiveProposalQueuePeek(ctx))
|
||||||
|
|
||||||
keeper.activateVotingPeriod(ctx, proposal)
|
keeper.activateVotingPeriod(ctx, proposal)
|
||||||
|
|
||||||
require.Equal(t, proposal.GetVotingStartBlock(), ctx.BlockHeight())
|
require.True(t, proposal.GetVotingStartTime().Equal(ctx.BlockHeader().Time))
|
||||||
require.Equal(t, proposal.GetProposalID(), keeper.ActiveProposalQueuePeek(ctx).GetProposalID())
|
require.Equal(t, proposal.GetProposalID(), keeper.ActiveProposalQueuePeek(ctx).GetProposalID())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ func TestDeposits(t *testing.T) {
|
||||||
// Check no deposits at beginning
|
// Check no deposits at beginning
|
||||||
deposit, found := keeper.GetDeposit(ctx, proposalID, addrs[1])
|
deposit, found := keeper.GetDeposit(ctx, proposalID, addrs[1])
|
||||||
require.False(t, found)
|
require.False(t, found)
|
||||||
require.Equal(t, keeper.GetProposal(ctx, proposalID).GetVotingStartBlock(), int64(-1))
|
require.True(t, keeper.GetProposal(ctx, proposalID).GetVotingStartTime().Equal(time.Time{}))
|
||||||
require.Nil(t, keeper.ActiveProposalQueuePeek(ctx))
|
require.Nil(t, keeper.ActiveProposalQueuePeek(ctx))
|
||||||
|
|
||||||
// Check first deposit
|
// Check first deposit
|
||||||
|
@ -114,7 +115,7 @@ func TestDeposits(t *testing.T) {
|
||||||
require.Equal(t, addr1Initial.Minus(fourSteak), keeper.ck.GetCoins(ctx, addrs[1]))
|
require.Equal(t, addr1Initial.Minus(fourSteak), keeper.ck.GetCoins(ctx, addrs[1]))
|
||||||
|
|
||||||
// Check that proposal moved to voting period
|
// Check that proposal moved to voting period
|
||||||
require.Equal(t, ctx.BlockHeight(), keeper.GetProposal(ctx, proposalID).GetVotingStartBlock())
|
require.True(t, keeper.GetProposal(ctx, proposalID).GetVotingStartTime().Equal(ctx.BlockHeader().Time))
|
||||||
require.NotNil(t, keeper.ActiveProposalQueuePeek(ctx))
|
require.NotNil(t, keeper.ActiveProposalQueuePeek(ctx))
|
||||||
require.Equal(t, proposalID, keeper.ActiveProposalQueuePeek(ctx).GetProposalID())
|
require.Equal(t, proposalID, keeper.ActiveProposalQueuePeek(ctx).GetProposalID())
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
package gov
|
package gov
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Procedure around Deposits for governance
|
// Procedure around Deposits for governance
|
||||||
type DepositProcedure struct {
|
type DepositProcedure struct {
|
||||||
MinDeposit sdk.Coins `json:"min_deposit"` // Minimum deposit for a proposal to enter voting period.
|
MinDeposit sdk.Coins `json:"min_deposit"` // Minimum deposit for a proposal to enter voting period.
|
||||||
MaxDepositPeriod int64 `json:"max_deposit_period"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
|
MaxDepositPeriod time.Duration `json:"max_deposit_period"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 months
|
||||||
}
|
}
|
||||||
|
|
||||||
// Procedure around Tallying votes in governance
|
// Procedure around Tallying votes in governance
|
||||||
|
@ -19,5 +21,5 @@ type TallyingProcedure struct {
|
||||||
|
|
||||||
// Procedure around Voting in governance
|
// Procedure around Voting in governance
|
||||||
type VotingProcedure struct {
|
type VotingProcedure struct {
|
||||||
VotingPeriod int64 `json:"voting_period"` // Length of the voting period.
|
VotingPeriod time.Duration `json:"voting_period"` // Length of the voting period.
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package gov
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
|
@ -30,14 +31,14 @@ type Proposal interface {
|
||||||
GetTallyResult() TallyResult
|
GetTallyResult() TallyResult
|
||||||
SetTallyResult(TallyResult)
|
SetTallyResult(TallyResult)
|
||||||
|
|
||||||
GetSubmitBlock() int64
|
GetSubmitTime() time.Time
|
||||||
SetSubmitBlock(int64)
|
SetSubmitTime(time.Time)
|
||||||
|
|
||||||
GetTotalDeposit() sdk.Coins
|
GetTotalDeposit() sdk.Coins
|
||||||
SetTotalDeposit(sdk.Coins)
|
SetTotalDeposit(sdk.Coins)
|
||||||
|
|
||||||
GetVotingStartBlock() int64
|
GetVotingStartTime() time.Time
|
||||||
SetVotingStartBlock(int64)
|
SetVotingStartTime(time.Time)
|
||||||
}
|
}
|
||||||
|
|
||||||
// checks if two proposals are equal
|
// checks if two proposals are equal
|
||||||
|
@ -48,9 +49,9 @@ func ProposalEqual(proposalA Proposal, proposalB Proposal) bool {
|
||||||
proposalA.GetProposalType() == proposalB.GetProposalType() &&
|
proposalA.GetProposalType() == proposalB.GetProposalType() &&
|
||||||
proposalA.GetStatus() == proposalB.GetStatus() &&
|
proposalA.GetStatus() == proposalB.GetStatus() &&
|
||||||
proposalA.GetTallyResult().Equals(proposalB.GetTallyResult()) &&
|
proposalA.GetTallyResult().Equals(proposalB.GetTallyResult()) &&
|
||||||
proposalA.GetSubmitBlock() == proposalB.GetSubmitBlock() &&
|
proposalA.GetSubmitTime().Equal(proposalB.GetSubmitTime()) &&
|
||||||
proposalA.GetTotalDeposit().IsEqual(proposalB.GetTotalDeposit()) &&
|
proposalA.GetTotalDeposit().IsEqual(proposalB.GetTotalDeposit()) &&
|
||||||
proposalA.GetVotingStartBlock() == proposalB.GetVotingStartBlock() {
|
proposalA.GetVotingStartTime().Equal(proposalB.GetVotingStartTime()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -67,10 +68,10 @@ type TextProposal struct {
|
||||||
Status ProposalStatus `json:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}
|
Status ProposalStatus `json:"proposal_status"` // Status of the Proposal {Pending, Active, Passed, Rejected}
|
||||||
TallyResult TallyResult `json:"tally_result"` // Result of Tallys
|
TallyResult TallyResult `json:"tally_result"` // Result of Tallys
|
||||||
|
|
||||||
SubmitBlock int64 `json:"submit_block"` // Height of the block where TxGovSubmitProposal was included
|
SubmitTime time.Time `json:"submit_block"` // Height of the block where TxGovSubmitProposal was included
|
||||||
TotalDeposit sdk.Coins `json:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit
|
TotalDeposit sdk.Coins `json:"total_deposit"` // Current deposit on this proposal. Initial value is set at InitialDeposit
|
||||||
|
|
||||||
VotingStartBlock int64 `json:"voting_start_block"` // Height of the block where MinDeposit was reached. -1 if MinDeposit is not reached
|
VotingStartTime time.Time `json:"voting_start_block"` // Height of the block where MinDeposit was reached. -1 if MinDeposit is not reached
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implements Proposal Interface
|
// Implements Proposal Interface
|
||||||
|
@ -89,13 +90,13 @@ func (tp TextProposal) GetStatus() ProposalStatus { return tp.S
|
||||||
func (tp *TextProposal) SetStatus(status ProposalStatus) { tp.Status = status }
|
func (tp *TextProposal) SetStatus(status ProposalStatus) { tp.Status = status }
|
||||||
func (tp TextProposal) GetTallyResult() TallyResult { return tp.TallyResult }
|
func (tp TextProposal) GetTallyResult() TallyResult { return tp.TallyResult }
|
||||||
func (tp *TextProposal) SetTallyResult(tallyResult TallyResult) { tp.TallyResult = tallyResult }
|
func (tp *TextProposal) SetTallyResult(tallyResult TallyResult) { tp.TallyResult = tallyResult }
|
||||||
func (tp TextProposal) GetSubmitBlock() int64 { return tp.SubmitBlock }
|
func (tp TextProposal) GetSubmitTime() time.Time { return tp.SubmitTime }
|
||||||
func (tp *TextProposal) SetSubmitBlock(submitBlock int64) { tp.SubmitBlock = submitBlock }
|
func (tp *TextProposal) SetSubmitTime(submitTime time.Time) { tp.SubmitTime = submitTime }
|
||||||
func (tp TextProposal) GetTotalDeposit() sdk.Coins { return tp.TotalDeposit }
|
func (tp TextProposal) GetTotalDeposit() sdk.Coins { return tp.TotalDeposit }
|
||||||
func (tp *TextProposal) SetTotalDeposit(totalDeposit sdk.Coins) { tp.TotalDeposit = totalDeposit }
|
func (tp *TextProposal) SetTotalDeposit(totalDeposit sdk.Coins) { tp.TotalDeposit = totalDeposit }
|
||||||
func (tp TextProposal) GetVotingStartBlock() int64 { return tp.VotingStartBlock }
|
func (tp TextProposal) GetVotingStartTime() time.Time { return tp.VotingStartTime }
|
||||||
func (tp *TextProposal) SetVotingStartBlock(votingStartBlock int64) {
|
func (tp *TextProposal) SetVotingStartTime(votingStartTime time.Time) {
|
||||||
tp.VotingStartBlock = votingStartBlock
|
tp.VotingStartTime = votingStartTime
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue