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

Cache prover keys #187

Merged
merged 25 commits into from
Oct 31, 2023
Merged

Cache prover keys #187

merged 25 commits into from
Oct 31, 2023

Conversation

mitschabaude
Copy link
Collaborator

@mitschabaude mitschabaude commented Oct 19, 2023

Companion to o1-labs/o1js#1187

  • Set Pickles' cache and storables arguments to values wrapping a storage argument provided from the JS side
  • Expose bindings functions to encode and decode prover keys to byte arrays

@mitschabaude mitschabaude marked this pull request as ready for review October 23, 2023 15:23
@mitschabaude mitschabaude requested a review from a team as a code owner October 23, 2023 15:23
Comment on lines +12 to +21
module Js_environment = struct
type t = Node | Web | Unknown

let value =
let env = get_ts_bindings () |. "jsEnvironment" in
Js.(
if phys_equal env (def (string "node")) then Node
else if phys_equal env (def (string "web")) then Web
else Unknown)
end
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this makes the ocaml bindings aware of the current JS environment. I originally thought that I needed this to avoid using nodejs filesystem operations on the web. in the design I ended up with, the write and read operations are generic and can be set to something which works in either nodejs or the web on the JS side; so this remains unused.
It still seems useful to have.

Comment on lines +913 to +918
) -> Result<WasmPlonkVerifierIndex, JsError> {
let vi: Result<DlogVerifierIndex<$G, OpeningProof<$G>>, serde_json::Error> = serde_json::from_str(&index);
match vi {
Ok(vi) => Ok(to_wasm(srs, vi)),
Err(e) => Err(JsError::new(&(e.to_string()))),
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verification key encoding was already in place in a usable way (encode as JSON string, this is fine for vks which are small). I just changed the deserialization so that it can throw a proper error and not just panic

Comment on lines +61 to +63
function getRustConversion(wasm: wasm) {
return rustConversion ?? (rustConversion = createRustConversion(wasm));
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is exposed to the main o1js codebase

crypto/bindings/env.ts Show resolved Hide resolved
kimchi/wasm/src/pasta_fp_plonk_index.rs Show resolved Hide resolved
ocaml/lib/pickles_bindings.ml Show resolved Hide resolved
ocaml/lib/pickles_bindings.ml Show resolved Hide resolved
ocaml/lib/pickles_bindings.ml Show resolved Hide resolved
@mitschabaude mitschabaude merged commit 0a89b7a into main Oct 31, 2023
1 check passed
@mitschabaude mitschabaude deleted the feature/pickles-js-caching branch October 31, 2023 13:34
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

Successfully merging this pull request may close these issues.

2 participants