|
1 | | -/* global plonk_wasm, caml_jsstring_of_string, |
2 | | - tsBindings, tsRustConversion |
3 | | -*/ |
4 | | - |
5 | | -// Provides: tsSrs |
6 | | -// Requires: tsBindings, plonk_wasm |
7 | | -var tsSrs = tsBindings.srs(plonk_wasm); |
8 | | - |
9 | | -// srs |
10 | | - |
11 | | -// Provides: caml_fp_srs_create |
12 | | -// Requires: tsSrs |
13 | | -var caml_fp_srs_create = tsSrs.fp.create; |
14 | | - |
15 | | -// Provides: caml_fp_srs_write |
16 | | -// Requires: plonk_wasm, caml_jsstring_of_string |
17 | | -var caml_fp_srs_write = function (append, t, path) { |
18 | | - if (append === 0) { |
19 | | - append = undefined; |
20 | | - } else { |
21 | | - append = append[1]; |
22 | | - } |
23 | | - return plonk_wasm.caml_fp_srs_write(append, t, caml_jsstring_of_string(path)); |
24 | | -}; |
25 | | - |
26 | | -// Provides: caml_fp_srs_read |
27 | | -// Requires: plonk_wasm, caml_jsstring_of_string |
28 | | -var caml_fp_srs_read = function (offset, path) { |
29 | | - if (offset === 0) { |
30 | | - offset = undefined; |
31 | | - } else { |
32 | | - offset = offset[1]; |
33 | | - } |
34 | | - var res = plonk_wasm.caml_fp_srs_read(offset, caml_jsstring_of_string(path)); |
35 | | - if (res) { |
36 | | - return [0, res]; // Some(res) |
37 | | - } else { |
38 | | - return 0; // None |
39 | | - } |
40 | | -}; |
41 | | - |
42 | | -// Provides: caml_fp_srs_lagrange_commitments_whole_domain |
43 | | -// Requires: tsSrs |
44 | | -var caml_fp_srs_lagrange_commitments_whole_domain = |
45 | | - tsSrs.fp.lagrangeCommitmentsWholeDomain; |
46 | | - |
47 | | -// Provides: caml_fq_srs_lagrange_commitments_whole_domain |
48 | | -// Requires: tsSrs |
49 | | -var caml_fq_srs_lagrange_commitments_whole_domain = |
50 | | - tsSrs.fq.lagrangeCommitmentsWholeDomain; |
51 | | - |
52 | | -// Provides: caml_fp_srs_lagrange_commitment |
53 | | -// Requires: tsSrs |
54 | | -var caml_fp_srs_lagrange_commitment = tsSrs.fp.lagrangeCommitment; |
55 | | - |
56 | | -// Provides: caml_fp_srs_commit_evaluations |
57 | | -// Requires: plonk_wasm, tsRustConversion |
58 | | -var caml_fp_srs_commit_evaluations = function (t, domain_size, fps) { |
59 | | - var res = plonk_wasm.caml_fp_srs_commit_evaluations( |
60 | | - t, |
61 | | - domain_size, |
62 | | - tsRustConversion.fp.vectorToRust(fps) |
63 | | - ); |
64 | | - return tsRustConversion.fp.polyCommFromRust(res); |
65 | | -}; |
66 | | - |
67 | | -// Provides: caml_fp_srs_b_poly_commitment |
68 | | -// Requires: plonk_wasm, tsRustConversion |
69 | | -var caml_fp_srs_b_poly_commitment = function (srs, chals) { |
70 | | - var res = plonk_wasm.caml_fp_srs_b_poly_commitment( |
71 | | - srs, |
72 | | - tsRustConversion.fieldsToRustFlat(chals) |
73 | | - ); |
74 | | - return tsRustConversion.fp.polyCommFromRust(res); |
75 | | -}; |
76 | | - |
77 | | -// Provides: caml_fp_srs_batch_accumulator_check |
78 | | -// Requires: plonk_wasm, tsRustConversion |
79 | | -var caml_fp_srs_batch_accumulator_check = function (srs, comms, chals) { |
80 | | - var rust_comms = tsRustConversion.fp.pointsToRust(comms); |
81 | | - var rust_chals = tsRustConversion.fp.vectorToRust(chals); |
82 | | - var ok = plonk_wasm.caml_fp_srs_batch_accumulator_check( |
83 | | - srs, |
84 | | - rust_comms, |
85 | | - rust_chals |
86 | | - ); |
87 | | - return ok; |
88 | | -}; |
89 | | - |
90 | | -// Provides: caml_fp_srs_batch_accumulator_generate |
91 | | -// Requires: plonk_wasm, tsRustConversion |
92 | | -var caml_fp_srs_batch_accumulator_generate = function (srs, n_comms, chals) { |
93 | | - var rust_chals = tsRustConversion.fp.vectorToRust(chals); |
94 | | - var rust_comms = plonk_wasm.caml_fp_srs_batch_accumulator_generate( |
95 | | - srs, |
96 | | - n_comms, |
97 | | - rust_chals |
98 | | - ); |
99 | | - return tsRustConversion.fp.pointsFromRust(rust_comms); |
100 | | -}; |
101 | | - |
102 | | -// Provides: caml_fp_srs_h |
103 | | -// Requires: plonk_wasm, tsRustConversion |
104 | | -var caml_fp_srs_h = function (t) { |
105 | | - return tsRustConversion.fp.pointFromRust(plonk_wasm.caml_fp_srs_h(t)); |
106 | | -}; |
107 | | - |
108 | | -// Provides: caml_fp_srs_add_lagrange_basis |
109 | | -// Requires: tsSrs |
110 | | -var caml_fp_srs_add_lagrange_basis = tsSrs.fp.addLagrangeBasis; |
111 | | - |
112 | | -// Provides: caml_fq_srs_create |
113 | | -// Requires: tsSrs |
114 | | -var caml_fq_srs_create = tsSrs.fq.create; |
115 | | - |
116 | | -// Provides: caml_fq_srs_write |
117 | | -// Requires: plonk_wasm, caml_jsstring_of_string |
118 | | -var caml_fq_srs_write = function (append, t, path) { |
119 | | - if (append === 0) { |
120 | | - append = undefined; |
121 | | - } else { |
122 | | - append = append[1]; |
123 | | - } |
124 | | - return plonk_wasm.caml_fq_srs_write(append, t, caml_jsstring_of_string(path)); |
125 | | -}; |
126 | | - |
127 | | -// Provides: caml_fq_srs_read |
128 | | -// Requires: plonk_wasm, caml_jsstring_of_string |
129 | | -var caml_fq_srs_read = function (offset, path) { |
130 | | - if (offset === 0) { |
131 | | - offset = undefined; |
132 | | - } else { |
133 | | - offset = offset[1]; |
134 | | - } |
135 | | - var res = plonk_wasm.caml_fq_srs_read(offset, caml_jsstring_of_string(path)); |
136 | | - if (res) { |
137 | | - return [0, res]; // Some(res) |
138 | | - } else { |
139 | | - return 0; // None |
140 | | - } |
141 | | -}; |
142 | | - |
143 | | -// Provides: caml_fq_srs_lagrange_commitment |
144 | | -// Requires: tsSrs |
145 | | -var caml_fq_srs_lagrange_commitment = tsSrs.fq.lagrangeCommitment; |
146 | | - |
147 | | -// Provides: caml_fq_srs_commit_evaluations |
148 | | -// Requires: plonk_wasm, tsRustConversion |
149 | | -var caml_fq_srs_commit_evaluations = function (t, domain_size, fqs) { |
150 | | - var res = plonk_wasm.caml_fq_srs_commit_evaluations( |
151 | | - t, |
152 | | - domain_size, |
153 | | - tsRustConversion.fq.vectorToRust(fqs) |
154 | | - ); |
155 | | - return tsRustConversion.fq.polyCommFromRust(res); |
156 | | -}; |
157 | | - |
158 | | -// Provides: caml_fq_srs_b_poly_commitment |
159 | | -// Requires: plonk_wasm, tsRustConversion |
160 | | -var caml_fq_srs_b_poly_commitment = function (srs, chals) { |
161 | | - var res = plonk_wasm.caml_fq_srs_b_poly_commitment( |
162 | | - srs, |
163 | | - tsRustConversion.fieldsToRustFlat(chals) |
164 | | - ); |
165 | | - return tsRustConversion.fq.polyCommFromRust(res); |
166 | | -}; |
167 | | - |
168 | | -// Provides: caml_fq_srs_batch_accumulator_check |
169 | | -// Requires: plonk_wasm, tsRustConversion |
170 | | -var caml_fq_srs_batch_accumulator_check = function (srs, comms, chals) { |
171 | | - var rust_comms = tsRustConversion.fq.pointsToRust(comms); |
172 | | - var rust_chals = tsRustConversion.fq.vectorToRust(chals); |
173 | | - var ok = plonk_wasm.caml_fq_srs_batch_accumulator_check( |
174 | | - srs, |
175 | | - rust_comms, |
176 | | - rust_chals |
177 | | - ); |
178 | | - return ok; |
179 | | -}; |
180 | | - |
181 | | -// Provides: caml_fq_srs_batch_accumulator_generate |
182 | | -// Requires: plonk_wasm, tsRustConversion |
183 | | -var caml_fq_srs_batch_accumulator_generate = function (srs, comms, chals) { |
184 | | - var rust_chals = tsRustConversion.fq.vectorToRust(chals); |
185 | | - var rust_comms = plonk_wasm.caml_fq_srs_batch_accumulator_generate( |
186 | | - srs, |
187 | | - comms, |
188 | | - rust_chals |
189 | | - ); |
190 | | - return tsRustConversion.fq.pointsFromRust(rust_comms); |
191 | | -}; |
192 | | - |
193 | | -// Provides: caml_fq_srs_h |
194 | | -// Requires: plonk_wasm, tsRustConversion |
195 | | -var caml_fq_srs_h = function (t) { |
196 | | - return tsRustConversion.fq.pointFromRust(plonk_wasm.caml_fq_srs_h(t)); |
197 | | -}; |
198 | | - |
199 | | -// Provides: caml_fq_srs_add_lagrange_basis |
200 | | -// Requires: tsSrs |
201 | | -var caml_fq_srs_add_lagrange_basis = tsSrs.fq.addLagrangeBasis; |
0 commit comments