diff --git a/test_generators/epoch_processing/main.py b/test_generators/epoch_processing/main.py index 530f9485d..14df53aba 100644 --- a/test_generators/epoch_processing/main.py +++ b/test_generators/epoch_processing/main.py @@ -32,8 +32,7 @@ def create_suite(transition_name: str, config_name: str, get_cases: Callable[[], if __name__ == "__main__": gen_runner.run_generator("epoch_processing", [ create_suite('crosslinks', 'minimal', lambda: generate_from_tests(test_process_crosslinks)), - # To be updated to support mainnet config. - # create_suite('crosslinks', 'mainnet', lambda: generate_from_tests(test_process_crosslinks)), + create_suite('crosslinks', 'mainnet', lambda: generate_from_tests(test_process_crosslinks)), create_suite('registry_updates', 'minimal', lambda: generate_from_tests(test_process_registry_updates)), create_suite('registry_updates', 'mainnet', lambda: generate_from_tests(test_process_registry_updates)), ]) diff --git a/test_libs/gen_helpers/gen_from_tests/gen.py b/test_libs/gen_helpers/gen_from_tests/gen.py index 1b9d60f7e..d954e0485 100644 --- a/test_libs/gen_helpers/gen_from_tests/gen.py +++ b/test_libs/gen_helpers/gen_from_tests/gen.py @@ -16,7 +16,10 @@ def generate_from_tests(src, bls_active=True): for name in fn_names: tfn = getattr(src, name) try: - out.append(tfn(generator_mode=True, bls_active=bls_active)) + test_case = tfn(generator_mode=True, bls_active=bls_active)) + # If no test case data is returned, the test is ignored. + if test_case is not None: + out.append(test_case) except AssertionError: print("ERROR: failed to generate vector from test: %s (src: %s)" % (name, src.__name__)) return out diff --git a/test_libs/pyspec/eth2spec/test/epoch_processing/test_process_crosslinks.py b/test_libs/pyspec/eth2spec/test/epoch_processing/test_process_crosslinks.py index 4783c11d1..58c7b669f 100644 --- a/test_libs/pyspec/eth2spec/test/epoch_processing/test_process_crosslinks.py +++ b/test_libs/pyspec/eth2spec/test/epoch_processing/test_process_crosslinks.py @@ -104,6 +104,10 @@ def test_single_crosslink_update_from_previous_epoch(state): @spec_state_test def test_double_late_crosslink(state): + if spec.SLOTS_PER_EPOCH < spec.SHARD_COUNT: + print("warning: ignoring test, test-assumptions are incompatible with configuration") + return + next_epoch(state) state.slot += 4 diff --git a/test_libs/pyspec/eth2spec/test/utils.py b/test_libs/pyspec/eth2spec/test/utils.py index c1d424109..02bc9a1e6 100644 --- a/test_libs/pyspec/eth2spec/test/utils.py +++ b/test_libs/pyspec/eth2spec/test/utils.py @@ -19,8 +19,10 @@ def spectest(description: str = None): else: # description can be explicit out['description'] = description + has_contents = False # put all generated data into a dict. for data in fn(*args, **kw): + has_contents = True # If there is a type argument, encode it as that type. if len(data) == 3: (key, value, typ) = data @@ -32,11 +34,15 @@ def spectest(description: str = None): out[key] = encode(value, value.__class__) else: out[key] = value - return out + if has_contents: + return out + else: + return None else: # just complete the function, ignore all yielded data, we are not using it for _ in fn(*args, **kw): continue + return None return entry return runner