Skip to content

Commit 217dba7

Browse files
committed
napi: fix compilation of gate_vector
1 parent 23e3b46 commit 217dba7

File tree

2 files changed

+18
-28
lines changed

2 files changed

+18
-28
lines changed

plonk-napi/src/gate_vector.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ macro_rules! impl_gate_support {
141141
#[napi]
142142
#[derive(Clone, Default, Debug)]
143143
pub struct [<Napi $module:camel GateVector>](
144-
#[napi(skip)] pub Vec<CircuitGate<$field>>);
145-
144+
#[napi(skip)] pub Vec<CircuitGate<$field>>,
145+
);
146146

147147
#[napi]
148148
pub fn [<caml_pasta_ $module:snake _plonk_gate_vector_create>]() -> [<Napi $module:camel GateVector>] {
149-
[<Napi $module:camel GateVector>(Vec::new())]
149+
[<Napi $module:camel GateVector>](Vec::new())
150150
}
151151

152152
#[napi]
@@ -188,10 +188,11 @@ macro_rules! impl_gate_support {
188188
pub fn [<caml_pasta_ $module:snake _plonk_gate_vector_digest>](
189189
public_input_size: i32,
190190
vector: &[<Napi $module:camel GateVector>],
191-
) -> Vec<u8> {
192-
Circuit::new(public_input_size as usize, &vector.0)
191+
) -> Uint8Array {
192+
let bytes = Circuit::new(public_input_size as usize, &vector.0)
193193
.digest()
194-
.to_vec()
194+
.to_vec();
195+
Uint8Array::from(bytes)
195196
}
196197

197198
#[napi]
@@ -211,11 +212,5 @@ macro_rules! impl_gate_support {
211212
};
212213
}
213214

214-
pub mod fp {
215-
use super::*;
216-
impl_gate_support!(fp, Fp, WasmPastaFp);
217-
}
218-
pub mod fq {
219-
use super::*;
220-
impl_gate_support!(fq, Fq, WasmPastaFq);
221-
}
215+
impl_gate_support!(fp, Fp, WasmPastaFp);
216+
impl_gate_support!(fq, Fq, WasmPastaFq);

plonk-napi/src/lib.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,15 @@ pub(crate) mod wrappers;
77
pub use poseidon::{caml_pasta_fp_poseidon_block_cipher, caml_pasta_fq_poseidon_block_cipher};
88

99
pub use gate_vector::{
10-
fp::{
11-
caml_pasta_fp_plonk_circuit_digest, caml_pasta_fp_plonk_circuit_serialize,
12-
caml_pasta_fp_plonk_gate_vector_add, caml_pasta_fp_plonk_gate_vector_create,
13-
caml_pasta_fp_plonk_gate_vector_digest, caml_pasta_fp_plonk_gate_vector_get,
14-
caml_pasta_fp_plonk_gate_vector_len, caml_pasta_fp_plonk_gate_vector_wrap,
15-
NapiFpGate as WasmFpGate, NapiFpGateVector as WasmFpGateVector,
16-
},
17-
fq::{
18-
caml_pasta_fq_plonk_circuit_digest, caml_pasta_fq_plonk_circuit_serialize,
19-
caml_pasta_fq_plonk_gate_vector_add, caml_pasta_fq_plonk_gate_vector_create,
20-
caml_pasta_fq_plonk_gate_vector_digest, caml_pasta_fq_plonk_gate_vector_get,
21-
caml_pasta_fq_plonk_gate_vector_len, caml_pasta_fq_plonk_gate_vector_wrap,
22-
NapiFqGate as WasmFqGate, NapiFqGateVector as WasmFqGateVector,
23-
},
10+
caml_pasta_fp_plonk_circuit_serialize, caml_pasta_fp_plonk_gate_vector_add,
11+
caml_pasta_fp_plonk_gate_vector_create, caml_pasta_fp_plonk_gate_vector_digest,
12+
caml_pasta_fp_plonk_gate_vector_get, caml_pasta_fp_plonk_gate_vector_len,
13+
caml_pasta_fp_plonk_gate_vector_wrap, caml_pasta_fq_plonk_circuit_serialize,
14+
caml_pasta_fq_plonk_gate_vector_add, caml_pasta_fq_plonk_gate_vector_create,
15+
caml_pasta_fq_plonk_gate_vector_digest, caml_pasta_fq_plonk_gate_vector_get,
16+
caml_pasta_fq_plonk_gate_vector_len, caml_pasta_fq_plonk_gate_vector_wrap,
17+
NapiFpGate as WasmFpGate, NapiFpGateVector as WasmFpGateVector, NapiFqGate as WasmFqGate,
18+
NapiFqGateVector as WasmFqGateVector,
2419
};
2520
pub use poly_comm::{pallas::WasmFqPolyComm, vesta::WasmFpPolyComm};
2621
pub use wasm_vector::{fp::WasmVecVecFp, fq::WasmVecVecFq};

0 commit comments

Comments
 (0)