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

Refactor Dry Run Execution #44

Closed
wants to merge 36 commits into from

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented Dec 31, 2022

Note for reviewers.

The diff in graviton_blackbox.py is difficult to read through. Instead of looking at the diff, I encourage looking at the actual code. Additionally, this is a testing library, and therefore (IMO) we can gain most of the confidence by looking at the resulting tests both here and in the companion pyteal PR.

Issues Addressed

Summary of changes

  • graviton/blackbox.py - this one's hard to grok because I reordered the classes. In addition:
    • Introducing class DryRunTransactionParams for better grouping of some variables
    • Trimming stale comments
    • class DryRunExecutor:
      • Removed all the static dryrun_* methods and consolidated functionality as follows:
      • It is now expected that the user will instantiate a DryRunExecutor object and call run() on it. Convenience methods run_one() and run_sequence() are also provided, and these have better type guarantees.
  • *_test.py and quadratic_factoring_game.ipynb - Migrating all the tests to use run_one() and run_sequence() methods (except for the usage of AbiContractExecutor.dry_run_on_sequence() which remains unaffected)

TODO's

@@ -260,1287 +274,1269 @@ def final_as_row(self) -> dict:
}


class DryRunEncoder:
"""Encoding utilities for dry run executions and results"""
class DryRunInspector:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moving class up which causes a big diff

Copy link
Contributor

Choose a reason for hiding this comment

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

@tzaffi For future PRs - As a reviewer, I prefer to isolate source code moves, particularly when the PR otherwise makes extensive changes. As presented, it complicates the review process because I feel I can't rely on the diff.

Local Delta:
[]
===============
TXN AS ROW: {' Run': 0, ' budget_added': None, ' budget_consumed': None, ' cost': None, ' last_log': '`None', ' final_message': 'PASS', ' Status': 'PASS', 'steps': 10, ' top_of_stack': 4, 'max_stack_height': 2, 's@000': 2, 'Arg_00': 2}
Copy link
Contributor Author

@tzaffi tzaffi Jan 1, 2023

Choose a reason for hiding this comment

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

Real Diffs: budget_added + budget_consumed (None because this is a logic sig)

CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines 1158 to 1159
TODO: eliminate type-switch on inputs using
functools: singledispatch + partial
Copy link
Contributor

Choose a reason for hiding this comment

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

@tzaffi Sanity-checking PR scope: Is the highlighted TODO intended to be addressed in-scope to the PR?

Based on the related issue, it seems like yes. Though it might be the case that you're looking to hold off due to the size of changes already involved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is more of "a wish" than a todo. After writing this I decided internally not to pursue for now. But I forgot to remove the TODO. I'll remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed it

Co-authored-by: Michael Diamant <michaeldiamant@users.noreply.github.com>
Copy link
Contributor Author

@tzaffi tzaffi left a comment

Choose a reason for hiding this comment

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

proposed commits

graviton/blackbox.py Outdated Show resolved Hide resolved
@tzaffi tzaffi deleted the branch algorand:api-tightening January 3, 2023 22:21
@tzaffi tzaffi closed this Jan 3, 2023
@tzaffi tzaffi mentioned this pull request Jan 3, 2023
1 task
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

2 participants