@@ -539,40 +539,42 @@ def get_next_sync_committee_indices(state: BeaconState) -> Sequence[ValidatorInd
539539
540540#### Modified ` get_attestation_participation_flag_indices `
541541
542+ * Note* : The function ` get_attestation_participation_flag_indices ` is modified to
543+ include a new payload matching constraint to ` is_matching_head ` .
544+
542545``` python
543546def get_attestation_participation_flag_indices (
544547 state : BeaconState, data : AttestationData, inclusion_delay : uint64
545548) -> Sequence[int ]:
546549 """
547550 Return the flag indices that are satisfied by an attestation.
548551 """
552+ # Matching source
549553 if data.target.epoch == get_current_epoch(state):
550554 justified_checkpoint = state.current_justified_checkpoint
551555 else :
552556 justified_checkpoint = state.previous_justified_checkpoint
553-
554- # Matching roots
555557 is_matching_source = data.source == justified_checkpoint
556- is_matching_target = is_matching_source and data.target.root == get_block_root(
557- state, data.target.epoch
558- )
558+
559+ # Matching target
560+ target_root = get_block_root(state, data.target.epoch)
561+ target_root_matches = data.target.root == target_root
562+ is_matching_target = is_matching_source and target_root_matches
559563
560564 # [New in Gloas:EIP7732]
561- is_matching_blockroot = is_matching_target and data.beacon_block_root == get_block_root_at_slot(
562- state, Slot(data.slot)
563- )
564- is_matching_payload = False
565565 if is_attestation_same_slot(state, data):
566566 assert data.index == 0
567- is_matching_payload = True
567+ payload_matches = True
568568 else :
569- is_matching_payload = (
570- data.index
571- == state.execution_payload_availability[data.slot % SLOTS_PER_HISTORICAL_ROOT ]
572- )
569+ slot_index = data.slot % SLOTS_PER_HISTORICAL_ROOT
570+ payload_index = state.execution_payload_availability[slot_index]
571+ payload_matches = data.index == payload_index
573572
573+ # Matching head
574+ head_root = get_block_root_at_slot(state, data.slot)
575+ head_root_matches = data.beacon_block_root == head_root
574576 # [Modified in Gloas:EIP7732]
575- is_matching_head = is_matching_blockroot and is_matching_payload
577+ is_matching_head = is_matching_target and head_root_matches and payload_matches
576578
577579 assert is_matching_source
578580
0 commit comments