clean up fork gens

This commit is contained in:
Danny Ryan 2021-03-09 16:27:06 -07:00
parent f9b54ea03b
commit 338be1f636
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
2 changed files with 7 additions and 6 deletions

View File

@ -3,7 +3,7 @@
The aim of the fork tests is to ensure that a pre-fork state can be transformed The aim of the fork tests is to ensure that a pre-fork state can be transformed
into a valid post-fork state, utilizing the `upgrade` function found in the relevant `fork.md` spec. into a valid post-fork state, utilizing the `upgrade` function found in the relevant `fork.md` spec.
There is only one handler: `core`. Each fork (after genesis) is handled with the same format, There is only one handler: `fork`. Each fork (after genesis) is handled with the same format,
and the particular fork boundary being tested is noted in `meta.yaml`. and the particular fork boundary being tested is noted in `meta.yaml`.
## Test case format ## Test case format

View File

@ -11,7 +11,7 @@ from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
from eth2spec.gen_helpers.gen_from_tests.gen import generate_from_tests from eth2spec.gen_helpers.gen_from_tests.gen import generate_from_tests
def create_provider(tests_src, config_name: str) -> gen_typing.TestProvider: def create_provider(tests_src, config_name: str, phase: str, fork_name: str) -> gen_typing.TestProvider:
def prepare_fn(configs_path: str) -> str: def prepare_fn(configs_path: str) -> str:
config_util.prepare_config(configs_path, config_name) config_util.prepare_config(configs_path, config_name)
@ -24,8 +24,9 @@ def create_provider(tests_src, config_name: str) -> gen_typing.TestProvider:
runner_name='fork', runner_name='fork',
handler_name='fork', handler_name='fork',
src=tests_src, src=tests_src,
fork_name=LIGHTCLIENT_PATCH, fork_name=fork_name,
phase=PHASE0, phase=phase,
) )
return gen_typing.TestProvider(prepare=prepare_fn, make_cases=cases_fn) return gen_typing.TestProvider(prepare=prepare_fn, make_cases=cases_fn)
@ -33,6 +34,6 @@ def create_provider(tests_src, config_name: str) -> gen_typing.TestProvider:
if __name__ == "__main__": if __name__ == "__main__":
gen_runner.run_generator("forks", [ gen_runner.run_generator("forks", [
create_provider(test_altair_forks, MINIMAL), create_provider(test_altair_forks, MINIMAL, PHASE0, LIGHTCLIENT_PATCH),
create_provider(test_altair_forks, MAINNET), create_provider(test_altair_forks, MAINNET, PHASE0, LIGHTCLIENT_PATCH),
]) ])