fix tests

This commit is contained in:
Danny Ryan 2019-08-27 09:38:20 -06:00
parent d0b4dc2b01
commit 82faaf101d
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@ from .utils import vector_test, with_meta_tags
def with_state(fn): def with_state(fn):
def entry(*args, **kw): def entry(*args, **kw):
try: try:
kw['state'] = create_genesis_state(spec=kw['spec'], num_validators=spec_phase0.SLOTS_PER_EPOCH * 9) kw['state'] = create_genesis_state(spec=kw['spec'], num_validators=spec_phase0.SLOTS_PER_EPOCH * 10)
except KeyError: except KeyError:
raise TypeError('Spec decorator must come within state decorator to inject spec into state.') raise TypeError('Spec decorator must come within state decorator to inject spec into state.')
return fn(*args, **kw) return fn(*args, **kw)

View File

@ -212,13 +212,16 @@ def test_max_reveal_lateness_1(spec, state):
challenge = get_valid_bit_challenge(spec, state, attestation) challenge = get_valid_bit_challenge(spec, state, attestation)
responder_index = challenge.responder_index responder_index = challenge.responder_index
target_epoch = attestation.data.target.epoch
state.validators[responder_index].max_reveal_lateness = 3 state.validators[responder_index].max_reveal_lateness = 3
for i in range(spec.get_randao_epoch_for_custody_period( latest_reveal_epoch = spec.get_randao_epoch_for_custody_period(
spec.get_custody_period_for_validator(state, responder_index), spec.get_custody_period_for_validator(state, responder_index, target_epoch),
responder_index responder_index
) + 2 * spec.EPOCHS_PER_CUSTODY_PERIOD + state.validators[responder_index].max_reveal_lateness - 2): ) + 2 * spec.EPOCHS_PER_CUSTODY_PERIOD + state.validators[responder_index].max_reveal_lateness
while spec.get_current_epoch(state) < latest_reveal_epoch - 2:
next_epoch(spec, state) next_epoch(spec, state)
apply_empty_block(spec, state) apply_empty_block(spec, state)