Skip to content

Commit 940cf31

Browse files
committed
jsoo: attempt proof bindings
1 parent a7b1ba0 commit 940cf31

File tree

3 files changed

+57
-76
lines changed

3 files changed

+57
-76
lines changed

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

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,6 @@
11
/* global plonk_wasm, tsRustConversion
22
*/
33

4-
// Provides: caml_pasta_fp_plonk_proof_create
5-
// Requires: plonk_wasm, tsRustConversion
6-
var caml_pasta_fp_plonk_proof_create = function (
7-
index,
8-
witness_cols,
9-
caml_runtime_tables,
10-
prev_challenges,
11-
prev_sgs
12-
) {
13-
var w = new plonk_wasm.WasmVecVecFp(witness_cols.length - 1);
14-
for (var i = 1; i < witness_cols.length; i++) {
15-
w.push(tsRustConversion.fp.vectorToRust(witness_cols[i]));
16-
}
17-
witness_cols = w;
18-
prev_challenges = tsRustConversion.fp.vectorToRust(prev_challenges);
19-
var wasm_runtime_tables =
20-
tsRustConversion.fp.runtimeTablesToRust(caml_runtime_tables);
21-
prev_sgs = tsRustConversion.fp.pointsToRust(prev_sgs);
22-
var proof = plonk_wasm.caml_pasta_fp_plonk_proof_create(
23-
index,
24-
witness_cols,
25-
wasm_runtime_tables,
26-
prev_challenges,
27-
prev_sgs
28-
);
29-
return tsRustConversion.fp.proofFromRust(proof);
30-
};
31-
32-
// Provides: caml_pasta_fp_plonk_proof_verify
33-
// Requires: plonk_wasm, tsRustConversion
34-
var caml_pasta_fp_plonk_proof_verify = function (index, proof) {
35-
index = tsRustConversion.fp.verifierIndexToRust(index);
36-
proof = tsRustConversion.fp.proofToRust(proof);
37-
return plonk_wasm.caml_pasta_fp_plonk_proof_verify(index, proof);
38-
};
394

405
// Provides: caml_pasta_fp_plonk_proof_batch_verify
416
// Requires: plonk_wasm, tsRustConversion
@@ -69,41 +34,7 @@ var caml_pasta_fp_plonk_proof_deep_copy = function (proof) {
6934
);
7035
};
7136

72-
// Provides: caml_pasta_fq_plonk_proof_create
73-
// Requires: plonk_wasm, tsRustConversion
74-
var caml_pasta_fq_plonk_proof_create = function (
75-
index,
76-
witness_cols,
77-
caml_runtime_tables,
78-
prev_challenges,
79-
prev_sgs
80-
) {
81-
var w = new plonk_wasm.WasmVecVecFq(witness_cols.length - 1);
82-
for (var i = 1; i < witness_cols.length; i++) {
83-
w.push(tsRustConversion.fq.vectorToRust(witness_cols[i]));
84-
}
85-
witness_cols = w;
86-
prev_challenges = tsRustConversion.fq.vectorToRust(prev_challenges);
87-
var wasm_runtime_tables =
88-
tsRustConversion.fq.runtimeTablesToRust(caml_runtime_tables);
89-
prev_sgs = tsRustConversion.fq.pointsToRust(prev_sgs);
90-
var proof = plonk_wasm.caml_pasta_fq_plonk_proof_create(
91-
index,
92-
witness_cols,
93-
wasm_runtime_tables,
94-
prev_challenges,
95-
prev_sgs
96-
);
97-
return tsRustConversion.fq.proofFromRust(proof);
98-
};
9937

100-
// Provides: caml_pasta_fq_plonk_proof_verify
101-
// Requires: plonk_wasm, tsRustConversion
102-
var caml_pasta_fq_plonk_proof_verify = function (index, proof) {
103-
index = tsRustConversion.fq.verifierIndexToRust(index);
104-
proof = tsRustConversion.fq.proofToRust(proof);
105-
return plonk_wasm.caml_pasta_fq_plonk_proof_verify(index, proof);
106-
};
10738

10839
// Provides: caml_pasta_fq_plonk_proof_batch_verify
10940
// Requires: plonk_wasm, tsRustConversion
Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* global plonk_wasm, tsRustConversion
1+
/* global plonk_wasm, tsRustConversionNative
22
*/
33

44

