From 9820f5b45ccb535e77520d901495867019cbf8fb Mon Sep 17 00:00:00 2001 From: gamarin Date: Thu, 1 Mar 2018 17:21:35 +0100 Subject: [PATCH] Removed stores, change address to PubKey, fixes, ... --- docs/spec/governance/overview.md | 18 +-- docs/spec/governance/state.md | 96 ++++++++---- docs/spec/governance/transactions.md | 215 ++++++++------------------- 3 files changed, 135 insertions(+), 194 deletions(-) diff --git a/docs/spec/governance/overview.md b/docs/spec/governance/overview.md index 4ad0d22c1d..53f7d7b081 100644 --- a/docs/spec/governance/overview.md +++ b/docs/spec/governance/overview.md @@ -33,20 +33,16 @@ When a proposal is submitted, it has to be accompanied by a deposit that must be strictly positive but can be inferior to `MinDeposit`. Indeed, the submitter need not pay for the entire deposit on its own. If a proposal's deposit is strictly inferior to `MinDeposit`, other Atom holders can increase the -proposal's deposit by sending a `TxGovDeposit` transaction. Once the proposal's -deposit reaches `MinDeposit`, it enters voting period. +proposal's deposit by sending a `TxGovDeposit` transaction. Once the proposal's deposit reaches `MinDeposit`, it enters voting period. + +If proposal's deposit does not reach `MinDeposit` before `MaxDepositPeriod`, proposal closes and nobody can deposit on it anymore. ### Deposit refund -There are two instances where Atom holders that deposited can claim back their -deposit: +There is one instance where Atom holders that deposits can be refunded: * If the proposal is accepted. -* If the proposal's deposit does not reach `MinDeposit` for a period longer - than `MaxDepositPeriod` (initial value: 2 months). Then the proposal is - considered closed and nobody can deposit on it anymore. -In such instances, Atom holders that deposited can send a `TxGovClaimDeposit` -transaction to retrieve their share of the deposit. +Then, deposits will automatically be refunded to their respective depositer. ### Proposal types @@ -162,9 +158,9 @@ period` is over), then the validator will automatically be partially slashed by That is because the proposal will close as soon as the ratio exceeds 2:3, making it mechanically impossible for some validators to vote on it. -### Governance key and governance address +### Governance address -Later, we may add permissionned keys that could only sign txs from certain modules. For the MVP, the `Governance PubKey` will be the main validator PubKey generated at account creation. This PubKey corresponds to a different PrivKey than the Tendermint PrivKey which is responsible for signing consensus messages. Validators thus do not have to sign governance transactions with the sensitive Tendermint PrivKey. +Later, we may add permissionned keys that could only sign txs from certain modules. For the MVP, the `Governance address` will be the main validator address generated at account creation. This address corresponds to a different PrivKey than the Tendermint PrivKey which is responsible for signing consensus messages. Validators thus do not have to sign governance transactions with the sensitive Tendermint PrivKey. ## Software Upgrade diff --git a/docs/spec/governance/state.md b/docs/spec/governance/state.md index fd77d950b8..e2a9c93f94 100644 --- a/docs/spec/governance/state.md +++ b/docs/spec/governance/state.md @@ -24,6 +24,28 @@ type Procedure struct { } ``` +The current active procedure is stored in a global `params` KVStore. + +### Deposit + +```go + type Deposit struct { + Amount sdk.Coins // sAmount of coins deposited by depositer + Depositer crypto.address // Address of depositer + } +``` + +### Votes + +```go + type Votes struct { + YesVotes int64 + NoVote int64 + NoWithVetoVotes int64 + AbstainVotes int64 + } +``` + ### Proposals @@ -34,12 +56,15 @@ type Proposal struct { Title string // Title of the proposal Description string // Description of the proposal Type string // Type of proposal. Initial set {PlainTextProposal, SoftwareUpgradeProposal} - Deposit int64 // 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 SubmitBlock int64 // Height of the block where TxGovSubmitProposal was included VotingStartBlock int64 // Height of the block where MinDeposit was reached. -1 if MinDeposit is not reached InitTotalVotingPower int64 // Total voting power when proposal enters voting period (default 0) - InitProcedureNumber int16 // Procedure number of the active procedure when proposal enters voting period (default -1) + InitProcedure Procedure // Active Procedure when proposal enters voting period + + Votes Votes // Total votes for each option } ``` @@ -56,24 +81,16 @@ type ValidatorGovInfo struct { *Stores are KVStores in the multistore. The key to find the store is the first parameter in the list* -* `Procedures`: a mapping `map[int16]Procedure` of procedures indexed by their - `ProcedureNumber`. First ever procedure is found at index '1'. Index '0' is reserved for parameter `ActiveProcedureNumber` which returns the number of the current procedure. + * `Proposals`: A mapping `map[int64]Proposal` of proposals indexed by their `proposalID` -* `Votes`: A mapping `map[[]byte]int64` of votes indexed by `: