Skip to content

build pipeline generates native prover ffi artefacts #2087

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

Open
2 tasks
Trivo25 opened this issue Mar 20, 2025 · 2 comments
Open
2 tasks

build pipeline generates native prover ffi artefacts #2087

Trivo25 opened this issue Mar 20, 2025 · 2 comments
Assignees

Comments

@Trivo25
Copy link
Member

Trivo25 commented Mar 20, 2025

in order to access rust natively, we need to use a ffi from nodejs to rust - neon-rs looks like a good choice
setting this up requires us to add a new build pipeline that builds the new native rust artefacts and makes them available in o1js

currently, the default is to compile Rust to WASM and OCaml to JS - this is the only backend we currently support. There are a few small differences between web and node but they are mostly similar.

We need to set up the ffi and integrate it into our build pipeline (when running npm run build:bindings we now need to build the rust artefacts too)

acceptance criteria:

  • neon-rs (ffi) is available in kimchi bindings as an alternative build pipeline to wasm
  • running npm run build:bindings generates neon-rs and wasm artefacts
@richardpringle richardpringle self-assigned this Mar 24, 2025
@Trivo25 Trivo25 changed the title set up build path for native prover ffi build pipeline generates native prover ffi artefacts Mar 27, 2025
@richardpringle
Copy link
Contributor

So this was/is kind of hard to test without an actual method implemented. I've found a couple of candidates in the poseidon-block-ciper functions (we've captured this in another issue somewhere).

I've since found some issues with the plonk-wasm code that make integrating a native function a little more difficult and should be changed in the wasm-bindings such that some of the code can be re-used.

@richardpringle
Copy link
Contributor

Great news, I managed to prove to myself that the native Rust library leads to passing tests! I didn’t change much, so I really did expect this to work…. it’s been a real struggle trying to get everything to build and get copied to where I expect it to be. I actually ended up just moving the .node (dynamic library) file into the bindings repo and editing some js (no, not ts) code that imports plonk_wasm , then I replaced the two functions that I re-wrote.

Now, on to building for as many targets as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants