Skip to content

Commit 792cb18

Browse files
committed
Add more process_attestation tests
1 parent 778a32a commit 792cb18

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/core/pyspec/eth2spec/test/electra/block_processing/test_process_attestation.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1+
from eth2spec.test.helpers.constants import MINIMAL
12
from eth2spec.test.context import (
23
always_bls,
34
spec_state_test,
45
with_electra_and_later,
6+
with_presets,
57
)
68
from eth2spec.test.helpers.attestations import (
79
run_attestation_processing,
810
get_valid_attestation,
911
sign_attestation,
12+
build_attestation_data,
13+
fill_aggregate_attestation,
1014
)
1115
from eth2spec.test.helpers.state import (
1216
next_slots,
@@ -79,3 +83,30 @@ def test_invalid_nonset_committe_bits(spec, state):
7983
attestation.committee_bits[committee_index] = 0
8084

8185
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

Comments
 (0)