From a5a48d5a23256d8fce5a1f7b7629e49da4091adf Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Thu, 8 Jul 2021 12:18:54 -0600 Subject: [PATCH] PR feedback from @ralexstokes --- .../altair/epoch_processing/test_process_inactivity_updates.py | 3 ++- tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py | 2 -- tests/core/pyspec/eth2spec/test/helpers/rewards.py | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) 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 6fdfc8a01..e3a82ac74 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 @@ -57,6 +57,7 @@ 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]) @@ -87,7 +88,7 @@ def test_all_zero_inactivity_scores_random_participation(spec, state): @spec_state_test @leaking() def test_all_zero_inactivity_scores_random_participation_leaking(spec, state): - # Only randompize participation in previous epoch to remain in leak + # Only randomize participation in previous epoch to remain in leak yield from run_inactivity_scores_test( spec, state, randomize_previous_epoch_participation, zero_inactivity_scores, rng=Random(5555), diff --git a/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py b/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py index fd3f14875..662891762 100644 --- a/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py +++ b/tests/core/pyspec/eth2spec/test/altair/sanity/test_blocks.py @@ -131,7 +131,5 @@ def test_inactivity_scores_full_participation_leaking(spec, state): yield 'post', state # Full particiaption during a leak so all scores should decrease by 1 - print(previous_inactivity_scores) - print(state.inactivity_scores) for pre, post in zip(previous_inactivity_scores, state.inactivity_scores): assert post == pre - 1 diff --git a/tests/core/pyspec/eth2spec/test/helpers/rewards.py b/tests/core/pyspec/eth2spec/test/helpers/rewards.py index 874e47305..1867db08f 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/rewards.py +++ b/tests/core/pyspec/eth2spec/test/helpers/rewards.py @@ -266,6 +266,7 @@ def transition_state_to_leak(spec, state, epochs=None): for _ in range(epochs): next_epoch(spec, state) + assert spec.is_in_inactivity_leak(state) _cache_dict = LRU(size=10)