55
// Provides: caml_pasta_fp_plonk_proof_create
6-
// Requires: plonk_wasm, tsRustConversion
6+
// Requires: plonk_wasm, tsRustConversionNative
77
var caml_pasta_fp_plonk_proof_create = function (
88
index,
99
witness_cols,
@@ -13,19 +13,65 @@ var caml_pasta_fp_plonk_proof_create = function (
1313
) {
1414
var w = new plonk_wasm.WasmVecVecFp(witness_cols.length - 1);
1515
for (var i = 1; i < witness_cols.length; i++) {
16-
w.push(tsRustConversion.fp.vectorToRust(witness_cols[i]));
16+
w.push(tsRustConversionNative.fp.vectorToRust(witness_cols[i]));
1717
}
1818
witness_cols = w;
19-
prev_challenges = tsRustConversion.fp.vectorToRust(prev_challenges);
19+
prev_challenges = tsRustConversionNative.fp.vectorToRust(prev_challenges);
2020
var wasm_runtime_tables =
21-
tsRustConversion.fp.runtimeTablesToRust(caml_runtime_tables);
22-
prev_sgs = tsRustConversion.fp.pointsToRust(prev_sgs);
21+
tsRustConversionNative.fp.runtimeTablesToRust(caml_runtime_tables);
22+
prev_sgs = tsRustConversionNative.fp.pointsToRust(prev_sgs);
2323
var proof = plonk_wasm.caml_pasta_fp_plonk_proof_create(
2424
index,
2525
witness_cols,
2626
wasm_runtime_tables,
2727
prev_challenges,
2828
prev_sgs
2929
);
30-
return tsRustConversion.fp.proofFromRust(proof);
30+
return tsRustConversionNative.fp.proofFromRust(proof);
31+
};
32+
33+
// Provides: caml_pasta_fp_plonk_proof_verify
34+
// Requires: plonk_wasm, tsRustConversionNative
35+
var caml_pasta_fp_plonk_proof_verify = function (index, proof) {
36+
index = tsRustConversionNative.fp.verifierIndexToRust(index);
37+
proof = tsRustConversionNative.fp.proofToRust(proof);
38+
return plonk_wasm.caml_pasta_fp_plonk_proof_verify(index, proof);
39+
};
40+
41+
42+
43+
// Provides: caml_pasta_fq_plonk_proof_create
44+
// Requires: plonk_wasm, tsRustConversionNative
45+
var caml_pasta_fq_plonk_proof_create = function (
46+
index,
47+
witness_cols,
48+
caml_runtime_tables,
49+
prev_challenges,
50+
prev_sgs
51+
) {
52+
var w = new plonk_wasm.WasmVecVecFq(witness_cols.length - 1);
53+
for (var i = 1; i < witness_cols.length; i++) {
54+
w.push(tsRustConversionNative.fq.vectorToRust(witness_cols[i]));
55+
}
56+
witness_cols = w;
57+
prev_challenges = tsRustConversionNative.fq.vectorToRust(prev_challenges);
58+
var wasm_runtime_tables =
59+
tsRustConversionNative.fq.runtimeTablesToRust(caml_runtime_tables);
60+
prev_sgs = tsRustConversionNative.fq.pointsToRust(prev_sgs);
61+
var proof = plonk_wasm.caml_pasta_fq_plonk_proof_create(
62+
index,
63+
witness_cols,
64+
wasm_runtime_tables,
65+
prev_challenges,
66+
prev_sgs
67+
);
68+
return tsRustConversionNative.fq.proofFromRust(proof);
69+
};
70+
71+
// Provides: caml_pasta_fq_plonk_proof_verify
72+
// Requires: plonk_wasm, tsRustConversionNative
73+
var caml_pasta_fq_plonk_proof_verify = function (index, proof) {
74+
index = tsRustConversionNative.fq.verifierIndexToRust(index);
75+
proof = tsRustConversionNative.fq.proofToRust(proof);
76+
return plonk_wasm.caml_pasta_fq_plonk_proof_verify(index, proof);
3177
};

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ var plonk_wasm = (function() {
8989
"WasmGVesta",
9090
"WasmPastaFp",
9191
"WasmPastaFq",
92+
"caml_pasta_fp_plonk_proof_create",
93+
"caml_pasta_fp_plonk_proof_verify",
94+
"caml_pasta_fq_plonk_proof_create",
95+
"caml_pasta_fq_plonk_proof_verify",
9296
];
9397

9498
overrides.forEach(function (override) {

0 commit comments

Comments
 (0)