-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
o1-labs/proof-systems
#3339Description
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)
- Notes: currently, we inject a
- 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 asrust_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, tsRustConversion
function caml_pasta_fp_poseidon_block_cipher(_fake_params, fp_vector) {
// 1. get permuted field vector from rust
var wasm_flat_vector = plonk_wasm.caml_pasta_fp_poseidon_block_cipher(
tsRustConversion.fp.vectorToRust(fp_vector)
);
var new_fp_vector = tsRustConversion.fp.vectorFromRust(wasm_flat_vector);
// 2. write back modified field vector to original one
new_fp_vector.forEach(function (a, i) {
fp_vector[i] = a;
});
}
Metadata
Metadata
Assignees
Labels
No labels