Skip to content

Commit 5c19d07

Browse files
committed
napi: finish compilation of srs
1 parent db8bdd1 commit 5c19d07

File tree

2 files changed

+3
-27
lines changed

2 files changed

+3
-27
lines changed

plonk-napi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub use pasta_fq_plonk_index::{
1616
};
1717
pub use poly_comm::{pallas::WasmFqPolyComm, vesta::WasmFpPolyComm};
1818
pub use poseidon::{caml_pasta_fp_poseidon_block_cipher, caml_pasta_fq_poseidon_block_cipher};
19-
pub use srs::{caml_fp_srs_from_bytes, caml_fp_srs_to_bytes, caml_fq_srs_from_bytes};
19+
pub use srs::*;
2020
pub use tables::{JsLookupTableFp, JsLookupTableFq, JsRuntimeTableCfgFp, JsRuntimeTableCfgFq};
2121
pub use wasm_vector::{fp::WasmVecVecFp, fq::WasmVecVecFq};
2222
pub use wrappers::{

plonk-napi/src/srs.rs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use crate::{
88
};
99
use ark_poly::{univariate::DensePolynomial, DenseUVPolynomial, EvaluationDomain, Evaluations};
1010
use core::ops::Deref;
11-
use mina_curves::pasta::{Pallas as GAffineOther, Vesta as GAffine};
12-
use napi::bindgen_prelude::{Error, External, Result, Status, Uint8Array};
11+
use napi::bindgen_prelude::{Error, Result, Status, Uint8Array};
1312
use napi_derive::napi;
1413
use paste::paste;
1514
use poly_commitment::{
@@ -23,29 +22,6 @@ use std::{
2322
};
2423
use wasm_types::FlatVector as WasmFlatVector;
2524

26-
/*
27-
#[napi]
28-
pub fn caml_fp_srs_to_bytes(srs: External<WasmSrsFp>) -> NapiResult<Uint8Array> {
29-
let buffer = rmp_serde::to_vec(srs.as_ref().0.as_ref())
30-
.map_err(|e| Error::new(Status::GenericFailure, e.to_string()))?;
31-
Ok(Uint8Array::from(buffer))
32-
}
33-
34-
#[napi]
35-
pub fn caml_fp_srs_from_bytes(bytes: Uint8Array) -> NapiResult<External<WasmSrsFp>> {
36-
let srs: SRS<GAffine> = rmp_serde::from_slice(bytes.as_ref())
37-
.map_err(|e| Error::new(Status::InvalidArg, e.to_string()))?;
38-
Ok(External::new(Arc::new(srs).into()))
39-
}
40-
41-
#[napi]
42-
pub fn caml_fq_srs_from_bytes(bytes: Uint8Array) -> NapiResult<External<WasmSrsFq>> {
43-
let srs: SRS<GAffineOther> = rmp_serde::from_slice(bytes.as_ref())
44-
.map_err(|e: rmp_serde::decode::Error| Error::new(Status::InvalidArg, e.to_string()))?;
45-
Ok(External::new(Arc::new(srs).into()))
46-
}
47-
*/
48-
4925
macro_rules! impl_srs {
5026
(
5127
$name:ident,
@@ -249,7 +225,7 @@ macro_rules! impl_srs {
249225
input_bases: WasmVector<WasmPolyComm>,
250226
) {
251227
srs.0.lagrange_bases
252-
.get_or_generate(domain_size as usize, || input_bases);
228+
.get_or_generate(domain_size as usize, || { input_bases.into_iter().map(Into::into).collect()});
253229
}
254230

255231
#[napi]

0 commit comments

Comments
 (0)