From 63725a4909a8053371f95961f7b55c61cb13d763 Mon Sep 17 00:00:00 2001 From: Gregor Date: Fri, 18 Oct 2024 21:30:50 +0200 Subject: [PATCH] fix maybe_lagrange_commitment --- src/lib/crypto/kimchi_bindings/wasm/src/srs.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs b/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs index 1d436ab1f91..2b33c56d59f 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs @@ -253,6 +253,9 @@ pub mod fp { domain_size: i32, i: i32, ) -> Option { + if !(srs.0.lagrange_bases.contains_key(&(domain_size as usize))) { + return None; + } let basis = srs.get_lagrange_basis_from_domain_size(domain_size as usize); Some(basis[i as usize].clone().into()) } @@ -330,7 +333,10 @@ pub mod fq { domain_size: i32, i: i32, ) -> Option { - let basis = srs.0.get_lagrange_basis_from_domain_size(domain_size as usize); + if !(srs.0.lagrange_bases.contains_key(&(domain_size as usize))) { + return None; + } + let basis = srs.get_lagrange_basis_from_domain_size(domain_size as usize); Some(basis[i as usize].clone().into()) }