Skip to content

Commit 16db348

Browse files
committed
backend: overwrite poseidon ffi wasm definitions for native variants
1 parent a457d00 commit 16db348

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,16 @@
11
// Provides: plonk_wasm
22
var plonk_wasm = require('./plonk_wasm.js');
3+
var native = null;
4+
try {
5+
native = require('../native/plonk_napi.node');
6+
} catch (e) {
7+
// native not available, keep WASM
8+
}
9+
10+
// Overwrite only the functions that are already available in native
11+
if (native && native.caml_pasta_fp_poseidon_block_cipher) {
12+
plonk_wasm.caml_pasta_fp_poseidon_block_cipher = native.caml_pasta_fp_poseidon_block_cipher;
13+
}
14+
if (native && native.caml_pasta_fq_poseidon_block_cipher) {
15+
plonk_wasm.caml_pasta_fq_poseidon_block_cipher = native.caml_pasta_fq_poseidon_block_cipher;
16+
}

0 commit comments

Comments
 (0)