PR feedback from @ralexstokes

This commit is contained in:
Danny Ryan 2021-07-08 12:18:54 -06:00
parent 19001055e9
commit a5a48d5a23
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
3 changed files with 3 additions and 3 deletions

View File

@ -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),

View File

@ -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

View File

@ -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)