1010 get_valid_attestation ,
1111 sign_attestation ,
1212 build_attestation_data ,
13- fill_aggregate_attestation ,
13+ get_valid_attestation_at_slot ,
14+ get_empty_eip7549_aggregation_bits ,
1415)
1516from eth2spec .test .helpers .state import (
1617 next_slots ,
@@ -39,7 +40,7 @@ def test_invalid_attestation_data_index_not_zero(spec, state):
3940@with_electra_and_later
4041@spec_state_test
4142@always_bls
42- def test_invalid_committe_index (spec , state ):
43+ def test_invalid_committee_index (spec , state ):
4344 """
4445 EIP-7549 test
4546 """
@@ -57,7 +58,7 @@ def test_invalid_committe_index(spec, state):
5758
5859@with_electra_and_later
5960@spec_state_test
60- def test_invalid_too_many_committe_bits (spec , state ):
61+ def test_invalid_too_many_committee_bits (spec , state ):
6162 """
6263 EIP-7549 test
6364 """
@@ -72,7 +73,7 @@ def test_invalid_too_many_committe_bits(spec, state):
7273
7374@with_electra_and_later
7475@spec_state_test
75- def test_invalid_nonset_committe_bits (spec , state ):
76+ def test_invalid_nonset_committee_bits (spec , state ):
7677 """
7778 EIP-7549 test
7879 """
@@ -85,18 +86,51 @@ def test_invalid_nonset_committe_bits(spec, state):
8586 yield from run_attestation_processing (spec , state , attestation , valid = False )
8687
8788
89+ @with_electra_and_later
90+ @spec_state_test
91+ def test_invalid_nonset_multiple_committee_bits (spec , state ):
92+ """
93+ EIP-7549 test
94+ """
95+ attestation_data = build_attestation_data (spec , state , slot = state .slot , index = 0 )
96+ attestation = spec .Attestation (data = attestation_data )
97+
98+ # a single attestation with all committees of a slot, but with unset aggregation_bits
99+ committees_per_slot = spec .get_committee_count_per_slot (state , spec .get_current_epoch (state ))
100+ for index in range (committees_per_slot ):
101+ attestation .committee_bits [index ] = True
102+
103+ attestation .aggregation_bits = get_empty_eip7549_aggregation_bits (
104+ spec , state , attestation .committee_bits , attestation .data .slot
105+ )
106+
107+ next_slots (spec , state , spec .MIN_ATTESTATION_INCLUSION_DELAY )
108+
109+ yield from run_attestation_processing (spec , state , attestation , valid = False )
110+
111+
88112@with_electra_and_later
89113@spec_state_test
90114@with_presets ([MINIMAL ], "need multiple committees per slot" )
91115@always_bls
92116def test_multiple_committees (spec , state ):
117+ """
118+ EIP-7549 test
119+ """
93120 attestation_data = build_attestation_data (spec , state , slot = state .slot , index = 0 )
94121 attestation = spec .Attestation (data = attestation_data )
95122
96- # fill the attestation with two committees
97- fill_aggregate_attestation (spec , state , attestation , signed = True , committee_index = 0 )
98- fill_aggregate_attestation (spec , state , attestation , signed = True , committee_index = 1 )
123+ # a single attestation with all committees of a slot
124+ attestation = get_valid_attestation_at_slot (state , spec , state .slot )
125+
126+ # check that all committees are presented in a single attestation
127+ attesting_indices = set ()
128+ committees_per_slot = spec .get_committee_count_per_slot (state , spec .get_current_epoch (state ))
129+ for index in range (committees_per_slot ):
130+ attesting_indices .update (spec .get_beacon_committee (state , state .slot , index ))
131+ assert spec .get_attesting_indices (state , attestation ) == attesting_indices
99132
133+ # advance a slot
100134 next_slots (spec , state , spec .MIN_ATTESTATION_INCLUSION_DELAY )
101135
102136 yield from run_attestation_processing (spec , state , attestation )
@@ -107,6 +141,9 @@ def test_multiple_committees(spec, state):
107141@with_presets ([MINIMAL ], "need multiple committees per slot" )
108142@always_bls
109143def test_one_committee_with_gap (spec , state ):
144+ """
145+ EIP-7549 test
146+ """
110147 attestation = get_valid_attestation (spec , state , index = 1 , signed = True )
111148 next_slots (spec , state , spec .MIN_ATTESTATION_INCLUSION_DELAY )
112149
0 commit comments