cleanup set some new deposits helper for rewards tests

This commit is contained in:
Danny Ryan 2020-05-18 12:06:24 -06:00
parent 97b6db4971
commit 96b5733086
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 7 additions and 7 deletions

View File

@ -64,12 +64,12 @@ def run_attestation_component_deltas(spec, state, component_delta_fn, matching_a
def set_some_new_deposits(spec, state, rng):
num_validators = len(state.validators)
# last 10th of validators are new deposits
for i in range(len(state.validators))[0:num_validators // 10]:
index = num_validators - 1 - i
# Set ~1/10 to just recently deposited
for index in range(num_validators):
if rng.randrange(num_validators) < num_validators // 10:
mock_deposit(spec, state, index)
# Set half to eligible for activation
if i % 2 == 0:
# Set ~half of selected to eligible for activation
if rng.choice([True, False]):
state.validators[index].activation_eligibility_epoch = spec.get_current_epoch(state)