@@ -17,6 +17,13 @@ type Pool struct {
1717}
1818```
1919
20+ ## LastTotalPower
21+
22+ LastTotalPower tracks the total amounts of bonded tokens recorded during the previous
23+ end block.
24+
25+ - LastTotalPower: ` 0x12 -> amino(sdk.Int) `
26+
2027## Params
2128
2229Params is a module-wide configuration structure that stores system parameters
@@ -37,27 +44,36 @@ type Params struct {
3744
3845Validators objects should be primarily stored and accessed by the
3946` OperatorAddr ` , an SDK validator address for the operator of the validator. Two
40- additional indexes are maintained in order to fulfill required lookups for
41- slashing and validator-set updates.
47+ additional indices are maintained per validator object in order to fulfill
48+ required lookups for slashing and validator-set updates. A third special index
49+ (` LastValidatorPower ` ) is also maintained which however remains constant
50+ throughout each block, unlike the first two indices which mirror the validator
51+ records within a block.
4252
4353- Validators: ` 0x21 | OperatorAddr -> amino(validator) `
4454- ValidatorsByConsAddr: ` 0x22 | ConsAddr -> OperatorAddr `
4555- ValidatorsByPower: ` 0x23 | BigEndian(Tokens) | OperatorAddr -> OperatorAddr `
56+ - LastValidatorsPower: `0x11 OperatorAddr -> amino(Tokens)
4657
4758` Validators ` is the primary index - it ensures that each operator can have only one
4859associated validator, where the public key of that validator can change in the
4960future. Delegators can refer to the immutable operator of the validator, without
5061concern for the changing public key.
5162
52- ` ValidatorByConsAddr ` is a secondary index that enables lookups for slashing.
63+ ` ValidatorByConsAddr ` is an additional index that enables lookups for slashing.
5364When Tendermint reports evidence, it provides the validator address, so this
5465map is needed to find the operator. Note that the ` ConsAddr ` corresponds to the
5566address which can be derived from the validator's ` ConsPubKey ` .
5667
57- ` ValidatorsByPower ` is a secondary index that provides a sorted list of
68+ ` ValidatorsByPower ` is an additional index that provides a sorted list o
5869potential validators to quickly determine the current active set. Note
5970that all validators where ` Jailed ` is true are not stored within this index.
6071
72+ ` LastValidatorsPower ` is a special index that provides a historical list of the
73+ last-block's bonded validators. This index remains constant during a block but
74+ is updated during the validator set update process which takes place in [ end
75+ block] ( end_block.md ) .
76+
6177Each validator's state is stored in a ` Validator ` struct:
6278
6379``` golang
@@ -190,3 +206,57 @@ type RedelegationEntry struct {
190206 SharesDst sdk.Dec // amount of destination-validator shares created by redelegation
191207}
192208```
209+
210+ ## Queues
211+
212+ All queues objects are sorted by timestamp. The time used within any queue is
213+ first rounded to the nearest nanosecond then sorted. The sortable time format
214+ used is a slight modification of the RFC3339Nano and uses the the format string
215+ ` "2006-01-02T15:04:05.000000000" ` . Noteably This format:
216+
217+ - right pads all zeros
218+ - drops the time zone info (uses UTC)
219+
220+ In all cases, the stored timestamp represents the maturation time of the queue
221+ element.
222+
223+ ### UnbondingDelegationQueue
224+
225+ For the purpose of tracking progress of unbonding delegations the unbonding
226+ delegations queue is kept.
227+
228+ - UnbondingDelegation: ` 0x41 | format(time) -> []DVPair `
229+
230+ ```
231+ type DVPair struct {
232+ DelegatorAddr sdk.AccAddress
233+ ValidatorAddr sdk.ValAddress
234+ }
235+ ```
236+
237+ ### RedelegationQueue
238+
239+ For the purpose of tracking progress of redelegations the redelegation queue is
240+ kept.
241+
242+ - UnbondingDelegation: ` 0x42 | format(time) -> []DVVTriplet `
243+
244+ ```
245+ type DVVTriplet struct {
246+ DelegatorAddr sdk.AccAddress
247+ ValidatorSrcAddr sdk.ValAddress
248+ ValidatorDstAddr sdk.ValAddress
249+ }
250+ ```
251+
252+ ### ValidatorQueue
253+
254+ For the purpose of tracking progress of unbonding validators the validator
255+ queue is kept.
256+
257+ - ValidatorQueueTime: ` 0x43 | format(time) -> []sdk.ValAddress `
258+
259+ The stored object as each key is an array of validator operator addresses from
260+ which the validator object can be accessed. Typically it is expected that only
261+ a single validator record will be associated with a given timestamp however it is possible
262+ that multiple validators exist in the queue at the same location.
0 commit comments