diff --git a/specs/altair/beacon-chain.md b/specs/altair/beacon-chain.md index 3f702dca4..8be2f04ec 100644 --- a/specs/altair/beacon-chain.md +++ b/specs/altair/beacon-chain.md @@ -583,12 +583,12 @@ def process_justification_and_finalization(state: BeaconState) -> None: # Skip FFG updates in the first two epochs to avoid corner cases that might result in modifying this stub. if get_current_epoch(state) <= GENESIS_EPOCH + 1: return - previous = get_unslashed_participating_indices(state, TIMELY_TARGET_FLAG_INDEX, get_previous_epoch(state)) - current = get_unslashed_participating_indices(state, TIMELY_TARGET_FLAG_INDEX, get_current_epoch(state)) - weigh_justification_and_finalization( - state, get_total_active_balance(state), - get_total_balance(state, previous), - get_total_balance(state, current)) + previous_indices = get_unslashed_participating_indices(state, TIMELY_TARGET_FLAG_INDEX, get_previous_epoch(state)) + current_indices = get_unslashed_participating_indices(state, TIMELY_TARGET_FLAG_INDEX, get_current_epoch(state)) + total_active_balance = get_total_active_balance(state) + previous_target_balance = get_total_balance(state, previous_indices) + current_target_balance = get_total_balance(state, current_indices) + weigh_justification_and_finalization(state, total_active_balance, previous_target_balance, current_target_balance) ``` #### Inactivity scores diff --git a/specs/phase0/beacon-chain.md b/specs/phase0/beacon-chain.md index d978c4a75..e56a8ea22 100644 --- a/specs/phase0/beacon-chain.md +++ b/specs/phase0/beacon-chain.md @@ -1320,16 +1320,17 @@ def process_justification_and_finalization(state: BeaconState) -> None: # Skip FFG updates in the first two epochs to avoid corner cases that might result in modifying this stub. if get_current_epoch(state) <= GENESIS_EPOCH + 1: return - previous = get_matching_target_attestations(state, get_previous_epoch(state)) - current = get_matching_target_attestations(state, get_current_epoch(state)) - weigh_justification_and_finalization( - state, get_total_active_balance(state), - get_attesting_balance(state, previous), - get_attesting_balance(state, current)) + previous_attestations = get_matching_target_attestations(state, get_previous_epoch(state)) + current_attestations = get_matching_target_attestations(state, get_current_epoch(state)) + total_active_balance = get_total_active_balance(state) + previous_target_balance = get_attesting_balance(state, previous_attestations) + current_target_balance = get_attesting_balance(state, current_attestations) + weigh_justification_and_finalization(state, total_active_balance, previous_target_balance, current_target_balance) ``` ```python -def weigh_justification_and_finalization(state: BeaconState, total_active_balance: Gwei, +def weigh_justification_and_finalization(state: BeaconState, + total_active_balance: Gwei, previous_epoch_target_balance: Gwei, current_epoch_target_balance: Gwei) -> None: previous_epoch = get_previous_epoch(state)