@@ -362,15 +362,16 @@ def has_compounding_withdrawal_credential(validator: Validator) -> bool:
362362``` python
363363def is_attestation_same_slot (state : BeaconState, data : AttestationData) -> bool :
364364 """
365- Checks if the attestation was for the block proposed at the attestation slot.
365+ Check if the attestation is for the block proposed at the attestation slot.
366366 """
367367 if data.slot == 0 :
368368 return True
369- is_matching_blockroot = data.beacon_block_root == get_block_root_at_slot(state, Slot(data.slot))
370- is_current_blockroot = data.beacon_block_root != get_block_root_at_slot(
371- state, Slot(data.slot - 1 )
372- )
373- return is_matching_blockroot and is_current_blockroot
369+
370+ blockroot = data.beacon_block_root
371+ slot_blockroot = get_block_root_at_slot(state, data.slot)
372+ prev_blockroot = get_block_root_at_slot(state, Slot(data.slot - 1 ))
373+
374+ return blockroot == slot_blockroot and blockroot != prev_blockroot
374375```
375376
376377#### New ` is_valid_indexed_payload_attestation `
@@ -619,9 +620,8 @@ def get_indexed_payload_attestation(
619620 Return the indexed payload attestation corresponding to ``payload_attestation``.
620621 """
621622 ptc = get_ptc(state, slot)
622- attesting_indices = [
623- index for i, index in enumerate (ptc) if payload_attestation.aggregation_bits[i]
624- ]
623+ bits = payload_attestation.aggregation_bits
624+ attesting_indices = [index for i, index in enumerate (ptc) if bits[i]]
625625
626626 return IndexedPayloadAttestation(
627627 attesting_indices = sorted (attesting_indices),
@@ -637,9 +637,8 @@ def get_builder_payment_quorum_threshold(state: BeaconState) -> uint64:
637637 """
638638 Calculate the quorum threshold for builder payments.
639639 """
640- quorum = (
641- get_total_active_balance(state) // SLOTS_PER_EPOCH * BUILDER_PAYMENT_THRESHOLD_NUMERATOR
642- )
640+ per_slot_balance = get_total_active_balance(state) // SLOTS_PER_EPOCH
641+ quorum = per_slot_balance * BUILDER_PAYMENT_THRESHOLD_NUMERATOR
643642 return uint64(quorum // BUILDER_PAYMENT_THRESHOLD_DENOMINATOR )
644643```
645644
@@ -715,14 +714,15 @@ def process_builder_pending_payments(state: BeaconState) -> None:
715714 quorum = get_builder_payment_quorum_threshold(state)
716715 for payment in state.builder_pending_payments[:SLOTS_PER_EPOCH ]:
717716 if payment.weight > quorum:
718- exit_queue_epoch = compute_exit_epoch_and_update_churn(state, payment.withdrawal.amount)
719- payment.withdrawal.withdrawable_epoch = Epoch(
720- exit_queue_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY
721- )
717+ amount = payment.withdrawal.amount
718+ exit_queue_epoch = compute_exit_epoch_and_update_churn(state, amount)
719+ withdrawable_epoch = exit_queue_epoch + MIN_VALIDATOR_WITHDRAWABILITY_DELAY
720+ payment.withdrawal.withdrawable_epoch = Epoch(withdrawable_epoch )
722721 state.builder_pending_withdrawals.append(payment.withdrawal)
723- state.builder_pending_payments = state.builder_pending_payments[SLOTS_PER_EPOCH :] + [
724- BuilderPendingPayment() for _ in range (SLOTS_PER_EPOCH )
725- ]
722+
723+ old_payments = state.builder_pending_payments[SLOTS_PER_EPOCH :]
724+ new_payments = [BuilderPendingPayment() for _ in range (SLOTS_PER_EPOCH )]
725+ state.builder_pending_payments = old_payments + new_payments
726726```
727727
728728### Block processing
0 commit comments