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

Compile minihaskell output to WASM #1253

Closed
paulcadman opened this issue Apr 11, 2022 · 1 comment
Closed

Compile minihaskell output to WASM #1253

paulcadman opened this issue Apr 11, 2022 · 1 comment

Comments

@paulcadman
Copy link
Collaborator

See https://hackmd.io/A72oR4wYR-msPuFmU8f5rg?view

We want to see if we can achieve the following goal using the minihaskell backend (as opposed to going via LLVM).

Validity predicates

The first few VPs can be very simple. These neeed to be able to compile through LLVM to WASM and be compatible with the validity predicate interface of the Anoma ledger.

For background on the validity predicate interface of the Anoma ledger, see vp_template for the interface a validity predicate needs to provide - we’ll need to have this validate_tx interface provided by the WASM output of MiniJuvix. See here for some functions that should be available (as extern in > MiniJuvix) to validity predicates written in the MiniJuvix frontend, which then need to be compiled to appropriate calls in the LLVM/WASM (they are already defined using the C FFI, so hopefully this should be straightforward to implement).

For this issue we will see if we compile the minihaskell output to WASM, including the aroma FFI calls.

@paulcadman
Copy link
Collaborator Author

We tried using the asterius Haskell to WebAssembly compiler.

A validity predicate must be made available to the WASM runtime as a top-level function with a particular type-signature. So we need to be able to export Haskell functions via FFI using Asteruius.

We tried using foreign export javascript as described in tweag blog and in the Asterius test case. But this did not make the exported symbol available in the WASM output.

There's an open issue from 2020 for the same issue with exporting Haskell symbols that has not been looked at by maintainers of Asterius.

It seems like Asterius is not maintained. For example the project roadmap has not been updated since Q3 2021.

In summary we didn't find a way to get the FFI to work and so we can't use Asterius to compile validity predicates for use on the Anoma ledger.

@cwgoes cwgoes transferred this issue from another repository Jul 13, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants