You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See below for a list of DryRunExecutor methods that allow executing dryruns. It is cumbersome and confusing to have so many methods that basically do the same thing. Ideally, it would be nice to have a single method with the following API:
Currently, graviton's dry run execution are inconsistent in how abi-information is handled. Some allow abi_argument_types and abi_return_types to be provided while some also allow abi_method_signature to be provided. The last parameter includes all the information that abi_argument_types and abi_return_types provides and therefore it is confusing to provide all the parameters.
After an investigation into the usage of dry run execution in PyTeal, it became apparent that in all relevant situations, an ABIReturnSubroutine object is available for inspection, and it comes with a method method_signature() which could be used to populate an abi_method_signature parameter for dry run execution.
Action Items
Streamline the dry run execution API by refactoring the dry run executing methods as follows:
remove parameter abi_argument_types
remove parameter abi_return_type
add parameter abi_method_signature
make all the current dry run executing methods private these have been deleted
unify into a single execute() function using @singledispatch and @process.register to dispatch via input's type (Further investigation is required here. It may not be possible given the nesting of possible inputs (list[tuple] ... etc .... We may also prefer a multipledispatch approach taking into account the mode parameter's type. It may also be infeasible to dispatch directly and therefore we might need to match directly and delegate.) This didn't totally work out. However, we've unified everything into a run() method, with 2 companion convenience methods run_one() and run_sequence()
Problems Summary
Too many executing methods
See below for a list of
DryRunExecutor
methods that allow executing dryruns. It is cumbersome and confusing to have so many methods that basically do the same thing. Ideally, it would be nice to have a single method with the following API:This makes use of
functools
singledispatch decoratorInconsistent abi-type handling
Currently, graviton's dry run execution are inconsistent in how abi-information is handled. Some allow
abi_argument_types
andabi_return_types
to be provided while some also allowabi_method_signature
to be provided. The last parameter includes all the information thatabi_argument_types
andabi_return_types
provides and therefore it is confusing to provide all the parameters.After an investigation into the usage of dry run execution in PyTeal, it became apparent that in all relevant situations, an
ABIReturnSubroutine
object is available for inspection, and it comes with a methodmethod_signature()
which could be used to populate anabi_method_signature
parameter for dry run execution.Action Items
Streamline the dry run execution API by refactoring the dry run executing methods as follows:
abi_argument_types
abi_return_type
abi_method_signature
make all the current dry run executing methods privatethese have been deletedunify into a singleThis didn't totally work out. However, we've unified everything into aexecute()
function using@singledispatch
and@process.register
to dispatch viainput
's type (Further investigation is required here. It may not be possible given the nesting of possible inputs (list[tuple]
... etc .... We may also prefer a multipledispatch approach taking into account themode
parameter's type. It may also be infeasible to dispatch directly and therefore we might need to match directly and delegate.)run()
method, with 2 companion convenience methodsrun_one()
andrun_sequence()
supress_abi
(not done)List of dry run executing methods for refactoring
DryRunExecutor.execute_one_dryrun()
DryRunExecutor.dryrun_logicsig()
DryRunExecutor.dryrun_app()
DryRunExecutor.dryrun_logicsig_on_sequence()
DryRunExecutor.dryrun_multiapps_on_sequence()
DryRunExecutor.dryrun_app_pair_on_sequence()
ABIContractExecutor.dryrun_app_on_sequence()
The text was updated successfully, but these errors were encountered: