@@ -493,3 +493,55 @@ def test_builder_payment_weight_no_increment_for_zero_amount(spec, state):
493493 yield from run_attestation_processing (spec , state , attestation , valid = True )
494494
495495 assert state .builder_pending_payments [payment_idx ].weight == pre_weight
496+
497+
498+ @with_gloas_and_later
499+ @spec_state_test
500+ def test_builder_payment_weight_accumulates (spec , state ):
501+ """
502+ Test that builder payment weight accumulates across distinct same-slot
503+ attesters.
504+ """
505+ transition_to_slot_via_block (spec , state , 2 )
506+
507+ # Create a same-slot attestation for slot 0 with two distinct attesters
508+ attestation_slot = 0
509+ committee = spec .get_beacon_committee (state , attestation_slot , 0 )
510+ first_attester , second_attester = committee [:2 ]
511+ attestation = get_valid_attestation (
512+ spec ,
513+ state ,
514+ slot = attestation_slot ,
515+ index = 0 ,
516+ payload_index = 0 ,
517+ filter_participant_set = lambda _ : {first_attester , second_attester },
518+ signed = True ,
519+ )
520+
521+ first_weight = state .validators [first_attester ].effective_balance
522+ second_weight = state .validators [second_attester ].effective_balance
523+ assert first_weight > 0
524+ assert second_weight > 0
525+
526+ # Manually set up a non-zero builder pending payment for slot 0
527+ payment_slot_index = spec .SLOTS_PER_EPOCH + attestation_slot % spec .SLOTS_PER_EPOCH
528+ test_payment_amount = spec .Gwei (1000000000 )
529+ state .builder_pending_payments [payment_slot_index ] = spec .BuilderPendingPayment (
530+ weight = spec .Gwei (0 ),
531+ withdrawal = spec .BuilderPendingWithdrawal (
532+ fee_recipient = spec .ExecutionAddress (),
533+ amount = test_payment_amount ,
534+ builder_index = 0 ,
535+ ),
536+ )
537+
538+ # Store initial weight for slot 0
539+ initial_weight = state .builder_pending_payments [payment_slot_index ].weight
540+
541+ # Process attestation
542+ yield from run_attestation_processing (spec , state , attestation , valid = True )
543+
544+ # Weight should accumulate both attesters' effective balances
545+ final_weight = state .builder_pending_payments [payment_slot_index ].weight
546+ expected_final_weight = initial_weight + first_weight + second_weight
547+ assert final_weight == expected_final_weight
0 commit comments