-
Notifications
You must be signed in to change notification settings - Fork 53
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
Support compilation of Anoma transactions in nockma backend #2693
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We now export functions in an Anoma compatible way
Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
Restore non-intercept stdlib tests in unittests
paulcadman
force-pushed
the
reinline-env
branch
from
March 22, 2024 12:12
5afcae5
to
44d6e8d
Compare
We can remove the hack serialization of the output in the Anoma compile positive tests. We were doing this to cover the string check
paulcadman
force-pushed
the
reinline-env
branch
from
March 22, 2024 16:54
44d6e8d
to
c938a66
Compare
Closed
paulcadman
changed the title
Inline the functions library at every closure
Support compilation of Anoma transactions in nockma backend
Mar 22, 2024
janmasrovira
approved these changes
Mar 22, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When we first implemented the Nockma backend we wrongly assumed that the only entry point for Juvix compiled Nockma modules would be the main function. Using this assumption we could add a setup step in the main function that put the Anoma stdlib and compiled functions from the Juvix module in a static place in the Nockma subject. References to the Anoma stdlib and functions in the module could then be resolved statically.
However, one of the use cases for Juvix -> Nockma compilation is for Anoma to run logic functions that are fields of a transaction. So the user writes a Juvix program with main function that returns a transaction. The result of the main function is passed to Anoma. When Anoma calls the logic function on a field of the transaction, the setup part of the main function is not run so the subject is not in the required state. In fact, the logic function is not even callable by Anoma because non-main functions in the Juvix module use a calling convention that assumes the subject has a particular shape.
This PR solves the problem by making all functions in the Juvix module use the Anoma calling convention. We make all compiled closures (including, for example, the logic functions stored on resources in a transaction) self contained, i.e they contain the functions library and anoma standard library.
Modules that contain many closures produce large nockma output files which slows down the evaluator. This will need to be fixed in the future either with Nockma compression (jam serialization) or otherwise. But it does not block the compilation and execution of Anoma transactions.
Other fixes / additions:
juvix dev nock run
command that can run a program output with theanoma
target.nockma
target. As described above we always use the Anoma calling convention so there's no need for a separate target for the 'juvix calling convention'--profile
flag tojuvix dev nock run
which outputs a count of Nockma ops used in the evaluationit is output in a file
OUTPUT.profile
and has the following form: