diff --git a/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_inactivity_updates.py b/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_inactivity_updates.py index e3a82ac74..fd1bf3c57 100644 --- a/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_inactivity_updates.py +++ b/tests/core/pyspec/eth2spec/test/altair/epoch_processing/test_process_inactivity_updates.py @@ -4,7 +4,7 @@ from eth2spec.test.context import spec_state_test, with_altair_and_later from eth2spec.test.helpers.inactivity_scores import randomize_inactivity_scores, zero_inactivity_scores from eth2spec.test.helpers.state import ( next_epoch_via_block, - set_full_participation, set_full_participation_previous_epoch, + set_full_participation, set_empty_participation, ) from eth2spec.test.helpers.epoch_processing import ( @@ -57,7 +57,6 @@ def run_inactivity_scores_test(spec, state, participation_fn=None, inactivity_sc @spec_state_test def test_all_zero_inactivity_scores_empty_participation(spec, state): yield from run_inactivity_scores_test(spec, state, set_empty_participation, zero_inactivity_scores) - # Not yet in leak so no leak score added even though no participation assert set(state.inactivity_scores) == set([0]) @@ -119,7 +118,7 @@ def test_all_zero_inactivity_scores_full_participation_leaking(spec, state): # Only set full participation in previous epoch to remain in leak yield from run_inactivity_scores_test( spec, state, - set_full_participation_previous_epoch, zero_inactivity_scores, + set_full_participation, zero_inactivity_scores, ) # Check still in leak @@ -189,7 +188,7 @@ def test_random_inactivity_scores_full_participation_leaking(spec, state): # Only set full participation in previous epoch to remain in leak yield from run_inactivity_scores_test( spec, state, - set_full_participation_previous_epoch, randomize_inactivity_scores, Random(33333), + set_full_participation, randomize_inactivity_scores, Random(33333), ) # Check still in leak @@ -222,7 +221,7 @@ def test_some_slashed_zero_scores_full_participation_leaking(spec, state): slash_some_validators(spec, state, rng=Random(33221)) yield from run_inactivity_scores_test( spec, state, - set_full_participation_previous_epoch, zero_inactivity_scores, + set_full_participation, zero_inactivity_scores, ) # Check still in leak @@ -243,7 +242,7 @@ def test_some_slashed_full_random(spec, state): slash_some_validators(spec, state, rng=rng) yield from run_inactivity_scores_test( spec, state, - randomize_previous_epoch_participation, randomize_inactivity_scores, rng=rng, + randomize_attestation_participation, randomize_inactivity_scores, rng=rng, ) @@ -257,3 +256,6 @@ def test_some_slashed_full_random_leaking(spec, state): spec, state, randomize_previous_epoch_participation, randomize_inactivity_scores, rng=rng, ) + + # Check still in leak + assert spec.is_in_inactivity_leak(state) diff --git a/tests/core/pyspec/eth2spec/test/helpers/random.py b/tests/core/pyspec/eth2spec/test/helpers/random.py index d804fa4b9..70c871a34 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/random.py +++ b/tests/core/pyspec/eth2spec/test/helpers/random.py @@ -105,6 +105,8 @@ def randomize_previous_epoch_participation(spec, state, rng=Random(8020)): randomize_epoch_participation(spec, state, spec.get_previous_epoch(state), rng) if not is_post_altair(spec): state.current_epoch_attestations = [] + else: + state.current_epoch_participation = [spec.ParticipationFlags(0b0000_0000) for _ in range(len(state.validators))] def randomize_attestation_participation(spec, state, rng=Random(8020)): diff --git a/tests/core/pyspec/eth2spec/test/phase0/rewards/test_leak.py b/tests/core/pyspec/eth2spec/test/phase0/rewards/test_leak.py index 0ad2491f0..178b4ff77 100644 --- a/tests/core/pyspec/eth2spec/test/phase0/rewards/test_leak.py +++ b/tests/core/pyspec/eth2spec/test/phase0/rewards/test_leak.py @@ -145,8 +145,8 @@ def test_full_random_leak(spec, state): @with_all_phases @spec_state_test -@leaking(epochs=5) -def test_full_random_five_epoch_leak(spec, state): +@leaking(epochs=7) +def test_full_random_seven_epoch_leak(spec, state): yield from rewards_helpers.run_test_full_random(spec, state)