2021-04-28 00:24:15 +00:00
|
|
|
from typing import Iterable
|
|
|
|
|
2021-10-29 15:17:57 +00:00
|
|
|
from eth2spec.test.helpers.constants import (
|
|
|
|
MINIMAL,
|
|
|
|
MAINNET,
|
2021-11-12 09:06:10 +00:00
|
|
|
ALL_PRE_POST_FORKS,
|
2021-10-29 15:17:57 +00:00
|
|
|
)
|
|
|
|
from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
|
|
|
|
from eth2spec.gen_helpers.gen_from_tests.gen import (
|
|
|
|
generate_from_tests,
|
|
|
|
)
|
2021-10-12 16:26:23 +00:00
|
|
|
from eth2spec.test.altair.transition import (
|
|
|
|
test_transition as test_altair_transition,
|
2021-10-14 13:45:33 +00:00
|
|
|
test_activations_and_exits as test_altair_activations_and_exits,
|
2021-10-12 16:26:23 +00:00
|
|
|
test_leaking as test_altair_leaking,
|
|
|
|
test_slashing as test_altair_slashing,
|
2021-10-14 15:29:20 +00:00
|
|
|
test_operations as test_altair_operations,
|
2021-10-12 16:26:23 +00:00
|
|
|
)
|
2023-02-07 23:22:28 +00:00
|
|
|
from eth2spec.test.deneb.transition import (
|
|
|
|
test_operations as test_deneb_operations,
|
2023-01-27 09:48:00 +00:00
|
|
|
)
|
2021-04-28 00:24:15 +00:00
|
|
|
|
|
|
|
|
2021-05-18 16:29:24 +00:00
|
|
|
def create_provider(tests_src, preset_name: str, pre_fork_name: str, post_fork_name: str) -> gen_typing.TestProvider:
|
2021-04-28 00:24:15 +00:00
|
|
|
|
2021-05-18 16:29:24 +00:00
|
|
|
def prepare_fn() -> None:
|
|
|
|
return
|
2021-04-28 00:24:15 +00:00
|
|
|
|
|
|
|
def cases_fn() -> Iterable[gen_typing.TestCase]:
|
|
|
|
return generate_from_tests(
|
|
|
|
runner_name='transition',
|
|
|
|
handler_name='core',
|
|
|
|
src=tests_src,
|
|
|
|
fork_name=post_fork_name,
|
|
|
|
phase=pre_fork_name,
|
2021-05-18 16:29:24 +00:00
|
|
|
preset_name=preset_name,
|
2021-04-28 00:24:15 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
return gen_typing.TestProvider(prepare=prepare_fn, make_cases=cases_fn)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-01-27 09:48:00 +00:00
|
|
|
all_tests = (
|
2021-10-29 15:17:57 +00:00
|
|
|
test_altair_transition,
|
|
|
|
test_altair_activations_and_exits,
|
|
|
|
test_altair_leaking,
|
|
|
|
test_altair_slashing,
|
|
|
|
test_altair_operations,
|
2023-02-07 23:22:28 +00:00
|
|
|
test_deneb_operations,
|
2021-10-29 15:17:57 +00:00
|
|
|
)
|
2021-11-12 09:06:10 +00:00
|
|
|
for transition_test_module in all_tests:
|
2021-11-02 11:01:32 +00:00
|
|
|
for pre_fork, post_fork in ALL_PRE_POST_FORKS:
|
2021-10-29 15:17:57 +00:00
|
|
|
gen_runner.run_generator("transition", [
|
|
|
|
create_provider(transition_test_module, MINIMAL, pre_fork, post_fork),
|
|
|
|
create_provider(transition_test_module, MAINNET, pre_fork, post_fork),
|
|
|
|
])
|