Add ability to assert identical functionality for teal programs/methods#36
Merged
Add ability to assert identical functionality for teal programs/methods#36
Conversation
added 2 commits
November 14, 2022 09:46
ahangsu
reviewed
Nov 14, 2022
Contributor
ahangsu
left a comment
There was a problem hiding this comment.
having some questions about the type arrangement, mostly around INVARIANT_TYPE and PredicateKind.
I am inclined to approve once these questions are resolved.
Comment on lines
+46
to
+52
| N = len(sig.parameters) | ||
| assert N in (1, 2), f"predicate has the wrong number of paramters {N}" | ||
|
|
||
| if N == 2: | ||
| return PredicateKind.RangeMatch | ||
|
|
||
| return PredicateKind.ExactMatch |
Contributor
There was a problem hiding this comment.
Another dumb question: the callable object seems to be having only 1 or 2 argument, could you pin point me any examples of INVARIANT_TYPE falling into the 2 categories?
Contributor
Author
There was a problem hiding this comment.
- cost lambda with a single confusingly named
argsargument - final scratch lambda with first parameter
argsand second parameteractual
ahangsu
reviewed
Nov 14, 2022
ahangsu
approved these changes
Nov 15, 2022
6 tasks
tzaffi
commented
Nov 17, 2022
| on_complete: OnComplete = OnComplete.NoOpOC, | ||
| dryrun_accounts: List[DryRunAccountType] = [], | ||
| ) -> Tuple[Sequence["DryRunInspector"], Sequence["DryRunInspector"]]: | ||
| return tuple( # type: ignore |
Contributor
Author
There was a problem hiding this comment.
to the best of my current understand, to fix this type-hints issue would require an upgrade to python 3.11
Co-authored-by: Michael Diamant <michaeldiamant@users.noreply.github.com>
michaeldiamant
approved these changes
Dec 7, 2022
Contributor
michaeldiamant
left a comment
There was a problem hiding this comment.
@tzaffi Thanks for taking in my feedback here!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test one teal program against another, with the optionality of using ABI
New functionality
The best place to see the new capabilities is in identical_test.py
Invariant.full_validation()that accepts the standardinspectorsparameter of dry run execution results, but also the new parameteridentitieswhich is a sequence of inspectors used to assert equivalence withinspectorsInvariant.validates()to accept theidentitiesparameterPredicateKindto better signal which kind of predicate is being supplied to anInvariantPredicateKind.IdenticalPairacts as a sentinel for asserting that two dry-run execution scenarios are identicalTesting
C.I.
Also, C.I. in PyTeal PR #605 provides additional coverage.