From 82faaf101d50f33206094a99e60a3efa86662f9b Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Tue, 27 Aug 2019 09:38:20 -0600 Subject: [PATCH] fix tests --- test_libs/pyspec/eth2spec/test/context.py | 2 +- .../block_processing/test_process_bit_challenge.py | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test_libs/pyspec/eth2spec/test/context.py b/test_libs/pyspec/eth2spec/test/context.py index 9f7fc41d4..80edaba9b 100644 --- a/test_libs/pyspec/eth2spec/test/context.py +++ b/test_libs/pyspec/eth2spec/test/context.py @@ -10,7 +10,7 @@ from .utils import vector_test, with_meta_tags def with_state(fn): def entry(*args, **kw): 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: raise TypeError('Spec decorator must come within state decorator to inject spec into state.') return fn(*args, **kw) diff --git a/test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py b/test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py index e4880555a..ae6ff258c 100644 --- a/test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py +++ b/test_libs/pyspec/eth2spec/test/phase_1/block_processing/test_process_bit_challenge.py @@ -212,13 +212,16 @@ def test_max_reveal_lateness_1(spec, state): challenge = get_valid_bit_challenge(spec, state, attestation) responder_index = challenge.responder_index + target_epoch = attestation.data.target.epoch state.validators[responder_index].max_reveal_lateness = 3 - for i in range(spec.get_randao_epoch_for_custody_period( - spec.get_custody_period_for_validator(state, responder_index), + latest_reveal_epoch = spec.get_randao_epoch_for_custody_period( + spec.get_custody_period_for_validator(state, responder_index, target_epoch), 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) apply_empty_block(spec, state)