-
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
Convenience wrapper for running subroutines #23
Comments
Hi @zejoeh. I'm glad you are finding graviton useful in your PyTEAL development work. Integration with PyTeal has been steadily improving. In particular, the soon to be merged |
Hi @tzaffi, yes this indeed looks already like a step in the same direction I was going. I wrote this decorator based on the code in the current Probably the only "improvement" from my version is that it returns an instance of a container dataclass for the list of |
Thanks for looking at |
Hi @tzaffi, I added a draft pull request on the PyTeal repository. Happy to receive feedback, but still adding improvements as they come up in my own project. I think it can be improved significantly by making use of all the work put into the ABI typing, but I have not had the time yet to dig into it. |
Hi, found your project on the Algorand Discord and it's made my testing significantly easier, great job and thanks! I hope it will be fully integrated into PyTeal very soon.
While incorporating it into my own unit tests, I wrote an additional wrapper around the BlackboxWrapper that you included in the PyTeal repository to skip some of the steps that I was doing repeatedly, like compiling the TEAL, arranging inputs correctly, casting to numeric types etc.
This wrapper allows you to write tests like this:
...which I think maybe could be of interest to others. It automatically takes care of mapping keyword arguments to the correct order when calling the subroutine, calls stack_top() for uint64 and last_log() for bytes and converts to Python ints and calls the dryrun for apps or logicsigs depending on an optional pt.Mode argument in the decorator, but is otherwise a pretty simple extra wrapper that just gives a shorter path from the subroutine to the dryruns.
The PyTeal repository doesn't seem like the place to share it, since right now graviton is only used within the tests, so I don't know where I could do a pull request, as it depends on code I found within the PyTeal repo. In case you think it's of any interest now or in the future, just let me know where you think is the best place to share the code, otherwise feel free to close it. :)
The text was updated successfully, but these errors were encountered: