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

Print Wasm errors in JS console #11644

Merged
merged 1 commit into from
Aug 9, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub fn caml_pasta_fp_plonk_index_create(
prev_challenges: i32,
srs: &WasmSrs,
) -> Result<WasmPastaFpPlonkIndex, JsValue> {
console_error_panic_hook::set_once();

// flatten the permutation information (because OCaml has a different way of keeping track of permutations)
let gates: Vec<_> = gates
.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub fn caml_pasta_fq_plonk_index_create(
prev_challenges: i32,
srs: &WasmSrs,
) -> Result<WasmPastaFqPlonkIndex, JsValue> {
console_error_panic_hook::set_once();
Copy link
Contributor

Choose a reason for hiding this comment

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

instead should we just set it in an init function as indicated here? https://github.com/rustwasm/console_error_panic_hook#usage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah sorry, I didn't now how to make an init function that runs at startup, but that would be even cleaner


// flatten the permutation information (because OCaml has a different way of keeping track of permutations)
let gates: Vec<_> = gates
.0
Expand Down
1 change: 1 addition & 0 deletions src/lib/crypto/kimchi_bindings/wasm/src/plonk_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ macro_rules! impl_proof {
prev_challenges: WasmFlatVector<$WasmF>,
prev_sgs: WasmVector<$WasmG>,
) -> WasmProverProof {
console_error_panic_hook::set_once();
{
let ptr: &mut commitment_dlog::srs::SRS<GAffine> =
unsafe { &mut *(std::sync::Arc::as_ptr(&index.0.as_ref().srs) as *mut _) };
Expand Down