You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once we have the compile artefacts available through the build pipeline, we need to access them in o1js to call into them and execute native rust functions
jsoo has access to native ffi neon-rs artefacts
Notes: currently, we inject a plonk_wasm object into o1js and the jsoo bindings for the node version as well as the web version - ideally we maintain the exact same interface and only inject the native prover artefact into the bindings via a third injection specifically for node-native (note: we definitely want to keep web-wasm and we may even consider keeping the node-wasm version as a fallback, so we don't need to change any of the existing implementations and pipelines, only add a new one for node-native)
jsoo uses neon-rs artefact to call caml_pasta_fp_poseidon_block_cipher
the interface we inject is currently called plonk_wasm, ideally we also refactor this part and rename it to something more generic, such as rust_interface to avoid confusion in the future
jsoo converts data coming from js/js-compiled-from-ocaml correctly to a format that neon-rs expects
the conversion logic in the jsoo bindings code correctly handles native rust ffi data conversion, here's an example, the integration tests will pass if it works
// Provides: caml_pasta_fp_poseidon_block_cipher// Requires: plonk_wasm, tsRustConversion, tsRustConversionfunctioncaml_pasta_fp_poseidon_block_cipher(_fake_params,fp_vector){// 1. get permuted field vector from rustvarwasm_flat_vector=plonk_wasm.caml_pasta_fp_poseidon_block_cipher(tsRustConversion.fp.vectorToRust(fp_vector));varnew_fp_vector=tsRustConversion.fp.vectorFromRust(wasm_flat_vector);// 2. write back modified field vector to original onenew_fp_vector.forEach(function(a,i){fp_vector[i]=a;});}
The text was updated successfully, but these errors were encountered:
This pr renames plonk_wasm and changes the layout to make it easier to add the rust interface MinaProtocol/mina#16779
Trivo25
changed the title
integrate rust ffi with o1js
jsoo calls caml_pasta_fp_poseidon_block_cipher through (native ffi) neon-rs artefact
Mar 27, 2025
Once we have the compile artefacts available through the build pipeline, we need to access them in o1js to call into them and execute native rust functions
plonk_wasm
object into o1js and the jsoo bindings for the node version as well as the web version - ideally we maintain the exact same interface and only inject the native prover artefact into the bindings via a third injection specifically for node-native (note: we definitely want to keep web-wasm and we may even consider keeping the node-wasm version as a fallback, so we don't need to change any of the existing implementations and pipelines, only add a new one for node-native)caml_pasta_fp_poseidon_block_cipher
plonk_wasm
, ideally we also refactor this part and rename it to something more generic, such asrust_interface
to avoid confusion in the futureThe text was updated successfully, but these errors were encountered: