move rewards helpers to rewrds and penalties section

This commit is contained in:
Danny Ryan 2018-12-12 09:14:44 -06:00
parent bc60576d3c
commit 541f33094f
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 6 additions and 3 deletions

View File

@ -1470,9 +1470,6 @@ All [validators](#dfn-validator):
* Let `active_validators = [state.validator_registry[i] for i in get_active_validator_indices(state.validator_registry)]`.
* Let `total_balance = sum([get_effective_balance(v) for v in active_validators])`.
* Let `base_reward_quotient = BASE_REWARD_QUOTIENT * integer_squareroot(total_balance // GWEI_PER_ETH)`.
* Let `base_reward(v) = get_effective_balance(v) // base_reward_quotient // 4` for any validator `v`.
* Let `base_inactivity_penalty(v, slots_since_finality) = base_reward(v) + get_effective_balance(v) * slots_since_finality // INACTIVITY_PENALTY_QUOTIENT` for any validator `v`.
[Validators](#dfn-Validator) validators attesting during the current epoch:
@ -1557,6 +1554,12 @@ For every `shard_committee` in `state.shard_committees_at_slots`:
### Rewards and penalties
First, we define some additional helpers:
* Let `base_reward_quotient = BASE_REWARD_QUOTIENT * integer_squareroot(total_balance // GWEI_PER_ETH)`.
* Let `base_reward(v) = get_effective_balance(v) // base_reward_quotient // 4` for any validator `v`.
* Let `base_inactivity_penalty(v, slots_since_finality) = base_reward(v) + get_effective_balance(v) * slots_since_finality // INACTIVITY_PENALTY_QUOTIENT` for any validator `v`.
#### Justification and finalization
Note: When applying penalties in the following balance recalculations implementers should make sure the `uint64` does not underflow.