Skip to content

Commit cd24f57

Browse files
committed
types: change output types of poseidon ffi to fix o1js tests
1 parent 18a2370 commit cd24f57

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plonk-napi/src/poseidon.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use wasm_types::{FlatVector, FlatVectorElem};
88
// fp
99

1010
#[napi]
11-
pub fn caml_pasta_fp_poseidon_block_cipher(state: Uint8Array) -> Result<Vec<u8>> {
11+
pub fn caml_pasta_fp_poseidon_block_cipher(state: Uint8Array) -> Result<Uint8Array> {
1212
let mut state_vec: Vec<Fp> = FlatVector::<WasmPastaFp>::from_bytes(state.to_vec())
1313
.into_iter()
1414
.map(Into::into)
@@ -19,19 +19,19 @@ pub fn caml_pasta_fp_poseidon_block_cipher(state: Uint8Array) -> Result<Vec<u8>>
1919
&mut state_vec,
2020
);
2121

22-
let res = state_vec
22+
let res: Vec<u8> = state_vec
2323
.into_iter()
2424
.map(WasmPastaFp)
2525
.flat_map(FlatVectorElem::flatten)
2626
.collect();
2727

28-
Ok(res)
28+
Ok(Uint8Array::from(res))
2929
}
3030

3131
// fq
3232

3333
#[napi]
34-
pub fn caml_pasta_fq_poseidon_block_cipher(state: Uint8Array) -> Result<Vec<u8>> {
34+
pub fn caml_pasta_fq_poseidon_block_cipher(state: Uint8Array) -> Result<Uint8Array> {
3535
let mut state_vec: Vec<Fq> = FlatVector::<WasmPastaFq>::from_bytes(state.to_vec())
3636
.into_iter()
3737
.map(Into::into)
@@ -42,11 +42,11 @@ pub fn caml_pasta_fq_poseidon_block_cipher(state: Uint8Array) -> Result<Vec<u8>>
4242
&mut state_vec,
4343
);
4444

45-
let res = state_vec
45+
let res: Vec<u8> = state_vec
4646
.into_iter()
4747
.map(WasmPastaFq)
4848
.flat_map(FlatVectorElem::flatten)
4949
.collect();
5050

51-
Ok(res)
51+
Ok(Uint8Array::from(res))
5252
}

0 commit comments

Comments
 (0)