* stake/fees spec updates * staking overview.md revisions, moving files * docs reorganization * staking spec state revisions * transaction stake updates * complete staking spec update * WIP adding unbonding/redelegation commands * added msg types for unbonding, redelegation * stake sub-package reorg * working stake reorg * modify lcd tests to not use hardcoded json strings * add description update * index keys * key managment for unbonding redelegation complete * update stake errors * completed handleMsgCompleteUnbonding fn * updated to use begin/complete unbonding/redelegation * fix token shares bug * develop docs into unbonding * got non-tests compiling after merge develop * working fixing tests * PrivlegedKeeper -> PrivilegedKeeper * tests compile * fix some tests * fixing tests * remove PrivilegedKeeper * get unbonding bug * only rpc sig verification failed tests now * move percent unbonding/redelegation to the CLI and out of handler logic * remove min unbonding height * add lcd txs * add pool sanity checks, fix a buncha tests * fix ante. set lcd log to debug (#1322) * redelegation tests, adding query functionality for bonds * add self-delegations at genesis ref #1165 * PR comments (mostly) addressed * cleanup, added Query LCD functionality * test cleanup/fixes * fix governance test * SlashValidatorSet -> ValidatorSet * changelog * stake lcd fix * x/auth: fix chainID in ante * fix lcd test * fix lint, update lint make command for spelling * lowercase error string * don't expose coinkeeper in staking * remove a few duplicate lines in changelog * chain_id in stake lcd tests * added transient redelegation * 'transient' => 'transitive' * Re-add nolint instruction * Fix tiny linter error
62 lines
1.9 KiB
Markdown
62 lines
1.9 KiB
Markdown
# End-Block
|
|
|
|
Two staking activities are intended to be processed in the application end-block.
|
|
- inform Tendermint of validator set changes
|
|
- process and set atom inflation
|
|
|
|
# Validator Set Changes
|
|
|
|
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
|
|
validators either being revoked due to inactivity/unexpected behaviour (covered
|
|
in slashing) or changed in validator power. Determining which validator set
|
|
changes must be made occurs during staking transactions (and slashing
|
|
transactions) - during end-block the already accounted changes are applied and
|
|
the changes cleared
|
|
|
|
```golang
|
|
EndBlock() ValidatorSetChanges
|
|
vsc = GetTendermintUpdates()
|
|
ClearTendermintUpdates()
|
|
return vsc
|
|
```
|
|
|
|
# Inflation
|
|
|
|
The atom inflation rate is changed once per hour based on the current and
|
|
historic bond ratio
|
|
|
|
```golang
|
|
processProvisions():
|
|
hrsPerYr = 8766 // as defined by a julian year of 365.25 days
|
|
|
|
time = BFTTime()
|
|
if time > pool.InflationLastTime + ProvisionTimeout
|
|
pool.InflationLastTime = time
|
|
pool.Inflation = nextInflation(hrsPerYr).Round(1000000000)
|
|
|
|
provisions = pool.Inflation * (pool.TotalSupply / hrsPerYr)
|
|
|
|
pool.LooseTokens += provisions
|
|
feePool += LooseTokens
|
|
|
|
setPool(pool)
|
|
|
|
nextInflation(hrsPerYr rational.Rat):
|
|
if pool.TotalSupply > 0
|
|
bondedRatio = pool.BondedPool / pool.TotalSupply
|
|
else
|
|
bondedRation = 0
|
|
|
|
inflationRateChangePerYear = (1 - bondedRatio / params.GoalBonded) * params.InflationRateChange
|
|
inflationRateChange = inflationRateChangePerYear / hrsPerYr
|
|
|
|
inflation = pool.Inflation + inflationRateChange
|
|
if inflation > params.InflationMax then inflation = params.InflationMax
|
|
|
|
if inflation < params.InflationMin then inflation = params.InflationMin
|
|
|
|
return inflation
|
|
```
|
|
|