Skip to content

Commit 720484a

Browse files
authored
Merge pull request #17948 from MinaProtocol/florian/napi-prover-json
[DO NOT MERGE] native `prover_to_json` implementation
2 parents 8e111e8 + 5132af2 commit 720484a

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

src/lib/crypto/kimchi_bindings/js/bindings/proof.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,3 @@ var caml_pasta_fq_plonk_proof_deep_copy = function (proof) {
137137
);
138138
};
139139

140-
// Provides: prover_to_json
141-
// Requires: plonk_wasm
142-
var prover_to_json = plonk_wasm.prover_to_json;

src/lib/crypto/kimchi_bindings/js/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
bindings/verifier-index.js
1818
native/native-overrides/oracles.js
1919
native/native-overrides/util.js
20+
native/native-overrides/circuit.js
2021
))
2122
(instrumentation
2223
(backend bisect_ppx))
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* global plonk_wasm, tsRustConversionNative */
2+
3+
4+
// Provides: prover_to_json
5+
// Requires: plonk_wasm, tsRustConversionNative
6+
function prover_to_json(prover_index) {
7+
var bytes = prover_index.serialize()
8+
var index = plonk_wasm.prover_index_from_bytes(bytes);
9+
// TODO: ^ remove the round trip when napi has direct access to the object
10+
11+
return plonk_wasm.prover_to_json(index);
12+
}

src/lib/crypto/kimchi_bindings/js/node_js/node_backend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ function override(functionName) {
2525
// Overwrite only the functions that are already available in native
2626
override('caml_pasta_fp_poseidon_block_cipher');
2727
override('caml_pasta_fq_poseidon_block_cipher');
28+
override('prover_to_json');
29+
override('prover_index_from_bytes');

0 commit comments

Comments
 (0)