Turn off phase1 testgen and turn on lightclient_patch testgen
This commit is contained in:
parent
019deb81fd
commit
600a4daddf
|
@ -1,5 +1,5 @@
|
|||
from inspect import getmembers, isfunction
|
||||
from typing import Any, Iterable
|
||||
from typing import Any, Iterable, Dict
|
||||
|
||||
from gen_base.gen_typing import TestCase
|
||||
|
||||
|
@ -38,3 +38,13 @@ def generate_from_tests(runner_name: str, handler_name: str, src: Any,
|
|||
# TODO: with_all_phases and other per-phase tooling, should be replaced with per-fork equivalent.
|
||||
case_fn=lambda: tfn(generator_mode=True, phase=fork_name, bls_active=bls_active)
|
||||
)
|
||||
|
||||
|
||||
def get_provider(create_provider_fn, config_name, fork_name, all_mods):
|
||||
for key, mod_name in all_mods[fork_name].items():
|
||||
yield create_provider_fn(
|
||||
fork_name=fork_name,
|
||||
handler_name=key,
|
||||
tests_src_mod_name=mod_name,
|
||||
config_name=config_name,
|
||||
)
|
||||
|
|
|
@ -37,6 +37,10 @@ ALL_PHASES = (PHASE0, PHASE1, LIGHTCLIENT_PATCH)
|
|||
MAINNET = ConfigName('mainnet')
|
||||
MINIMAL = ConfigName('minimal')
|
||||
|
||||
ALL_CONFIGS = (MINIMAL, MAINNET)
|
||||
|
||||
# The forks that output to the test vectors.
|
||||
TESTGEN_FORKS = (PHASE0, LIGHTCLIENT_PATCH)
|
||||
|
||||
# TODO: currently phases are defined as python modules.
|
||||
# It would be better if they would be more well-defined interfaces for stronger typing.
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
from typing import Iterable
|
||||
|
||||
from gen_base import gen_runner, gen_typing
|
||||
from gen_from_tests.gen import generate_from_tests
|
||||
from gen_from_tests.gen import generate_from_tests, get_provider
|
||||
from importlib import reload, import_module
|
||||
from eth2spec.config import config_util
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.lightclient_patch import spec as spec_lightclient_patch
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH, TESTGEN_FORKS, ALL_CONFIGS
|
||||
from eth2spec.utils import bls
|
||||
|
||||
|
||||
|
@ -15,6 +16,7 @@ def create_provider(fork_name: str, handler_name: str,
|
|||
def prepare_fn(configs_path: str) -> str:
|
||||
config_util.prepare_config(configs_path, config_name)
|
||||
reload(spec_phase0)
|
||||
reload(spec_lightclient_patch)
|
||||
reload(spec_phase1)
|
||||
bls.use_milagro()
|
||||
return config_name
|
||||
|
@ -44,21 +46,28 @@ if __name__ == "__main__":
|
|||
'historical_roots_update',
|
||||
'participation_record_updates',
|
||||
]}
|
||||
lightclient_patch_mods = {
|
||||
**{key: 'eth2spec.test.lightclient_patch.epoch_processing.test_process_' + key for key in [
|
||||
'sync_committee_updates',
|
||||
]},
|
||||
**phase_0_mods,
|
||||
} # also run the previous phase 0 tests
|
||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.epoch_processing.test_process_' + key for key in [
|
||||
'reveal_deadlines',
|
||||
'challenge_deadlines',
|
||||
'custody_final_updates',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests (but against phase 1 spec)
|
||||
|
||||
gen_runner.run_generator(f"epoch_processing", [
|
||||
create_provider(PHASE0, key, mod_name, 'minimal') for key, mod_name in phase_0_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"epoch_processing", [
|
||||
create_provider(PHASE0, key, mod_name, 'mainnet') for key, mod_name in phase_0_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"epoch_processing", [
|
||||
create_provider(PHASE1, key, mod_name, 'minimal') for key, mod_name in phase_1_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"epoch_processing", [
|
||||
create_provider(PHASE1, key, mod_name, 'mainnet') for key, mod_name in phase_1_mods.items()
|
||||
])
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
for config_name in ALL_CONFIGS:
|
||||
for fork_name in TESTGEN_FORKS:
|
||||
if fork_name in all_mods:
|
||||
gen_runner.run_generator(f"epoch_processing", get_provider(
|
||||
create_provider_fn=create_provider, config_name=config_name,
|
||||
fork_name=fork_name, all_mods=all_mods,
|
||||
))
|
||||
|
|
|
@ -1,27 +1,30 @@
|
|||
from typing import Iterable
|
||||
from importlib import reload
|
||||
from importlib import reload, import_module
|
||||
|
||||
from gen_base import gen_runner, gen_typing
|
||||
from gen_from_tests.gen import generate_from_tests
|
||||
from gen_from_tests.gen import generate_from_tests, get_provider
|
||||
|
||||
from eth2spec.test.context import PHASE0, PHASE1
|
||||
from eth2spec.test.phase0.finality import test_finality
|
||||
from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH, TESTGEN_FORKS, ALL_CONFIGS
|
||||
from eth2spec.config import config_util
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.lightclient_patch import spec as spec_lightclient_patch
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.utils import bls
|
||||
|
||||
|
||||
def create_provider(fork_name: str, handler_name: str, tests_src, config_name: str) -> gen_typing.TestProvider:
|
||||
def create_provider(fork_name: str, handler_name: str,
|
||||
tests_src_mod_name: str, config_name: str) -> gen_typing.TestProvider:
|
||||
|
||||
def prepare_fn(configs_path: str) -> str:
|
||||
config_util.prepare_config(configs_path, config_name)
|
||||
reload(spec_phase0)
|
||||
reload(spec_lightclient_patch)
|
||||
reload(spec_phase1)
|
||||
bls.use_milagro()
|
||||
return config_name
|
||||
|
||||
def cases_fn() -> Iterable[gen_typing.TestCase]:
|
||||
tests_src = import_module(tests_src_mod_name)
|
||||
return generate_from_tests(
|
||||
runner_name='finality',
|
||||
handler_name=handler_name,
|
||||
|
@ -33,11 +36,21 @@ def create_provider(fork_name: str, handler_name: str, tests_src, config_name: s
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# No additional phase 1 specific rewards tests, yet.
|
||||
key = 'finality'
|
||||
gen_runner.run_generator("finality", [
|
||||
create_provider(PHASE0, 'finality', test_finality, 'minimal'),
|
||||
create_provider(PHASE0, 'finality', test_finality, 'mainnet'),
|
||||
create_provider(PHASE1, 'finality', test_finality, 'minimal'),
|
||||
create_provider(PHASE1, 'finality', test_finality, 'mainnet'),
|
||||
])
|
||||
phase_0_mods = {'finality': 'eth2spec.test.phase0.finality.test_finality'}
|
||||
# No additional lightclient_patch or phase 1 specific finality tests, yet.
|
||||
lightclient_patch_mods = phase_0_mods
|
||||
phase_1_mods = phase_0_mods
|
||||
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
for config_name in ALL_CONFIGS:
|
||||
for fork_name in TESTGEN_FORKS:
|
||||
if fork_name in all_mods:
|
||||
gen_runner.run_generator(f"finality", get_provider(
|
||||
create_provider_fn=create_provider, config_name=config_name,
|
||||
fork_name=fork_name, all_mods=all_mods,
|
||||
))
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
from typing import Iterable
|
||||
|
||||
from gen_base import gen_runner, gen_typing
|
||||
from gen_from_tests.gen import generate_from_tests
|
||||
from gen_from_tests.gen import generate_from_tests, get_provider
|
||||
from importlib import reload, import_module
|
||||
from eth2spec.config import config_util
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.lightclient_patch import spec as spec_lightclient_patch
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH, TESTGEN_FORKS, ALL_CONFIGS
|
||||
from eth2spec.utils import bls
|
||||
|
||||
|
||||
|
@ -15,6 +16,7 @@ def create_provider(fork_name: str, handler_name: str,
|
|||
def prepare_fn(configs_path: str) -> str:
|
||||
config_util.prepare_config(configs_path, config_name)
|
||||
reload(spec_phase0)
|
||||
reload(spec_lightclient_patch)
|
||||
reload(spec_phase1)
|
||||
bls.use_milagro()
|
||||
return config_name
|
||||
|
@ -40,6 +42,12 @@ if __name__ == "__main__":
|
|||
'proposer_slashing',
|
||||
'voluntary_exit',
|
||||
]}
|
||||
lightclient_patch_mods = {
|
||||
**{key: 'eth2spec.test.lightclient_patch.block_processing.test_process_' + key for key in [
|
||||
'sync_committee',
|
||||
]},
|
||||
**phase_0_mods,
|
||||
} # also run the previous phase 0 tests
|
||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.block_processing.test_process_' + key for key in [
|
||||
'attestation',
|
||||
'chunk_challenge',
|
||||
|
@ -49,15 +57,16 @@ if __name__ == "__main__":
|
|||
'shard_transition',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests (but against phase 1 spec)
|
||||
|
||||
gen_runner.run_generator(f"operations", [
|
||||
create_provider(PHASE0, key, mod_name, 'minimal') for key, mod_name in phase_0_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"operations", [
|
||||
create_provider(PHASE0, key, mod_name, 'mainnet') for key, mod_name in phase_0_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"operations", [
|
||||
create_provider(PHASE1, key, mod_name, 'minimal') for key, mod_name in phase_1_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"operations", [
|
||||
create_provider(PHASE1, key, mod_name, 'mainnet') for key, mod_name in phase_1_mods.items()
|
||||
])
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
for config_name in ALL_CONFIGS:
|
||||
for fork_name in TESTGEN_FORKS:
|
||||
if fork_name in all_mods:
|
||||
gen_runner.run_generator(f"operations", get_provider(
|
||||
create_provider_fn=create_provider, config_name=config_name,
|
||||
fork_name=fork_name, all_mods=all_mods,
|
||||
))
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
from typing import Iterable
|
||||
|
||||
from gen_base import gen_runner, gen_typing
|
||||
from gen_from_tests.gen import generate_from_tests
|
||||
from gen_from_tests.gen import generate_from_tests, get_provider
|
||||
from importlib import reload, import_module
|
||||
from eth2spec.config import config_util
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.lightclient_patch import spec as spec_lightclient_patch
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH, TESTGEN_FORKS, ALL_CONFIGS
|
||||
from eth2spec.utils import bls
|
||||
|
||||
|
||||
|
@ -15,6 +16,7 @@ def create_provider(fork_name: str, handler_name: str,
|
|||
def prepare_fn(configs_path: str) -> str:
|
||||
config_util.prepare_config(configs_path, config_name)
|
||||
reload(spec_phase0)
|
||||
reload(spec_lightclient_patch)
|
||||
reload(spec_phase1)
|
||||
bls.use_milagro()
|
||||
return config_name
|
||||
|
@ -37,18 +39,20 @@ if __name__ == "__main__":
|
|||
'leak',
|
||||
'random',
|
||||
]}
|
||||
# No additional phase 1 specific rewards tests, yet.
|
||||
# No additional lightclient_patch or phase 1 specific rewards tests, yet.
|
||||
lightclient_patch_mods = phase_0_mods
|
||||
phase_1_mods = phase_0_mods
|
||||
|
||||
gen_runner.run_generator(f"rewards", [
|
||||
create_provider(PHASE0, key, mod_name, 'minimal') for key, mod_name in phase_0_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"rewards", [
|
||||
create_provider(PHASE0, key, mod_name, 'mainnet') for key, mod_name in phase_0_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"rewards", [
|
||||
create_provider(PHASE1, key, mod_name, 'minimal') for key, mod_name in phase_1_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"rewards", [
|
||||
create_provider(PHASE1, key, mod_name, 'mainnet') for key, mod_name in phase_1_mods.items()
|
||||
])
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
for config_name in ALL_CONFIGS:
|
||||
for fork_name in TESTGEN_FORKS:
|
||||
if fork_name in all_mods:
|
||||
gen_runner.run_generator(f"rewards", get_provider(
|
||||
create_provider_fn=create_provider, config_name=config_name,
|
||||
fork_name=fork_name, all_mods=all_mods,
|
||||
))
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
from typing import Iterable
|
||||
|
||||
from gen_base import gen_runner, gen_typing
|
||||
from gen_from_tests.gen import generate_from_tests
|
||||
from gen_from_tests.gen import generate_from_tests, get_provider
|
||||
from importlib import reload, import_module
|
||||
from eth2spec.config import config_util
|
||||
from eth2spec.phase0 import spec as spec_phase0
|
||||
from eth2spec.lightclient_patch import spec as spec_lightclient_patch
|
||||
from eth2spec.phase1 import spec as spec_phase1
|
||||
from eth2spec.test.context import PHASE0, PHASE1
|
||||
from eth2spec.test.context import PHASE0, PHASE1, LIGHTCLIENT_PATCH, TESTGEN_FORKS, ALL_CONFIGS
|
||||
from eth2spec.utils import bls
|
||||
|
||||
|
||||
|
@ -15,6 +16,7 @@ def create_provider(fork_name: str, handler_name: str,
|
|||
def prepare_fn(configs_path: str) -> str:
|
||||
config_util.prepare_config(configs_path, config_name)
|
||||
reload(spec_phase0)
|
||||
reload(spec_lightclient_patch)
|
||||
reload(spec_phase1)
|
||||
bls.use_milagro()
|
||||
return config_name
|
||||
|
@ -36,20 +38,24 @@ if __name__ == "__main__":
|
|||
'blocks',
|
||||
'slots',
|
||||
]}
|
||||
lightclient_patch_mods = {**{key: 'eth2spec.test.lightclient_patch.sanity.test_' + key for key in [
|
||||
'blocks',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests
|
||||
phase_1_mods = {**{key: 'eth2spec.test.phase1.sanity.test_' + key for key in [
|
||||
'blocks', # more phase 1 specific block tests
|
||||
'shard_blocks',
|
||||
]}, **phase_0_mods} # also run the previous phase 0 tests (but against phase 1 spec)
|
||||
|
||||
gen_runner.run_generator(f"sanity", [
|
||||
create_provider(PHASE0, key, mod_name, 'minimal') for key, mod_name in phase_0_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"sanity", [
|
||||
create_provider(PHASE0, key, mod_name, 'mainnet') for key, mod_name in phase_0_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"sanity", [
|
||||
create_provider(PHASE1, key, mod_name, 'minimal') for key, mod_name in phase_1_mods.items()
|
||||
])
|
||||
gen_runner.run_generator(f"sanity", [
|
||||
create_provider(PHASE1, key, mod_name, 'mainnet') for key, mod_name in phase_1_mods.items()
|
||||
])
|
||||
all_mods = {
|
||||
PHASE0: phase_0_mods,
|
||||
LIGHTCLIENT_PATCH: lightclient_patch_mods,
|
||||
PHASE1: phase_1_mods,
|
||||
}
|
||||
|
||||
for config_name in ALL_CONFIGS:
|
||||
for fork_name in TESTGEN_FORKS:
|
||||
if fork_name in all_mods:
|
||||
gen_runner.run_generator(f"sanity", get_provider(
|
||||
create_provider_fn=create_provider, config_name=config_name,
|
||||
fork_name=fork_name, all_mods=all_mods,
|
||||
))
|
||||
|
|
Loading…
Reference in New Issue