Make test_fork.py truly pass
This commit is contained in:
parent
6c406753f1
commit
50fb3da072
|
@ -82,7 +82,7 @@ def _prepare_state(balances_fn: Callable[[Any], Sequence[int]], threshold_fn: Ca
|
||||||
# TODO: instead of upgrading a test phase0 genesis state we can also write a phase1 state helper.
|
# TODO: instead of upgrading a test phase0 genesis state we can also write a phase1 state helper.
|
||||||
# Decide based on performance/consistency results later.
|
# Decide based on performance/consistency results later.
|
||||||
state = phases[PHASE1].upgrade_to_phase1(state)
|
state = phases[PHASE1].upgrade_to_phase1(state)
|
||||||
elif spec.fork == LIGHTCLIENT_PATCH and not fork_test: # do not upgrade if spec ttttest
|
elif spec.fork == LIGHTCLIENT_PATCH and not is_fork_test: # do not upgrade if spec ttttest
|
||||||
state = phases[LIGHTCLIENT_PATCH].upgrade_to_lightclient_patch(state)
|
state = phases[LIGHTCLIENT_PATCH].upgrade_to_lightclient_patch(state)
|
||||||
|
|
||||||
return state
|
return state
|
||||||
|
@ -294,6 +294,7 @@ def fork_test(fn):
|
||||||
def entry(*args, **kw):
|
def entry(*args, **kw):
|
||||||
# override fork test setting
|
# override fork test setting
|
||||||
kw['fork_test'] = True
|
kw['fork_test'] = True
|
||||||
|
return fn(*args, **kw)
|
||||||
return entry
|
return entry
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from eth2spec.test.context import (
|
from eth2spec.test.context import (
|
||||||
LIGHTCLIENT_PATCH,
|
PHASE0, LIGHTCLIENT_PATCH,
|
||||||
with_phases,
|
with_phases,
|
||||||
with_custom_state, fork_test,
|
with_custom_state, fork_test,
|
||||||
spec_test, with_state,
|
spec_test, with_state,
|
||||||
|
@ -53,39 +53,39 @@ def run_fork_test(spec, pre_state):
|
||||||
yield 'post', post_state
|
yield 'post', post_state
|
||||||
|
|
||||||
|
|
||||||
@with_phases(([LIGHTCLIENT_PATCH]))
|
|
||||||
@with_state
|
|
||||||
@spec_test
|
|
||||||
@fork_test
|
@fork_test
|
||||||
|
@with_phases(([PHASE0]))
|
||||||
|
@spec_test
|
||||||
|
@with_state
|
||||||
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
||||||
def test_fork_base_state(spec, phases, state):
|
def test_fork_base_state(spec, phases, state):
|
||||||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||||
|
|
||||||
|
|
||||||
@with_phases(([LIGHTCLIENT_PATCH]))
|
|
||||||
@with_state
|
|
||||||
@spec_test
|
|
||||||
@fork_test
|
@fork_test
|
||||||
|
@with_phases(([PHASE0]))
|
||||||
|
@spec_test
|
||||||
|
@with_state
|
||||||
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
||||||
def test_fork_next_epoch(spec, phases, state):
|
def test_fork_next_epoch(spec, phases, state):
|
||||||
next_epoch(spec, state)
|
next_epoch(spec, state)
|
||||||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||||
|
|
||||||
|
|
||||||
@with_phases(([LIGHTCLIENT_PATCH]))
|
|
||||||
@with_state
|
|
||||||
@spec_test
|
|
||||||
@fork_test
|
@fork_test
|
||||||
|
@with_phases(([PHASE0]))
|
||||||
|
@spec_test
|
||||||
|
@with_state
|
||||||
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
||||||
def test_fork_next_epoch_with_block(spec, phases, state):
|
def test_fork_next_epoch_with_block(spec, phases, state):
|
||||||
next_epoch_via_block(spec, state)
|
next_epoch_via_block(spec, state)
|
||||||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||||
|
|
||||||
|
|
||||||
@with_phases(([LIGHTCLIENT_PATCH]))
|
|
||||||
@with_state
|
|
||||||
@spec_test
|
|
||||||
@fork_test
|
@fork_test
|
||||||
|
@with_phases(([PHASE0]))
|
||||||
|
@spec_test
|
||||||
|
@with_state
|
||||||
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
||||||
def test_fork_many_next_epoch(spec, phases, state):
|
def test_fork_many_next_epoch(spec, phases, state):
|
||||||
for _ in range(3):
|
for _ in range(3):
|
||||||
|
@ -93,28 +93,29 @@ def test_fork_many_next_epoch(spec, phases, state):
|
||||||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||||
|
|
||||||
|
|
||||||
@with_phases(([LIGHTCLIENT_PATCH]))
|
|
||||||
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
|
||||||
@spec_test
|
|
||||||
@fork_test
|
@fork_test
|
||||||
|
@with_phases(([PHASE0]))
|
||||||
|
@spec_test
|
||||||
|
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||||
|
@with_state
|
||||||
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
||||||
def test_fork_random_low_balances(spec, phases, state):
|
def test_fork_random_low_balances(spec, phases, state):
|
||||||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||||
|
|
||||||
|
|
||||||
@with_phases(([LIGHTCLIENT_PATCH]))
|
|
||||||
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
|
||||||
@spec_test
|
|
||||||
@fork_test
|
@fork_test
|
||||||
|
@with_phases(([PHASE0]))
|
||||||
|
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||||
|
@with_state
|
||||||
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
||||||
def test_fork_random_misc_balances(spec, phases, state):
|
def test_fork_random_misc_balances(spec, phases, state):
|
||||||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||||
|
|
||||||
|
|
||||||
@with_phases(([LIGHTCLIENT_PATCH]))
|
|
||||||
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
|
||||||
@spec_test
|
|
||||||
@fork_test
|
@fork_test
|
||||||
|
@with_phases(([PHASE0]))
|
||||||
|
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||||
|
@with_state
|
||||||
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
@with_meta_tags(HF1_FORK_TEST_META_TAGS)
|
||||||
def test_fork_random_large_validator_set(spec, phases, state):
|
def test_fork_random_large_validator_set(spec, phases, state):
|
||||||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||||
|
|
Loading…
Reference in New Issue