diff --git a/js/wrapper.js b/js/wrapper.js index 50433a63..807490d0 100644 --- a/js/wrapper.js +++ b/js/wrapper.js @@ -5,6 +5,8 @@ export { getSnarky, getWasm, withThreadPool }; let getSnarky = () => snarky; +wasm.console_error_panic_hook_set_once(); + function getWasm() { return wasm; } diff --git a/kimchi/wasm/src/lib.rs b/kimchi/wasm/src/lib.rs index 93cb9387..6377ca2d 100644 --- a/kimchi/wasm/src/lib.rs +++ b/kimchi/wasm/src/lib.rs @@ -73,6 +73,11 @@ pub fn wait_until_non_zero(ptr: *const u32) -> u32 { unreachable!(); } +#[wasm_bindgen] +pub fn console_error_panic_hook_set_once() { + console_error_panic_hook::set_once(); +} + pub mod rayon; /// Arkworks types diff --git a/kimchi/wasm/src/pasta_fp_plonk_index.rs b/kimchi/wasm/src/pasta_fp_plonk_index.rs index 5b31ba33..13456061 100644 --- a/kimchi/wasm/src/pasta_fp_plonk_index.rs +++ b/kimchi/wasm/src/pasta_fp_plonk_index.rs @@ -33,7 +33,6 @@ pub fn caml_pasta_fp_plonk_index_create( prev_challenges: i32, srs: &WasmSrs, ) -> Result { - console_error_panic_hook::set_once(); let index = crate::rayon::run_in_pool(|| { // flatten the permutation information (because OCaml has a different way of keeping track of permutations) let gates: Vec<_> = gates diff --git a/kimchi/wasm/src/pasta_fq_plonk_index.rs b/kimchi/wasm/src/pasta_fq_plonk_index.rs index 0846a418..57cebe1b 100644 --- a/kimchi/wasm/src/pasta_fq_plonk_index.rs +++ b/kimchi/wasm/src/pasta_fq_plonk_index.rs @@ -33,7 +33,6 @@ pub fn caml_pasta_fq_plonk_index_create( prev_challenges: i32, srs: &WasmSrs, ) -> Result { - console_error_panic_hook::set_once(); let index = crate::rayon::run_in_pool(|| { // flatten the permutation information (because OCaml has a different way of keeping track of permutations) let gates: Vec<_> = gates diff --git a/kimchi/wasm/src/plonk_proof.rs b/kimchi/wasm/src/plonk_proof.rs index ee188918..6e1f4947 100644 --- a/kimchi/wasm/src/plonk_proof.rs +++ b/kimchi/wasm/src/plonk_proof.rs @@ -552,7 +552,6 @@ macro_rules! impl_proof { prev_challenges: WasmFlatVector<$WasmF>, prev_sgs: WasmVector<$WasmG>, ) -> Result { - console_error_panic_hook::set_once(); let (maybe_proof, public_input) = crate::rayon::run_in_pool(|| { { let ptr: &mut poly_commitment::srs::SRS<$G> =