ensure the test covers exited, unslashed validators
This commit is contained in:
parent
7cb5901ee6
commit
cf23cd00ab
|
@ -34,6 +34,13 @@ def get_exited_validators(spec, state):
|
|||
return [index for (index, validator) in enumerate(state.validators) if validator.exit_epoch <= current_epoch]
|
||||
|
||||
|
||||
def get_unslashed_exited_validators(spec, state):
|
||||
return [
|
||||
index for index in get_exited_validators(spec, state)
|
||||
if not state.validators[index].slashed
|
||||
]
|
||||
|
||||
|
||||
def exit_validators(spec, state, validator_count, rng=None):
|
||||
if rng is None:
|
||||
rng = Random(1337)
|
||||
|
|
|
@ -10,6 +10,7 @@ from eth2spec.test.context import (
|
|||
)
|
||||
import eth2spec.test.helpers.rewards as rewards_helpers
|
||||
from eth2spec.test.helpers.random import randomize_state, patch_state_to_non_leaking
|
||||
from eth2spec.test.helpers.voluntary_exits import get_unslashed_exited_validators
|
||||
|
||||
|
||||
@with_all_phases
|
||||
|
@ -68,4 +69,6 @@ def test_full_random_without_leak_0(spec, state):
|
|||
assert spec.is_in_inactivity_leak(state)
|
||||
patch_state_to_non_leaking(spec, state)
|
||||
assert not spec.is_in_inactivity_leak(state)
|
||||
target_validators = get_unslashed_exited_validators(spec, state)
|
||||
assert len(target_validators) != 0
|
||||
yield from rewards_helpers.run_deltas(spec, state)
|
||||
|
|
Loading…
Reference in New Issue