From 3e686a71e3b98ad0f79da1d61470004e61a1e667 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Tue, 13 Apr 2021 11:28:46 -0700 Subject: [PATCH] Move finality delay calculation (#8757) Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> --- beacon-chain/core/epoch/precompute/reward_penalty.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/beacon-chain/core/epoch/precompute/reward_penalty.go b/beacon-chain/core/epoch/precompute/reward_penalty.go index f523b3dc1..fe18e0112 100644 --- a/beacon-chain/core/epoch/precompute/reward_penalty.go +++ b/beacon-chain/core/epoch/precompute/reward_penalty.go @@ -134,8 +134,6 @@ func attestationDelta(pBal *Balance, v *Validator, prevEpoch, finalizedEpoch typ } // Process finality delay penalty - finalityDelay := helpers.FinalityDelay(prevEpoch, finalizedEpoch) - if helpers.IsInInactivityLeak(prevEpoch, finalizedEpoch) { // If validator is performing optimally, this cancels all rewards for a neutral balance. proposerReward := br / params.BeaconConfig().ProposerRewardQuotient @@ -144,6 +142,7 @@ func attestationDelta(pBal *Balance, v *Validator, prevEpoch, finalizedEpoch typ // Equivalent to the following condition from the spec: // `index not in get_unslashed_attesting_indices(state, matching_target_attestations)` if !v.IsPrevEpochTargetAttester || v.IsSlashed { + finalityDelay := helpers.FinalityDelay(prevEpoch, finalizedEpoch) p += vb * uint64(finalityDelay) / params.BeaconConfig().InactivityPenaltyQuotient } }