ensure at least one validator is slashed for slashing rewards tests

This commit is contained in:
Danny Ryan 2020-05-18 09:29:01 -06:00
parent ed013b1a47
commit b975a92e90
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 4 additions and 2 deletions

View File

@ -83,8 +83,10 @@ def exit_random_validators(spec, state, rng):
def slash_random_validators(spec, state, rng):
# Slash ~1/2 of validators
for validator in state.validators:
validator.slashed = rng.choice([True, False])
for index in range(len(state.validators)):
# slash at least one validator
if index == 0 or rng.choice([True, False]):
spec.slash_validator(state, index)
def run_test_empty(spec, state, runner):