Skip to content
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

Update nockma backend output to match Anoma interface #3106

Closed
2 of 3 tasks
paulcadman opened this issue Oct 16, 2024 · 1 comment
Closed
2 of 3 tasks

Update nockma backend output to match Anoma interface #3106

paulcadman opened this issue Oct 16, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request pending-review

Comments

@paulcadman
Copy link
Collaborator

paulcadman commented Oct 16, 2024

Current Situation

The nockma backend currently outputs a nockma function, i.e a cell with the following structure:

[code args context]

Where:

  • code - is the code that's evaluated when the function is called
  • args - is a placeholder for arguments to the function. The caller replaces this with the actual arguments before they call the function.
  • context - some other data that's used by the function.

The nockma backend current stores the compiled functions from the module, information about closures, the anoma standard library and other things in the context:

FunctionsLibrary
| StandardLibrary
| ClosureTotalArgsNum
| ClosureArgsNum
| ClosureArgs
| AnomaGetOrder

New requirement from Anoma

Anoma requires the transaction function nock context to have the following structure:

[juvix-specific-data anoma-stdlib-placeholder]

where:
juvix-specific-placeholder is a 0 that will be replaced with the Anoma standard library when it is called by the Anoma.

i.e the whole structure of the nock function should be:

[code args juvix-specific-data anoma-stdlib-placeholder]

TODO

  • Use resource-machine.hoon instead of anoma.hoon to compute nock indicies of stdlib functions (resource-machine.hoon contains anoma.hoon).
  • Change the nockma closure structure so the StandardLibrary is at the tail of the closure cell
  • Do not include the standard library nock code in the compiled output, just set the StandardLibrary slot to nil. (We will still use the standard library nock code in tests).
@paulcadman paulcadman added enhancement New feature or request pending-review labels Oct 16, 2024
@paulcadman paulcadman self-assigned this Oct 17, 2024
paulcadman added a commit that referenced this issue Oct 17, 2024
The `StandardLibrary` constructor of `AnomaCallablePathId` must be last.
This is because Anoma will replace the tail of the main function with
the resource machine standard library when it calls it.

See:
* #3106

for more details.
@paulcadman
Copy link
Collaborator Author

I'll split out

  • Do not include the standard library nock code in the compiled output

into a separate issue because we don't need to do this immediately. Our compiler output is now compatible with the Anoma calling interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pending-review
Projects
None yet
Development

No branches or pull requests

1 participant