mirror of
https://github.com/anoma/juvix.git
synced 2024-12-13 11:16:48 +03:00
6d24d7186d
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. The Stored Core `Node` is extended to include closures. Anoma expects encoding of bytes as little-endian integers. In general `ByteString -> Integer` is ambiguous because two `ByteString`s 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. * Closes https://github.com/anoma/juvix/issues/2808
29 lines
781 B
Haskell
29 lines
781 B
Haskell
module Core.Compile.Positive where
|
|
|
|
import Base
|
|
import Core.Compile.Base
|
|
import Core.Eval.Positive qualified as Eval
|
|
|
|
allTests :: TestTree
|
|
allTests = testGroup "JuvixCore compilation tests" (map liftTest (Eval.filterOutTests ignoredTests Eval.compilableTests))
|
|
|
|
-- Arbitrary precision integers and fields not yet supported
|
|
ignoredTests :: [String]
|
|
ignoredTests =
|
|
[ "Test011: Tail recursion: Fibonacci numbers in linear time",
|
|
"Test022: Fast exponentiation",
|
|
"Test025: Mutual recursion",
|
|
"Test026: Nested 'case', 'let' and 'if' with variable capture",
|
|
"Test036: Big numbers",
|
|
"Test040: LetRec - fib, fact",
|
|
"Test061: Fields",
|
|
"Test062: Anoma"
|
|
]
|
|
|
|
liftTest :: Eval.PosTest -> TestTree
|
|
liftTest _testEval =
|
|
fromTest
|
|
Test
|
|
{ _testEval
|
|
}
|