-
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
ABI Functionality #13
Conversation
assert isinstance( | ||
arg, (int, str) | ||
arg, (bytes, int, str) |
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.
@barnjamin - This is in the spirit of your PR and allows bytes
through unimpeded
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 finding a way to extend graviton to work with ABI types. ☕
Considering the breadth of tests added here + algorand/pyteal#322, I feel like the PR proves it's ready to be merged.
Handle ABI types for Graviton Dry Runs
Summary of Changes
CHANGELOG.md
- update with upcomingv0.2.0
aka 🐗Makefile
-make all-tests
optiongraviton/blackbox.py
-DryRunEncoder
- allow specifyingabi_types
by supplying as a list parameter toencode_args()
method. When present, the list needs to be the same length as theargs
being encoded. WhenNone
is supplied as anabi_type
the corresponding arg is not encoded.DryRunExecutor
- allow specifyingabi_argument_types
as well as anabi_return_type
.abi_argument_types
are handed off to theDryRunEncoder
for encoding purposes, while after dry-run execution,abi_return_type
is given to the resultingDryRunInspector
for ABI-decoding into Python.DryRunInspector
- allow specifying anabi_type
. When anabi_type
is provided,last_log()
will be decoded using that type after removal of a presumed 4-byte return prefix. To suppress removing the 4-byte prefix setconfig(has_abi_prefix=False)
. To suppress decoding the last log entry altogether, and show the raw hex, setconfig(suppress_abi=True)
.tests/integration/abi_test.py
- new integration test that uses PyTeal generatedsum_abi
program to sum the array[1, 2, 3, 4, 5]
and assert that the result is indeed 15tests/unit/encode_test.py
- new unit test forDryRunEncoder