|
| 1 | +from eth2spec.test.helpers.constants import MINIMAL |
1 | 2 | from eth2spec.test.context import ( |
2 | 3 | always_bls, |
3 | 4 | spec_state_test, |
4 | 5 | with_electra_and_later, |
| 6 | + with_presets, |
5 | 7 | ) |
6 | 8 | from eth2spec.test.helpers.attestations import ( |
7 | 9 | run_attestation_processing, |
8 | 10 | get_valid_attestation, |
9 | 11 | sign_attestation, |
| 12 | + build_attestation_data, |
| 13 | + fill_aggregate_attestation, |
10 | 14 | ) |
11 | 15 | from eth2spec.test.helpers.state import ( |
12 | 16 | next_slots, |
@@ -79,3 +83,30 @@ def test_invalid_nonset_committe_bits(spec, state): |
79 | 83 | attestation.committee_bits[committee_index] = 0 |
80 | 84 |
|
81 | 85 | yield from run_attestation_processing(spec, state, attestation, valid=False) |
| 86 | + |
| 87 | + |
| 88 | +@with_electra_and_later |
| 89 | +@spec_state_test |
| 90 | +@with_presets([MINIMAL], "need multiple committees per slot") |
| 91 | +@always_bls |
| 92 | +def test_multiple_committees(spec, state): |
| 93 | + attestation_data = build_attestation_data(spec, state, slot=state.slot, index=0) |
| 94 | + attestation = spec.Attestation(data=attestation_data) |
| 95 | + |
| 96 | + # fill the attestation with two committees and finally sign it |
| 97 | + fill_aggregate_attestation(spec, state, attestation, signed=False, committee_index=0) |
| 98 | + fill_aggregate_attestation(spec, state, attestation, signed=True, committee_index=1) |
| 99 | + |
| 100 | + next_slots(spec, state, spec.MIN_ATTESTATION_INCLUSION_DELAY) |
| 101 | + |
| 102 | + yield from run_attestation_processing(spec, state, attestation) |
| 103 | + |
| 104 | + |
| 105 | +@with_electra_and_later |
| 106 | +@spec_state_test |
| 107 | +@always_bls |
| 108 | +def test_one_committee_with_gap(spec, state): |
| 109 | + attestation = get_valid_attestation(spec, state, index=1, signed=True) |
| 110 | + next_slots(spec, state, spec.MIN_ATTESTATION_INCLUSION_DELAY) |
| 111 | + |
| 112 | + yield from run_attestation_processing(spec, state, attestation) |
0 commit comments