Add BCH helper functions and non-spendable library imports#400
Add BCH helper functions and non-spendable library imports#400lightswarm124 wants to merge 10 commits into
Conversation
|
Hey @lightswarm124, thank you for the PR. We have functions on the timeline for version 0.14.0, which we'll start working on after the upcoming 0.13.0 release (targeted for May 15th), which will mainly include loops. We briefly looked at some of the changes, and I wonder whether the new examples compile, since the syntax changes don't look reflected in the grammar files. Did you manage to run any of these examples yet? In any case, we'll start looking into this PR (and functions in general) after that upcoming 0.13.0 release in May. |
|
Hey @rkalis, I modified the grammar a bit to better support internal helper functions, adding in "public" and "internal" visibility tags to the functions. Also defined "library" for importing helper functions from external files - currently, only "contract" is allowed to have functions you can spend from. Tests should work once the grammar has been updated |
4feea09 to
9a3d249
Compare
|
@lightswarm124 is attempting to deploy a commit to the Kalis Software Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Hey Jerry, thanks for the update. We looked deeper into the code / structure this week. Overall this serves as a good reference of implementing internal functions, libraries, and importing. However, there's still some issues, such as the visibility modifiers kind of living outside of the main compiler, and the lack of "returnable" functions. If you wanted to further improve the PR, I noticed that there's some small type issues (I believe in the tests) which could be fixed, the PR could be rebased on top of the latest master, and getting the visibility modifiers reflected in the grammar + "proper" compiler process, rather than the current "bypass" / stripping method would be very helpful. We have a list of smaller issues to still work on (following on the 0.13 release), before we are able to fully pick up functions. You can track the other issues in the v0.13.1 milestone and track functions + other bigger items in the 0.14.0 milestone. |
This PR adds BCH function support on top of current next by introducing contract-local helper functions and non-spendable imported helper libraries. It treats OP_DEFINE / OP_INVOKE as first-class compiler outputs, keeps spend surfaces explicit, and adds the debug/runtime metadata needed to make helper execution reviewable.
Main changes:
Why this matters:
Examples included:
Local internal helpers:
Imported helper libraries:
Testing-suite helper example:
Docs for review: