Skip to content

Commit 3c0b64c

Browse files
authored
Merge pull request #18211 from MinaProtocol/shigoto/napi-proof/verifier-index
(mina) Native Prover with Napi - POC - Verifier Index
2 parents 6f15cb8 + ebfe5d8 commit 3c0b64c

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

src/lib/crypto/kimchi_bindings/js/native/native-overrides/proof.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,38 @@ var caml_pasta_fp_plonk_proof_create = function (
1212
prev_sgs
1313
) {
1414
var w = new plonk_wasm.WasmVecVecFp(witness_cols.length - 1);
15+
var ww = new w.WasmVecVecFp(witness_cols.length - 1)
1516
for (var i = 1; i < witness_cols.length; i++) {
16-
w.push(tsRustConversionNative.fp.vectorToRust(witness_cols[i]));
17+
ww.push(tsRustConversionNative.fp.vectorToRust(witness_cols[i]));
1718
}
18-
witness_cols = w;
19+
20+
witness_cols = ww;
1921
prev_challenges = tsRustConversionNative.fp.vectorToRust(prev_challenges);
2022
var wasm_runtime_tables =
2123
tsRustConversionNative.fp.runtimeTablesToRust(caml_runtime_tables);
2224
prev_sgs = tsRustConversionNative.fp.pointsToRust(prev_sgs);
25+
26+
/*
27+
index: &External<$NapiIndex>,
28+
witness: $NapiVecVec,
29+
runtime_tables: NapiVector<JsRuntimeTableF>,
30+
prev_challenges: NapiFlatVector<$NapiF>,
31+
prev_sgs: NapiVector<$NapiG>,
32+
*/
2333

34+
console.log('index: ', index);
35+
console.log('witness cols: ', witness_cols)
36+
console.log("wasm_runtime_tables: ", wasm_runtime_tables)
37+
console.log('prev challenges: ', prev_challenges)
38+
console.log('prev_sgs: ', prev_sgs)
2439
var proof = plonk_wasm.caml_pasta_fp_plonk_proof_create(
2540
index,
2641
witness_cols,
2742
wasm_runtime_tables,
2843
prev_challenges,
2944
prev_sgs
3045
);
46+
console.log('proof?')
3147
return tsRustConversionNative.fp.proofFromRust(proof);
3248
};
3349

@@ -112,7 +128,7 @@ var caml_pasta_fq_plonk_proof_verify = function (index, proof) {
112128
var caml_pasta_fq_plonk_proof_batch_verify = function (indexes, proofs) {
113129
indexes = tsRustConversionNative.mapMlArrayToRustVector(
114130
indexes,
115-
tsRustConversionNatsRustConversionNativetive.fq.verifierIndexToRust
131+
tsRustConversionNative.fq.verifierIndexToRust
116132
);
117133
proofs = tsRustConversionNative.mapMlArrayToRustVector(
118134
proofs,

src/lib/crypto/kimchi_bindings/js/native/native-overrides/prover-index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ var caml_pasta_fp_plonk_index_create = function (
136136
urs,
137137
lazy_mode
138138
) {
139+
console.log('passing through wasm lookup tables')
139140
var wasm_lookup_tables =
140141
tsRustConversionNative.fp.lookupTablesToRust(caml_lookup_tables);
141142
var wasm_runtime_table_cfgs = tsRustConversionNative.fp.runtimeTableCfgsToRust(
@@ -324,4 +325,4 @@ var caml_pasta_fq_plonk_index_write = function (append, t, path) {
324325
t,
325326
caml_jsstring_of_string(path)
326327
);
327-
};
328+
};

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ var plonk_wasm = (function() {
2828
"WasmFqShifts",
2929
"WasmFpLookupSelectors",
3030
"WasmFqLookupSelectors",
31+
"WasmFpLookupVerifierIndex",
32+
"WasmFqLookupVerifierIndex",
3133
"WasmFpPlonkVerificationEvals",
3234
"WasmFqPlonkVerificationEvals",
3335
"WasmFpPlonkLookupVerifierIndex",
@@ -154,6 +156,10 @@ var plonk_wasm = (function() {
154156
"WasmFqProofEvaluations",
155157
"WasmFpProverCommitments",
156158
"WasmFqProverCommitments",
159+
"WasmVecVecFp",
160+
"WasmVecVecFq",
161+
"WasmFpRuntimeTable",
162+
"WasmFqRuntimeTable",
157163
];
158164

159165
overrides.forEach(function (override) {

0 commit comments

Comments
 (0)