Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phase restricted generators #1165

Merged
merged 12 commits into from
Jun 11, 2019
Merged

phase restricted generators #1165

merged 12 commits into from
Jun 11, 2019

Conversation

djrtwo
Copy link
Contributor

@djrtwo djrtwo commented Jun 10, 2019

  • Allow for passing phase explicitly into generate_from_tests
  • update test generators to explicitly call 'phase0'
  • remove transfer test from sanity tests for time being to avoid config issue

@djrtwo
Copy link
Contributor Author

djrtwo commented Jun 11, 2019

Getting an error when writing state to yaml file. Looks like it's having trouble writing an embedded object within state. slot: 9 is the first field of state.latest_block_header.

Traceback (most recent call last):
  File "main.py", line 54, in <module>
    create_suite('voluntary_exit',    'mainnet', lambda: generate_from_tests(test_process_voluntary_exit, 'phase0')),
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/gen_base/gen_runner.py", line 111, in run_generator
    yaml.dump(suite, f)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/main.py", line 439, in dump
    return self.dump_all([data], stream, _kw, transform=transform)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/main.py", line 453, in dump_all
    self._context_manager.dump(data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/main.py", line 801, in dump
    self._yaml.representer.represent(data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 84, in represent
    node = self.represent_data(data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 111, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 359, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 1017, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 111, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 349, in represent_list
    return self.represent_sequence(u'tag:yaml.org,2002:seq', data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 933, in represent_sequence
    node_item = self.represent_data(item)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 111, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 359, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 1017, in represent_mapping
    node_value = self.represent_data(item_value)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 121, in represent_data
    node = self.yaml_representers[None](self, data)
  File "/Users/djrtwo/dev/ethereum/eth2.0-specs/test_generators/operations/venv/lib/python3.6/site-packages/ruamel/yaml/representer.py", line 392, in represent_undefined
    raise RepresenterError('cannot represent an object: %s' % (data,))
ruamel.yaml.representer.RepresenterError: cannot represent an object: slot: 9

Gotta switch gears for evening. This the last thing we need to do before v0.7.0 release

@protolambda
Copy link
Collaborator

sorry, fixed typo 😅

@djrtwo djrtwo changed the title [WIP] phase restricted generators phase restricted generators Jun 11, 2019
@djrtwo djrtwo requested a review from protolambda June 11, 2019 15:11
@protolambda
Copy link
Collaborator

protolambda commented Jun 11, 2019

Ok, ran all generators, and it runs within ~16 minutes, and produces 400MB worth of yaml test vectors. However, I had excluded the mainnet attestation operation tests, as there are single test cases in there, that take over 12 minutes to run with the mainnet configuration. (tried, profiled, created call-graphs, compared ssz-implementations, but to no avail: the tests are just running insane amounts of hash-tree-root calls (incl recursive, in the tens of millions of calls....)
I recommend to comment out the test-generator line in operations/main.py to disable those super slow mainnet tests:

        # create_suite('attestation',       'mainnet', lambda: generate_from_tests(test_process_attestation, 'phase0')),

Instead, we can release without them, and re-enable when we have SSZ caching, instead of just a small zero-hash optimization. Or someone has to invest some serious time in changing those tests, while still keeping them compatible with the original test intentions.
Edit, alternatively we run them anyway (will take very long), and include them. As clients will still be running the same single process_attestation calls. It's just the setup of the test scenario that takes a long time.

@djrtwo djrtwo merged commit 577f76a into dev Jun 11, 2019
@djrtwo djrtwo deleted the phase-generators branch June 11, 2019 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants