-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add ability to assert identical functionality for teal programs/methods #36
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having some questions about the type arrangement, mostly around INVARIANT_TYPE
and PredicateKind
.
I am inclined to approve once these questions are resolved.
graviton/invariant.py
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- cost lambda with a single confusingly named
args
argument - final scratch lambda with first parameter
args
and second parameteractual
on_complete: OnComplete = OnComplete.NoOpOC, | ||
dryrun_accounts: List[DryRunAccountType] = [], | ||
) -> Tuple[Sequence["DryRunInspector"], Sequence["DryRunInspector"]]: | ||
return tuple( # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tzaffi Thanks for taking in my feedback here!
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 standardinspectors
parameter of dry run execution results, but also the new parameteridentities
which is a sequence of inspectors used to assert equivalence withinspectors
Invariant.validates()
to accept theidentities
parameterPredicateKind
to better signal which kind of predicate is being supplied to anInvariant
PredicateKind.IdenticalPair
acts 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.