2019-12-17 03:44:44 -08:00
|
|
|
<!--
|
2021-08-09 01:09:17 -07:00
|
|
|
order: 5
|
2019-12-17 03:44:44 -08:00
|
|
|
-->
|
2019-12-11 09:35:27 -08:00
|
|
|
|
2019-07-01 09:47:55 -07:00
|
|
|
# End-Block
|
2018-05-29 11:50:35 -07:00
|
|
|
|
2019-01-21 16:52:03 -08:00
|
|
|
Each abci end block call, the operations to update queues and validator set
|
2019-07-01 09:47:55 -07:00
|
|
|
changes are specified to execute.
|
2018-10-14 17:37:06 -07:00
|
|
|
|
2018-08-08 03:10:21 -07:00
|
|
|
## Validator Set Changes
|
2018-05-29 11:50:35 -07:00
|
|
|
|
2019-01-21 16:52:03 -08:00
|
|
|
The staking validator set is updated during this process by state transitions
|
|
|
|
that run at the end of every block. As a part of this process any updated
|
|
|
|
validators are also returned back to Tendermint for inclusion in the Tendermint
|
|
|
|
validator set which is responsible for validating Tendermint messages at the
|
|
|
|
consensus layer. Operations are as following:
|
|
|
|
|
2022-02-10 04:07:01 -08:00
|
|
|
* the new validator set is taken as the top `params.MaxValidators` number of
|
2021-03-19 05:06:53 -07:00
|
|
|
validators retrieved from the `ValidatorsByPower` index
|
2022-02-10 04:07:01 -08:00
|
|
|
* the previous validator set is compared with the new validator set:
|
|
|
|
* missing validators begin unbonding and their `Tokens` are transferred from the
|
2020-10-12 06:56:02 -07:00
|
|
|
`BondedPool` to the `NotBondedPool` `ModuleAccount`
|
2022-02-10 04:07:01 -08:00
|
|
|
* new validators are instantly bonded and their `Tokens` are transferred from the
|
2020-10-12 06:56:02 -07:00
|
|
|
`NotBondedPool` to the `BondedPool` `ModuleAccount`
|
2019-01-21 16:52:03 -08:00
|
|
|
|
|
|
|
In all cases, any validators leaving or entering the bonded validator set or
|
|
|
|
changing balances and staying within the bonded validator set incur an update
|
2021-03-19 05:06:53 -07:00
|
|
|
message reporting their new consensus power which is passed back to Tendermint.
|
|
|
|
|
|
|
|
The `LastTotalPower` and `LastValidatorsPower` hold the state of the total power
|
|
|
|
and validator power from the end of the last block, and are used to check for
|
|
|
|
changes that have occured in `ValidatorsByPower` and the total new power, which
|
|
|
|
is calculated during `EndBlock`.
|
2019-01-21 16:52:03 -08:00
|
|
|
|
2019-07-01 09:47:55 -07:00
|
|
|
## Queues
|
2019-01-21 16:52:03 -08:00
|
|
|
|
|
|
|
Within staking, certain state-transitions are not instantaneous but take place
|
|
|
|
over a duration of time (typically the unbonding period). When these
|
|
|
|
transitions are mature certain operations must take place in order to complete
|
|
|
|
the state operation. This is achieved through the use of queues which are
|
2019-07-01 09:47:55 -07:00
|
|
|
checked/processed at the end of each block.
|
2019-01-21 16:52:03 -08:00
|
|
|
|
|
|
|
### Unbonding Validators
|
|
|
|
|
|
|
|
When a validator is kicked out of the bonded validator set (either through
|
|
|
|
being jailed, or not having sufficient bonded tokens) it begins the unbonding
|
|
|
|
process along with all its delegations begin unbonding (while still being
|
|
|
|
delegated to this validator). At this point the validator is said to be an
|
2021-03-19 05:06:53 -07:00
|
|
|
"unbonding validator", whereby it will mature to become an "unbonded validator"
|
2019-07-01 09:47:55 -07:00
|
|
|
after the unbonding period has passed.
|
2019-01-21 16:52:03 -08:00
|
|
|
|
2019-02-08 15:57:33 -08:00
|
|
|
Each block the validator queue is to be checked for mature unbonding validators
|
2021-03-19 05:06:53 -07:00
|
|
|
(namely with a completion time <= current time and completion height <= current
|
|
|
|
block height). At this point any mature validators which do not have any
|
|
|
|
delegations remaining are deleted from state. For all other mature unbonding
|
|
|
|
validators that still have remaining delegations, the `validator.Status` is
|
|
|
|
switched from `types.Unbonding` to
|
2020-10-12 06:56:02 -07:00
|
|
|
`types.Unbonded`.
|
2019-01-21 16:52:03 -08:00
|
|
|
|
|
|
|
### Unbonding Delegations
|
|
|
|
|
|
|
|
Complete the unbonding of all mature `UnbondingDelegations.Entries` within the
|
2019-07-01 09:47:55 -07:00
|
|
|
`UnbondingDelegations` queue with the following procedure:
|
|
|
|
|
2022-02-10 04:07:01 -08:00
|
|
|
* transfer the balance coins to the delegator's wallet address
|
|
|
|
* remove the mature entry from `UnbondingDelegation.Entries`
|
|
|
|
* remove the `UnbondingDelegation` object from the store if there are no
|
2019-07-01 09:47:55 -07:00
|
|
|
remaining entries.
|
2019-01-21 16:52:03 -08:00
|
|
|
|
|
|
|
### Redelegations
|
|
|
|
|
|
|
|
Complete the unbonding of all mature `Redelegation.Entries` within the
|
2019-07-01 09:47:55 -07:00
|
|
|
`Redelegations` queue with the following procedure:
|
|
|
|
|
2022-02-10 04:07:01 -08:00
|
|
|
* remove the mature entry from `Redelegation.Entries`
|
|
|
|
* remove the `Redelegation` object from the store if there are no
|
2019-07-01 09:47:55 -07:00
|
|
|
remaining entries.
|