@@ -1016,16 +1016,24 @@ def process_attestation(state: BeaconState, attestation: Attestation) -> None:
10161016
10171017 proposer_reward_numerator = 0
10181018 for index in get_attesting_indices(state, attestation):
1019+ # [New in EIP7732]
1020+ # For same-slot attestations, check if we're setting any new flags
1021+ # If we are, this validator hasn't contributed to this slot's quorum yet
1022+ will_set_new_flag = False
1023+
10191024 for flag_index, weight in enumerate (PARTICIPATION_FLAG_WEIGHTS ):
10201025 if flag_index in participation_flag_indices and not has_flag(
10211026 epoch_participation[index], flag_index
10221027 ):
10231028 epoch_participation[index] = add_flag(epoch_participation[index], flag_index)
10241029 proposer_reward_numerator += get_base_reward(state, index) * weight
1025- # [New in EIP7732]
1026- # Update the builder payment weight
1027- if flag_index == TIMELY_HEAD_FLAG_INDEX and is_attestation_same_slot(state, data):
1028- payment.weight += state.validators[index].effective_balance
1030+ will_set_new_flag = True
1031+
1032+ # [New in EIP7732]
1033+ # Add weight for same-slot attestations when any new flag is set
1034+ # This ensures each validator contributes exactly once per slot
1035+ if will_set_new_flag and is_attestation_same_slot(state, data):
1036+ payment.weight += state.validators[index].effective_balance
10291037
10301038 # Reward proposer
10311039 proposer_reward_denominator = (
0 commit comments