remove fork_test
This commit is contained in:
parent
21cdbc9b3d
commit
f9b54ea03b
|
@ -70,7 +70,7 @@ class SpecForks(TypedDict, total=False):
|
|||
|
||||
|
||||
def _prepare_state(balances_fn: Callable[[Any], Sequence[int]], threshold_fn: Callable[[Any], int],
|
||||
spec: Spec, phases: SpecForks, is_fork_test: bool):
|
||||
spec: Spec, phases: SpecForks):
|
||||
|
||||
p0 = phases[PHASE0]
|
||||
balances = balances_fn(p0)
|
||||
|
@ -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.
|
||||
# Decide based on performance/consistency results later.
|
||||
state = phases[PHASE1].upgrade_to_phase1(state)
|
||||
elif spec.fork == LIGHTCLIENT_PATCH and not is_fork_test: # do not upgrade if spec test
|
||||
elif spec.fork == LIGHTCLIENT_PATCH:
|
||||
state = phases[LIGHTCLIENT_PATCH].upgrade_to_lightclient_patch(state)
|
||||
|
||||
return state
|
||||
|
@ -98,11 +98,10 @@ def with_custom_state(balances_fn: Callable[[Any], Sequence[int]],
|
|||
def entry(*args, spec: Spec, phases: SpecForks, **kw):
|
||||
# make a key for the state
|
||||
# genesis fork version separates configs during test-generation runtime.
|
||||
is_fork_test = kw.pop('fork_test') if 'fork_test' in kw else False
|
||||
key = (spec.fork, spec.GENESIS_FORK_VERSION, spec.__file__, balances_fn, threshold_fn, is_fork_test)
|
||||
key = (spec.fork, spec.GENESIS_FORK_VERSION, spec.__file__, balances_fn, threshold_fn)
|
||||
global _custom_state_cache_dict
|
||||
if key not in _custom_state_cache_dict:
|
||||
state = _prepare_state(balances_fn, threshold_fn, spec, phases, is_fork_test)
|
||||
state = _prepare_state(balances_fn, threshold_fn, spec, phases)
|
||||
_custom_state_cache_dict[key] = state.get_backing()
|
||||
|
||||
# Take an entry out of the LRU.
|
||||
|
@ -288,16 +287,6 @@ def bls_switch(fn):
|
|||
return entry
|
||||
|
||||
|
||||
def fork_test(fn):
|
||||
"""
|
||||
"""
|
||||
def entry(*args, **kw):
|
||||
# override fork test setting
|
||||
kw['fork_test'] = True
|
||||
return fn(*args, **kw)
|
||||
return entry
|
||||
|
||||
|
||||
def disable_process_reveal_deadlines(fn):
|
||||
"""
|
||||
Decorator to make a function execute with `process_reveal_deadlines` OFF.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from eth2spec.test.context import (
|
||||
PHASE0, LIGHTCLIENT_PATCH,
|
||||
with_phases,
|
||||
with_custom_state, fork_test,
|
||||
with_custom_state,
|
||||
spec_test, with_state,
|
||||
low_balances, misc_balances, large_validator_set,
|
||||
)
|
||||
|
@ -53,7 +53,6 @@ def run_fork_test(spec, pre_state):
|
|||
yield 'post', post_state
|
||||
|
||||
|
||||
@fork_test
|
||||
@with_phases(([PHASE0]))
|
||||
@spec_test
|
||||
@with_state
|
||||
|
@ -62,7 +61,6 @@ def test_fork_base_state(spec, phases, state):
|
|||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||
|
||||
|
||||
@fork_test
|
||||
@with_phases(([PHASE0]))
|
||||
@spec_test
|
||||
@with_state
|
||||
|
@ -72,7 +70,6 @@ def test_fork_next_epoch(spec, phases, state):
|
|||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||
|
||||
|
||||
@fork_test
|
||||
@with_phases(([PHASE0]))
|
||||
@spec_test
|
||||
@with_state
|
||||
|
@ -82,7 +79,6 @@ def test_fork_next_epoch_with_block(spec, phases, state):
|
|||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||
|
||||
|
||||
@fork_test
|
||||
@with_phases(([PHASE0]))
|
||||
@spec_test
|
||||
@with_state
|
||||
|
@ -93,7 +89,6 @@ def test_fork_many_next_epoch(spec, phases, state):
|
|||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||
|
||||
|
||||
@fork_test
|
||||
@with_phases(([PHASE0]))
|
||||
@with_custom_state(balances_fn=low_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||
@spec_test
|
||||
|
@ -102,7 +97,6 @@ def test_fork_random_low_balances(spec, phases, state):
|
|||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||
|
||||
|
||||
@fork_test
|
||||
@with_phases(([PHASE0]))
|
||||
@with_custom_state(balances_fn=misc_balances, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||
@spec_test
|
||||
|
@ -111,7 +105,6 @@ def test_fork_random_misc_balances(spec, phases, state):
|
|||
yield from run_fork_test(phases[LIGHTCLIENT_PATCH], state)
|
||||
|
||||
|
||||
@fork_test
|
||||
@with_phases(([PHASE0]))
|
||||
@with_custom_state(balances_fn=large_validator_set, threshold_fn=lambda spec: spec.EJECTION_BALANCE)
|
||||
@spec_test
|
||||
|
|
Loading…
Reference in New Issue