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

Allow Modifying Transaction in Dry Run and Other Improvements #9

Closed
wants to merge 39 commits into from

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented Apr 6, 2022

Summary of Changes

  • .github/workflows/build.yml + Makefile:
    • allow testing and running jupyter notebooks
  • graviton/blackbox.py:
    • pass mypy
    • allow specifying transaction params into dry-runs
  • graviton/dryrun.py:
    • pass mypy
  • graviton/deprecated_dry_run.py: new module that contains functionality mostly used by the now deprecated DryRunTestCaseMixin
  • graviton/deprecated_dryrun_mixin.py: where the now deprecated DryRunTestCaseMixin is defined
  • graviton/dryrun.py:
    • refactor to keep only the most useful portions of the original helper
    • make mypy pass
    • allow specifying transaction parameters
    • pprint() now returns a string, in addition to printing
  • graviton/invariant.py: make mypy pass
  • graviton/models.py: new module that contains lightweight models such as the App and LSig dataclasses
  • mypy.ini: needed by mypy
  • notebooks: new directory for Jupyter notebooks. It contains:
    • IMAGES.md: a static file that shows examples of 3D graphs of dry-runs
    • notebooks/notebooks_test.ipynb: explains how to test notebooks with pytest
    • notebooks/quadratic_factoring_game.ipynb: Blackbox demo
  • setup.py: new Jupyter notebooks requirements, and declaration for receiving projects that this package is typed
  • tests/integration/algod_test.py: separate out the test that algod is alive and well into a seperate integration test, for easier debugging
  • tests/integration/algod_test.py: small refactoring, mostly for mypy
  • tests/integration/dryrun_mixin_docs_test.py: refactoring mostly due to deprecations
  • tests/integration/lsig_test.py: New logic sig only test. THIS NEEDS A CLEANUP.

adding pytest-xdist for faster integration testing.

Comparison on github:

  • Before
    (58.19 secs for python 3.10)
  • After
    (37.64 secs for python 3.10)

Local test comparison:

Runniing with a single thread:

❯ make integration-test NUM_PROCS=1

 ... 

================================================================== slowest 10 durations ===================================================================
16.47s call     tests/integration/blackbox_test.py::test_app_with_report[app_slow_fibonacci]
8.85s call     tests/integration/blackbox_test.py::test_logicsig_with_report[lsig_slow_fibonacci]
5.03s call     tests/integration/blackbox_test.py::test_logicsig_with_report[lsig_string_mult]
4.83s call     tests/integration/blackbox_test.py::test_app_with_report[app_string_mult]
4.70s call     tests/integration/lsig_test.py::test_factorizer_game_version_report[V4]
4.25s call     tests/integration/lsig_test.py::test_factorizer_game_version_report[V3]
3.90s call     tests/integration/lsig_test.py::test_factorizer_report_with_pymnt
3.56s call     tests/integration/lsig_test.py::test_factorizer_game_version_report[V2]
2.43s call     tests/integration/lsig_test.py::test_factorizer_game_version_report[V1]
1.49s call     tests/integration/dryrun_mixin_docs_test.py::ExampleTestCase::test_factorial
========= 1737 passed in 82.38s (0:01:22) ========= 

With

❯ make integration-test

...

================================================================== slowest 10 durations ===================================================================
38.58s call     tests/integration/blackbox_test.py::test_app_with_report[app_slow_fibonacci]
25.53s call     tests/integration/blackbox_test.py::test_logicsig_with_report[lsig_slow_fibonacci]
19.45s call     tests/integration/lsig_test.py::test_factorizer_game_version_report[V4]
18.16s call     tests/integration/lsig_test.py::test_factorizer_game_version_report[V3]
18.12s call     tests/integration/blackbox_test.py::test_app_with_report[app_string_mult]
16.77s call     tests/integration/blackbox_test.py::test_logicsig_with_report[lsig_string_mult]
6.77s call     tests/integration/dryrun_mixin_docs_test.py::ExampleTestCase::test_factorial
5.49s call     tests/integration/lsig_test.py::test_factorizer_report_with_pymnt
4.59s call     tests/integration/lsig_test.py::test_factorizer_game_version_report[V1]
3.27s call     tests/integration/lsig_test.py::test_factorizer_game_version_report[V2]
========= 1737 passed in 44.31s =========

@tzaffi tzaffi marked this pull request as draft April 6, 2022 02:47
@tzaffi tzaffi changed the title WIP: Fuzz WIP: Allow Modifying Transaction in Dry Run Apr 8, 2022
@tzaffi tzaffi mentioned this pull request Apr 12, 2022
3 tasks
@@ -57,4 +68,4 @@ gh-sandbox-test:

gh-blackbox-smoke: blackbox-smoke-prefix gh-sandbox-test

gh-blackbox: gh-blackbox-smoke integration-test
gh-blackbox: gh-blackbox-smoke integration-test notebooks-test
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing jupyter notebooks as well

@@ -126,16 +133,16 @@ def line_or_err(i, ln):
), f"mismatch of lengths in tls v. stacks ({N} v. {len(stacks)})"

# process scratch var's
scratches = [
_scr1 = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed to rename throw-away variables to make mypy happy

@tzaffi tzaffi changed the title WIP: Allow Modifying Transaction in Dry Run Allow Modifying Transaction in Dry Run and Other Improvements Apr 20, 2022
@tzaffi tzaffi marked this pull request as ready for review April 20, 2022 17:59
README.md Outdated Show resolved Hide resolved
graviton/README.md Outdated Show resolved Hide resolved
@tzaffi tzaffi closed this May 14, 2022
@tzaffi
Copy link
Contributor Author

tzaffi commented May 14, 2022

TODO: delete branch after #17 merged

@tzaffi tzaffi deleted the fuzz branch May 17, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant