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

ABI Functionality #13

Merged
merged 21 commits into from
May 13, 2022
Merged

ABI Functionality #13

merged 21 commits into from
May 13, 2022

Conversation

tzaffi
Copy link
Contributor

@tzaffi tzaffi commented May 4, 2022

Handle ABI types for Graviton Dry Runs

Summary of Changes

  • CHANGELOG.md - update with upcoming v0.2.0 aka 🐗
  • Makefile - make all-tests option
  • graviton/blackbox.py -
    • DryRunEncoder - allow specifying abi_types by supplying as a list parameter to encode_args() method. When present, the list needs to be the same length as the args being encoded. When None is supplied as an abi_type the corresponding arg is not encoded.
    • DryRunExecutor - allow specifying abi_argument_types as well as an abi_return_type . abi_argument_types are handed off to the DryRunEncoder for encoding purposes, while after dry-run execution, abi_return_type is given to the resulting DryRunInspector for ABI-decoding into Python.
    • DryRunInspector - allow specifying an abi_type. When an abi_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 set config(has_abi_prefix=False). To suppress decoding the last log entry altogether, and show the raw hex, set config(suppress_abi=True).
  • tests/integration/abi_test.py - new integration test that uses PyTeal generated sum_abi program to sum the array [1, 2, 3, 4, 5] and assert that the result is indeed 15
  • tests/unit/encode_test.py - new unit test for DryRunEncoder

@tzaffi tzaffi marked this pull request as draft May 4, 2022 01:32
@tzaffi tzaffi changed the title WIP: Abi ABI Functionality May 8, 2022
Zeph Grunschlag added 2 commits May 8, 2022 07:29
@tzaffi tzaffi marked this pull request as ready for review May 8, 2022 11:31
@tzaffi tzaffi requested a review from barnjamin May 8, 2022 11:34
assert isinstance(
arg, (int, str)
arg, (bytes, int, str)
Copy link
Contributor Author

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

Copy link
Contributor

@michaeldiamant michaeldiamant left a 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.

@tzaffi tzaffi merged commit 68dcbef into main May 13, 2022
@tzaffi tzaffi deleted the abi branch May 13, 2022 03:18
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.

2 participants