staking overview.md revisions, moving files

This commit is contained in:
rigelrozanski
2018-06-05 09:23:23 -07:00
parent 18aa9a9909
commit c66ded7646
10 changed files with 346 additions and 288 deletions
+33 -33
View File
@@ -4,10 +4,10 @@
The staking module persists the following information to the store:
* `GlobalState`, a struct describing the global pools, inflation, and
fees
* `ValidatorCandidates: <pubkey | shares> => <candidate>`, a map of all candidates (including current validators) in the store,
* `ValidatorValidators: <pubkey | shares> => <validator>`, a map of all validators (including current validators) in the store,
indexed by their public key and shares in the global pool.
* `DelegatorBonds: < delegator-address | candidate-pubkey > => <delegator-bond>`. a map of all delegations by a delegator to a candidate,
indexed by delegator address and candidate pubkey.
* `DelegatorBonds: < delegator-address | validator-pubkey > => <delegator-bond>`. a map of all delegations by a delegator to a validator,
indexed by delegator address and validator pubkey.
public key
* `UnbondQueue`, the queue of unbonding delegations
* `RedelegateQueue`, the queue of re-delegations
@@ -25,7 +25,7 @@ type GlobalState struct {
TotalSupply int64 // total supply of Atoms
BondedPool int64 // reserve of bonded tokens
BondedShares rational.Rat // sum of all shares distributed for the BondedPool
UnbondedPool int64 // reserve of unbonding tokens held with candidates
UnbondedPool int64 // reserve of unbonding tokens held with validators
UnbondedShares rational.Rat // sum of all shares distributed for the UnbondedPool
InflationLastTime int64 // timestamp of last processing of inflation
Inflation rational.Rat // current annual inflation rate
@@ -57,22 +57,22 @@ type Params struct {
}
```
### Candidate
### Validator
The `Candidate` holds the current state and some historical
actions of validators or candidate-validators.
The `Validator` holds the current state and some historical
actions of validators.
``` go
type CandidateStatus byte
type ValidatorStatus byte
const (
Bonded CandidateStatus = 0x01
Unbonded CandidateStatus = 0x02
Revoked CandidateStatus = 0x03
Bonded ValidatorStatus = 0x01
Unbonded ValidatorStatus = 0x02
Revoked ValidatorStatus = 0x03
)
type Candidate struct {
Status CandidateStatus
type Validator struct {
Status ValidatorStatus
ConsensusPubKey crypto.PubKey
GovernancePubKey crypto.PubKey
Owner crypto.Address
@@ -98,30 +98,30 @@ type Description struct {
}
```
Candidate parameters are described:
* Status: it can be Bonded (active validator), Unbonding (validator candidate)
Validator parameters are described:
* Status: it can be Bonded (active validator), Unbonding (validator)
or Revoked
* ConsensusPubKey: candidate public key that is used strictly for participating in
* ConsensusPubKey: validator public key that is used strictly for participating in
consensus
* GovernancePubKey: public key used by the validator for governance voting
* Owner: Address that is allowed to unbond coins.
* GlobalStakeShares: Represents shares of `GlobalState.BondedPool` if
`Candidate.Status` is `Bonded`; or shares of `GlobalState.Unbondingt Pool`
`Validator.Status` is `Bonded`; or shares of `GlobalState.Unbondingt Pool`
otherwise
* IssuedDelegatorShares: Sum of all shares a candidate issued to delegators
(which includes the candidate's self-bond); a delegator share represents
their stake in the Candidate's `GlobalStakeShares`
* IssuedDelegatorShares: Sum of all shares a validator issued to delegators
(which includes the validator's self-bond); a delegator share represents
their stake in the Validator's `GlobalStakeShares`
* RedelegatingShares: The portion of `IssuedDelegatorShares` which are
currently re-delegating to a new validator
* VotingPower: Proportional to the amount of bonded tokens which the validator
has if `Candidate.Status` is `Bonded`; otherwise it is equal to `0`
has if `Validator.Status` is `Bonded`; otherwise it is equal to `0`
* Commission: The commission rate of fees charged to any delegators
* CommissionMax: The maximum commission rate this candidate can charge each
* CommissionMax: The maximum commission rate this validator can charge each
day from the date `GlobalState.DateLastCommissionReset`
* CommissionChangeRate: The maximum daily increase of the candidate commission
* CommissionChangeRate: The maximum daily increase of the validator commission
* CommissionChangeToday: Counter for the amount of change to commission rate
which has occurred today, reset on the first block of each day (UTC time)
* ProposerRewardPool: reward pool for extra fees collected when this candidate
* ProposerRewardPool: reward pool for extra fees collected when this validator
is the proposer of a block
* Adjustment factor used to passively calculate each validators entitled fees
from `GlobalState.FeePool`
@@ -135,14 +135,14 @@ Candidate parameters are described:
### DelegatorBond
Atom holders may delegate coins to candidates; under this circumstance their
Atom holders may delegate coins to validators; under this circumstance their
funds are held in a `DelegatorBond` data structure. It is owned by one
delegator, and is associated with the shares for one candidate. The sender of
delegator, and is associated with the shares for one validator. The sender of
the transaction is the owner of the bond.
``` go
type DelegatorBond struct {
Candidate crypto.PubKey
Validator crypto.PubKey
Shares rational.Rat
AdjustmentFeePool coin.Coins
AdjustmentRewardPool coin.Coins
@@ -150,12 +150,12 @@ type DelegatorBond struct {
```
Description:
* Candidate: the public key of the validator candidate: bonding too
* Shares: the number of delegator shares received from the validator candidate
* Validator: the public key of the validator: bonding too
* Shares: the number of delegator shares received from the validator
* AdjustmentFeePool: Adjustment factor used to passively calculate each bonds
entitled fees from `GlobalState.FeePool`
* AdjustmentRewardPool: Adjustment factor used to passively calculate each
bonds entitled fees from `Candidate.ProposerRewardPool`
bonds entitled fees from `Validator.ProposerRewardPool`
### QueueElem
@@ -165,7 +165,7 @@ data structure. All queue elements share a common structure:
```golang
type QueueElem struct {
Candidate crypto.PubKey
Validator crypto.PubKey
InitTime int64 // when the element was added to the queue
}
```
@@ -185,7 +185,7 @@ type QueueElemUnbondDelegation struct {
QueueElem
Payout Address // account to pay out to
Tokens coin.Coins // the value in Atoms of the amount of delegator shares which are unbonding
StartSlashRatio rational.Rat // candidate slash ratio
StartSlashRatio rational.Rat // validator slash ratio
}
```
@@ -198,7 +198,7 @@ type QueueElemReDelegate struct {
QueueElem
Payout Address // account to pay out to
Shares rational.Rat // amount of shares which are unbonding
NewCandidate crypto.PubKey // validator to bond to after unbond
NewValidator crypto.PubKey // validator to bond to after unbond
}
```