ignore just the one crosslinks case that is incompatible with mainnet

This commit is contained in:
protolambda 2019-05-23 22:26:36 +02:00
parent 3500bde594
commit f0c9e7a395
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
4 changed files with 16 additions and 4 deletions

View File

@ -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)),
])

View File

@ -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

View File

@ -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

View File

@ -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