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

Always call console_error_panic_hook::set_once and remove ad-hoc uses of it #63

Open
wants to merge 1 commit into
base: v1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions js/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export { getSnarky, getWasm, withThreadPool };

let getSnarky = () => snarky;

wasm.console_error_panic_hook_set_once();
L-as marked this conversation as resolved.
Show resolved Hide resolved

function getWasm() {
return wasm;
}
5 changes: 5 additions & 0 deletions kimchi/wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,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
Expand Down
1 change: 0 additions & 1 deletion kimchi/wasm/src/pasta_fp_plonk_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub fn caml_pasta_fp_plonk_index_create(
prev_challenges: i32,
srs: &WasmSrs,
) -> Result<WasmPastaFpPlonkIndex, JsError> {
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
Expand Down
1 change: 0 additions & 1 deletion kimchi/wasm/src/pasta_fq_plonk_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub fn caml_pasta_fq_plonk_index_create(
prev_challenges: i32,
srs: &WasmSrs,
) -> Result<WasmPastaFqPlonkIndex, JsError> {
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
Expand Down
1 change: 0 additions & 1 deletion kimchi/wasm/src/plonk_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ macro_rules! impl_proof {
prev_challenges: WasmFlatVector<$WasmF>,
prev_sgs: WasmVector<$WasmG>,
) -> Result<WasmProverProof, JsError> {
console_error_panic_hook::set_once();
let (maybe_proof, public_input) = crate::rayon::run_in_pool(|| {
{
let ptr: &mut poly_commitment::srs::SRS<$G> =
Expand Down