PR feedback from @ralexstokes
This commit is contained in:
parent
19001055e9
commit
a5a48d5a23
|
@ -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),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue