Make linter happy

This commit is contained in:
Hsiao-Wei Wang 2020-09-03 17:27:20 +08:00
parent b35f8fff74
commit eed2df37f4
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 2 additions and 1 deletions

View File

@ -1555,10 +1555,11 @@ def process_registry_updates(state: BeaconState) -> None:
def process_slashings(state: BeaconState) -> None:
epoch = get_current_epoch(state)
total_balance = get_total_active_balance(state)
adjusted_total_slashing_balance = min(sum(state.slashings) * PROPORTIONAL_SLASHING_MULTIPLIER, total_balance)
for index, validator in enumerate(state.validators):
if validator.slashed and epoch + EPOCHS_PER_SLASHINGS_VECTOR // 2 == validator.withdrawable_epoch:
increment = EFFECTIVE_BALANCE_INCREMENT # Factored out from penalty numerator to avoid uint64 overflow
penalty_numerator = validator.effective_balance // increment * min(sum(state.slashings) * PROPORTIONAL_SLASHING_MULTIPLIER, total_balance)
penalty_numerator = validator.effective_balance // increment * adjusted_total_slashing_balance
penalty = penalty_numerator // total_balance * increment
decrease_balance(state, ValidatorIndex(index), penalty)
```