anoma / juvix

A language for intent-centric and declarative decentralised applications
https://docs.juvix.org
GNU General Public License v3.0
457 stars 53 forks source link

Support the compilation of validity predicates that can be deployed to Anoma #1355

Closed paulcadman closed 2 years ago

paulcadman commented 2 years ago

Currently minijuvix compile produces WASI binaries that can be executed using a local WASM runtime like wasmer.

This issue is to add support for compilation of pure WASM binaries that export a function that can be executed on Anoma.

(See https://github.com/anoma/anoma/blob/5831077bf1f1ff917f97264471b0ddcae224e739/macros/src/lib.rs#L75 for the corresponding Rust validity predicate macro that produces the WASM signature via C FFI).

cwgoes commented 2 years ago

Example validity predicates:

paulcadman commented 2 years ago

After https://github.com/anoma/juvix/pull/1449 we've demonstrated the ability to run a validity predicate compiled from Juvix in Anoma.

See:

https://github.com/anoma/juvix/blob/7bf337217d3fdcc1f8f5d5b976577d2e76555caa/tests/positive/MiniC/AlwaysValidVP/Input.juvix

We do not have support for deserialising the arguments (Address struct, transaction data, set of keys changed and set of verifiers) that are passed to the validity predicate.

For this we'll need to support decoding a pointer to a Juvix type using the Borsh spec https://borsh.io