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
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