2018-05-29 11:50:35 -07:00
|
|
|
# End-Block
|
|
|
|
|
2018-10-14 17:37:06 -07:00
|
|
|
## Unbonding Validator Queue
|
|
|
|
|
|
|
|
For all unbonding validators that have finished their unbonding period, this switches their validator.Status
|
2018-10-18 12:58:18 -07:00
|
|
|
from sdk.Unbonding to sdk.Unbonded if they still have any delegation left. Otherwise, it deletes it from state.
|
2018-10-14 17:37:06 -07:00
|
|
|
|
|
|
|
```golang
|
|
|
|
validatorQueue(currTime time.Time):
|
|
|
|
// unbonding validators are in ordered queue from oldest to newest
|
|
|
|
for all unbondingValidators whose CompleteTime < currTime:
|
|
|
|
validator = GetValidator(unbondingValidator.ValidatorAddr)
|
2018-10-18 12:58:18 -07:00
|
|
|
if validator.DelegatorShares == 0 {
|
|
|
|
RemoveValidator(unbondingValidator)
|
|
|
|
} else {
|
|
|
|
validator.Status = sdk.Unbonded
|
|
|
|
SetValidator(unbondingValidator)
|
|
|
|
}
|
2018-10-14 17:37:06 -07:00
|
|
|
return
|
|
|
|
```
|
|
|
|
|
2018-08-08 03:10:21 -07:00
|
|
|
## Validator Set Changes
|
2018-05-29 11:50:35 -07:00
|
|
|
|
|
|
|
The Tendermint validator set may be updated by state transitions that run at
|
|
|
|
the end of every block. The Tendermint validator set may be changed by
|
2018-08-22 08:56:13 -07:00
|
|
|
validators either being jailed due to inactivity/unexpected behaviour (covered
|
2018-05-29 11:50:35 -07:00
|
|
|
in slashing) or changed in validator power. Determining which validator set
|
2018-05-30 12:04:14 -07:00
|
|
|
changes must be made occurs during staking transactions (and slashing
|
2018-05-29 11:50:35 -07:00
|
|
|
transactions) - during end-block the already accounted changes are applied and
|
|
|
|
the changes cleared
|
|
|
|
|
|
|
|
```golang
|
|
|
|
EndBlock() ValidatorSetChanges
|
2018-09-12 00:16:28 -07:00
|
|
|
vsc = GetValidTendermintUpdates()
|
2018-05-29 11:50:35 -07:00
|
|
|
ClearTendermintUpdates()
|
|
|
|
return vsc
|
|
|
|
```
|
2018-10-07 21:43:47 -07:00
|
|
|
|
|
|
|
## CompleteUnbonding
|
|
|
|
|
|
|
|
Complete the unbonding and transfer the coins to the delegate. Realize any
|
|
|
|
slashing that occurred during the unbonding period.
|
|
|
|
|
|
|
|
```golang
|
|
|
|
unbondingQueue(currTime time.Time):
|
|
|
|
// unbondings are in ordered queue from oldest to newest
|
|
|
|
for all unbondings whose CompleteTime < currTime:
|
|
|
|
validator = GetValidator(unbonding.ValidatorAddr)
|
|
|
|
AddCoins(unbonding.DelegatorAddr, unbonding.Balance)
|
|
|
|
removeUnbondingDelegation(unbonding)
|
|
|
|
return
|
|
|
|
```
|
|
|
|
|
|
|
|
## CompleteRedelegation
|
|
|
|
|
|
|
|
Note that unlike CompleteUnbonding slashing of redelegating shares does not
|
|
|
|
take place during completion. Slashing on redelegated shares takes place
|
|
|
|
actively as a slashing occurs. The redelegation completion queue serves simply to
|
|
|
|
clean up state, as redelegations older than an unbonding period need not be kept,
|
|
|
|
as that is the max time that their old validator's evidence can be used to slash them.
|
|
|
|
|
|
|
|
```golang
|
|
|
|
redelegationQueue(currTime time.Time):
|
|
|
|
// redelegations are in ordered queue from oldest to newest
|
|
|
|
for all redelegations whose CompleteTime < currTime:
|
|
|
|
removeRedelegation(redelegation)
|
|
|
|
return
|
2018-10-18 12:58:18 -07:00
|
|
|
```
|