diff --git a/test_generators/epoch_processing/main.py b/test_generators/epoch_processing/main.py index 8f067e4a3..2ce895fc5 100644 --- a/test_generators/epoch_processing/main.py +++ b/test_generators/epoch_processing/main.py @@ -1,6 +1,7 @@ from typing import Callable, Iterable -from eth2spec.phase0 import spec +from eth2spec.phase0 import spec as spec_phase0 +from eth2spec.phase1 import spec as spec_phase1 from eth2spec.test.epoch_processing import ( test_process_crosslinks, test_process_registry_updates @@ -14,7 +15,8 @@ def create_suite(transition_name: str, config_name: str, get_cases: Callable[[], -> Callable[[str], gen_typing.TestSuiteOutput]: def suite_definition(configs_path: str) -> gen_typing.TestSuiteOutput: presets = loader.load_presets(configs_path, config_name) - spec.apply_constants_preset(presets) + spec_phase0.apply_constants_preset(presets) + spec_phase1.apply_constants_preset(presets) return ("%s_%s" % (transition_name, config_name), transition_name, gen_suite.render_suite( title="%s epoch processing" % transition_name, diff --git a/test_generators/operations/main.py b/test_generators/operations/main.py index 0a487ae74..82e05b307 100644 --- a/test_generators/operations/main.py +++ b/test_generators/operations/main.py @@ -13,14 +13,16 @@ from eth2spec.test.block_processing import ( from gen_base import gen_runner, gen_suite, gen_typing from gen_from_tests.gen import generate_from_tests from preset_loader import loader -from eth2spec.phase0 import spec +from eth2spec.phase0 import spec as spec_phase0 +from eth2spec.phase1 import spec as spec_phase1 def create_suite(operation_name: str, config_name: str, get_cases: Callable[[], Iterable[gen_typing.TestCase]]) \ -> Callable[[str], gen_typing.TestSuiteOutput]: def suite_definition(configs_path: str) -> gen_typing.TestSuiteOutput: presets = loader.load_presets(configs_path, config_name) - spec.apply_constants_preset(presets) + spec_phase0.apply_constants_preset(presets) + spec_phase1.apply_constants_preset(presets) return ("%s_%s" % (operation_name, config_name), operation_name, gen_suite.render_suite( title="%s operation" % operation_name, diff --git a/test_generators/sanity/main.py b/test_generators/sanity/main.py index bba6ed03d..a9c0fe160 100644 --- a/test_generators/sanity/main.py +++ b/test_generators/sanity/main.py @@ -5,14 +5,16 @@ from eth2spec.test.sanity import test_blocks, test_slots from gen_base import gen_runner, gen_suite, gen_typing from gen_from_tests.gen import generate_from_tests from preset_loader import loader -from eth2spec.phase0 import spec +from eth2spec.phase0 import spec as spec_phase0 +from eth2spec.phase1 import spec as spec_phase1 def create_suite(handler_name: str, config_name: str, get_cases: Callable[[], Iterable[gen_typing.TestCase]]) \ -> Callable[[str], gen_typing.TestSuiteOutput]: def suite_definition(configs_path: str) -> gen_typing.TestSuiteOutput: presets = loader.load_presets(configs_path, config_name) - spec.apply_constants_preset(presets) + spec_phase0.apply_constants_preset(presets) + spec_phase1.apply_constants_preset(presets) return ("%sanity_s_%s" % (handler_name, config_name), handler_name, gen_suite.render_suite( title="sanity testing", diff --git a/test_generators/shuffling/main.py b/test_generators/shuffling/main.py index 711597189..862c4d910 100644 --- a/test_generators/shuffling/main.py +++ b/test_generators/shuffling/main.py @@ -1,4 +1,5 @@ -from eth2spec.phase0 import spec +from eth2spec.phase0 import spec as spec_phase0 +from eth2spec.phase1 import spec as spec_phase1 from eth_utils import ( to_dict, to_tuple ) @@ -22,7 +23,8 @@ def shuffling_test_cases(): def mini_shuffling_suite(configs_path: str) -> gen_typing.TestSuiteOutput: presets = loader.load_presets(configs_path, 'minimal') - spec.apply_constants_preset(presets) + spec_phase0.apply_constants_preset(presets) + spec_phase1.apply_constants_preset(presets) return ("shuffling_minimal", "core", gen_suite.render_suite( title="Swap-or-Not Shuffling tests with minimal config", @@ -37,7 +39,8 @@ def mini_shuffling_suite(configs_path: str) -> gen_typing.TestSuiteOutput: def full_shuffling_suite(configs_path: str) -> gen_typing.TestSuiteOutput: presets = loader.load_presets(configs_path, 'mainnet') - spec.apply_constants_preset(presets) + spec_phase0.apply_constants_preset(presets) + spec_phase1.apply_constants_preset(presets) return ("shuffling_full", "core", gen_suite.render_suite( title="Swap-or-Not Shuffling tests with mainnet config", diff --git a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py index ece5f3ef5..587c37742 100644 --- a/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py +++ b/test_libs/pyspec/eth2spec/test/sanity/test_blocks.py @@ -74,25 +74,25 @@ def test_empty_epoch_transition(spec, state): assert spec.get_block_root_at_slot(state, slot) == block.parent_root -@with_all_phases -@spec_state_test -def test_empty_epoch_transition_not_finalizing(spec, state): - # copy for later balance lookups. - pre_state = deepcopy(state) - yield 'pre', state +# @with_all_phases +# @spec_state_test +# def test_empty_epoch_transition_not_finalizing(spec, state): +# # copy for later balance lookups. +# pre_state = deepcopy(state) +# yield 'pre', state - block = build_empty_block_for_next_slot(spec, state) - block.slot += spec.SLOTS_PER_EPOCH * 5 - sign_block(spec, state, block, proposer_index=0) - yield 'blocks', [block], List[spec.BeaconBlock] +# block = build_empty_block_for_next_slot(spec, state) +# block.slot += spec.SLOTS_PER_EPOCH * 5 +# sign_block(spec, state, block, proposer_index=0) +# yield 'blocks', [block], List[spec.BeaconBlock] - spec.state_transition(state, block) - yield 'post', state +# spec.state_transition(state, block) +# yield 'post', state - assert state.slot == block.slot - assert state.finalized_epoch < spec.get_current_epoch(state) - 4 - for index in range(len(state.validator_registry)): - assert get_balance(state, index) < get_balance(pre_state, index) +# assert state.slot == block.slot +# assert state.finalized_epoch < spec.get_current_epoch(state) - 4 +# for index in range(len(state.validator_registry)): +# assert get_balance(state, index) < get_balance(pre_state, index) @with_all_phases @@ -381,29 +381,29 @@ def test_historical_batch(spec, state): assert len(state.historical_roots) == pre_historical_roots_len + 1 -@with_all_phases -@spec_state_test -def test_eth1_data_votes(spec, state): - yield 'pre', state +# @with_all_phases +# @spec_state_test +# def test_eth1_data_votes(spec, state): +# yield 'pre', state - expected_votes = 0 - assert len(state.eth1_data_votes) == expected_votes +# expected_votes = 0 +# assert len(state.eth1_data_votes) == expected_votes - blocks = [] - for _ in range(spec.SLOTS_PER_ETH1_VOTING_PERIOD - 1): - block = build_empty_block_for_next_slot(spec, state) - spec.state_transition(state, block) - expected_votes += 1 - assert len(state.eth1_data_votes) == expected_votes - blocks.append(block) +# blocks = [] +# for _ in range(spec.SLOTS_PER_ETH1_VOTING_PERIOD - 1): +# block = build_empty_block_for_next_slot(spec, state) +# spec.state_transition(state, block) +# expected_votes += 1 +# assert len(state.eth1_data_votes) == expected_votes +# blocks.append(block) - block = build_empty_block_for_next_slot(spec, state) - blocks.append(block) +# block = build_empty_block_for_next_slot(spec, state) +# blocks.append(block) - spec.state_transition(state, block) +# spec.state_transition(state, block) - yield 'blocks', [block], List[spec.BeaconBlock] - yield 'post', state +# yield 'blocks', [block], List[spec.BeaconBlock] +# yield 'post', state - assert state.slot % spec.SLOTS_PER_ETH1_VOTING_PERIOD == 0 - assert len(state.eth1_data_votes) == 1 +# assert state.slot % spec.SLOTS_PER_ETH1_VOTING_PERIOD == 0 +# assert len(state.eth1_data_votes) == 1