use 'other_phases' for fork tests

This commit is contained in:
Danny Ryan 2021-03-10 12:38:30 -07:00
parent e792c27c91
commit 1f3e73703c
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 14 additions and 11 deletions

View File

@ -340,7 +340,7 @@ def with_phases(phases, other_phases=None):
available_phases = set(run_phases)
if other_phases is not None:
available_phases += set(other_phases)
available_phases |= set(other_phases)
# TODO: test state is dependent on phase0 but is immediately transitioned to phase1.
# A new state-creation helper for phase 1 may be in place, and then phase1+ tests can run without phase0
@ -348,8 +348,11 @@ def with_phases(phases, other_phases=None):
# Populate all phases for multi-phase tests
phase_dir = {}
if PHASE0 in available_phases:
phase_dir[PHASE0] = spec_phase0
if PHASE1 in available_phases:
phase_dir[PHASE1] = spec_phase1
if LIGHTCLIENT_PATCH in available_phases:
phase_dir[LIGHTCLIENT_PATCH] = spec_lightclient_patch
# return is ignored whenever multiple phases are ran. If

View File

@ -53,7 +53,7 @@ def run_fork_test(post_spec, pre_state):
yield 'post', post_state
@with_phases(([PHASE0]))
@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH])
@spec_test
@with_state
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
@ -61,7 +61,7 @@ def test_fork_base_state(spec, phases, state):
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
@with_phases(([PHASE0]))
@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH])
@spec_test
@with_state
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
@ -70,7 +70,7 @@ def test_fork_next_epoch(spec, phases, state):
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
@with_phases(([PHASE0]))
@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH])
@spec_test
@with_state
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
@ -79,7 +79,7 @@ def test_fork_next_epoch_with_block(spec, phases, state):
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
@with_phases(([PHASE0]))
@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH])
@spec_test
@with_state
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
@ -89,7 +89,7 @@ def test_fork_many_next_epoch(spec, phases, state):
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
@with_phases(([PHASE0]))
@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH])
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@spec_test
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
@ -97,7 +97,7 @@ def test_fork_random_low_balances(spec, phases, state):
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
@with_phases(([PHASE0]))
@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH])
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@spec_test
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
@ -105,7 +105,7 @@ def test_fork_random_misc_balances(spec, phases, state):
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
@with_phases(([PHASE0]))
@with_phases(phases=[PHASE0], other_phases=[LIGHTCLIENT_PATCH])
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
@spec_test
@with_meta_tags(HF1_FORK_TEST_META_TAGS)