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

Add support for anoma specific functions to the Core evaluator #2851

Merged
merged 9 commits into from
Jun 25, 2024

Conversation

paulcadman
Copy link
Collaborator

@paulcadman paulcadman commented Jun 20, 2024

This PR adds support for the anoma{encode, decode, sign, verify, signDetached, verifyDetached} functions to the Core evaluator.

Encoding / Decoding

The serialization of values to ByteString for anomaEncode reuses the Stored Core serialization.

Anoma expects encoding of bytes as little-endian integers. In general ByteString -> Integer is ambiguous because two ByteStrings that differ only by zero padding will map to the same integer. So we must encode the length of the ByteString in the encoded integer alongside the ByteString data so when it is decoded we can pad appropriately. We use the same length encoding scheme that is used by Nockma jam.

Verify

The Core evaluator implementation of anomaVerify crashes if the verification fails. This matches the behaviour of Anoma node.

jvc Support

You can now use anoma-* functions within .jvc core files.

@paulcadman paulcadman self-assigned this Jun 20, 2024
@paulcadman paulcadman added this to the 0.6.3 milestone Jun 20, 2024
@paulcadman paulcadman added anoma core Related to JuvixCore enhancement New feature or request labels Jun 20, 2024
@paulcadman paulcadman force-pushed the anoma-core-eval branch 3 times, most recently from 01f96bf to 6fe2d9d Compare June 24, 2024 11:36
@paulcadman paulcadman marked this pull request as ready for review June 24, 2024 11:46
These encode/decode a ByteString to/from its little endian integer
representation. The length of the ByteString is encoded at the beginning
of the encoded output so that rountripping works correctly.
We need to serialize Closure Nodes in the Core evaluator, only for use
with Anoma encode/decode functions.
We can use `Core.Extra.Utils.removeClosures` to remove the Closure nodes
from the Core.Node before transforming to Store.Core.Node
@lukaszcz lukaszcz merged commit 6d24d71 into main Jun 25, 2024
4 checks passed
@lukaszcz lukaszcz deleted the anoma-core-eval branch June 25, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
anoma core Related to JuvixCore enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add the Anoma-specific functions to the Core evaluator
2 participants