@noir-lang/acvm_js 0.55.0 → 1.0.0-9c1fafc.nightly
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nodejs/acvm_js.d.ts +166 -177
- package/nodejs/acvm_js.js +710 -782
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +31 -27
- package/package.json +14 -14
- package/web/acvm_js.d.ts +215 -221
- package/web/acvm_js.js +735 -762
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +31 -27
package/nodejs/acvm_js.js
CHANGED
|
@@ -1,132 +1,634 @@
|
|
|
1
|
-
|
|
2
|
-
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
|
-
let wasm;
|
|
4
|
-
const { TextDecoder, TextEncoder } = require(`util`);
|
|
1
|
+
/* @ts-self-types="./acvm_js.d.ts" */
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
5
|
+
* @param {string} lhs
|
|
6
|
+
* @param {string} rhs
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
function and(lhs, rhs) {
|
|
10
|
+
const ret = wasm.and(lhs, rhs);
|
|
11
|
+
return ret;
|
|
12
|
+
}
|
|
13
|
+
exports.and = and;
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
17
|
+
* @param {Uint8Array} inputs
|
|
18
|
+
* @returns {Uint8Array}
|
|
19
|
+
*/
|
|
20
|
+
function blake2s256(inputs) {
|
|
21
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
22
|
+
const len0 = WASM_VECTOR_LEN;
|
|
23
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
24
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
25
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
26
|
+
return v2;
|
|
18
27
|
}
|
|
28
|
+
exports.blake2s256 = blake2s256;
|
|
19
29
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
32
|
+
* @returns {`BuildInfo`} - Information on how the installed package was built.
|
|
33
|
+
*/
|
|
34
|
+
function buildInfo() {
|
|
35
|
+
const ret = wasm.buildInfo();
|
|
23
36
|
return ret;
|
|
24
37
|
}
|
|
38
|
+
exports.buildInfo = buildInfo;
|
|
25
39
|
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
42
|
+
*
|
|
43
|
+
* @param {`WitnessMap`} `witness_map` - A witness map.
|
|
44
|
+
* @returns {`Uint8Array`} A compressed witness map
|
|
45
|
+
*/
|
|
46
|
+
function compressWitness(witness_map) {
|
|
47
|
+
const ret = wasm.compressWitness(witness_map);
|
|
48
|
+
if (ret[3]) {
|
|
49
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
50
|
+
}
|
|
51
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
52
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
53
|
+
return v1;
|
|
28
54
|
}
|
|
55
|
+
exports.compressWitness = compressWitness;
|
|
29
56
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
59
|
+
*
|
|
60
|
+
* @param {`WitnessStack`} `witness_stack` - A witness stack.
|
|
61
|
+
* @returns {`Uint8Array`} A compressed witness stack
|
|
62
|
+
*/
|
|
63
|
+
function compressWitnessStack(witness_stack) {
|
|
64
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
65
|
+
if (ret[3]) {
|
|
66
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
35
67
|
}
|
|
36
|
-
|
|
68
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
69
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
70
|
+
return v1;
|
|
37
71
|
}
|
|
72
|
+
exports.compressWitnessStack = compressWitnessStack;
|
|
38
73
|
|
|
39
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
76
|
+
* This should be used to only fetch the witness map for the main function.
|
|
77
|
+
*
|
|
78
|
+
* @param {`Uint8Array`} `compressed_witness` - A compressed witness.
|
|
79
|
+
* @returns {`WitnessMap`} The decompressed witness map.
|
|
80
|
+
*/
|
|
81
|
+
function decompressWitness(compressed_witness) {
|
|
82
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
83
|
+
const len0 = WASM_VECTOR_LEN;
|
|
84
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
85
|
+
if (ret[2]) {
|
|
86
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
87
|
+
}
|
|
88
|
+
return takeFromExternrefTable0(ret[0]);
|
|
89
|
+
}
|
|
90
|
+
exports.decompressWitness = decompressWitness;
|
|
40
91
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
94
|
+
*
|
|
95
|
+
* @param {`Uint8Array`} `compressed_witness` - A compressed witness.
|
|
96
|
+
* @returns {`WitnessStack`} The decompressed witness stack.
|
|
97
|
+
*/
|
|
98
|
+
function decompressWitnessStack(compressed_witness) {
|
|
99
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
100
|
+
const len0 = WASM_VECTOR_LEN;
|
|
101
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
102
|
+
if (ret[2]) {
|
|
103
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
44
104
|
}
|
|
45
|
-
return
|
|
105
|
+
return takeFromExternrefTable0(ret[0]);
|
|
46
106
|
}
|
|
107
|
+
exports.decompressWitnessStack = decompressWitnessStack;
|
|
47
108
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
111
|
+
* @param {Uint8Array} hashed_msg
|
|
112
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
113
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
114
|
+
* @param {Uint8Array} signature
|
|
115
|
+
* @returns {boolean}
|
|
116
|
+
*/
|
|
117
|
+
function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
118
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
119
|
+
const len0 = WASM_VECTOR_LEN;
|
|
120
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
121
|
+
const len1 = WASM_VECTOR_LEN;
|
|
122
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
123
|
+
const len2 = WASM_VECTOR_LEN;
|
|
124
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
125
|
+
const len3 = WASM_VECTOR_LEN;
|
|
126
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
127
|
+
return ret !== 0;
|
|
128
|
+
}
|
|
129
|
+
exports.ecdsa_secp256k1_verify = ecdsa_secp256k1_verify;
|
|
52
130
|
|
|
53
|
-
|
|
54
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
133
|
+
* @param {Uint8Array} hashed_msg
|
|
134
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
135
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
136
|
+
* @param {Uint8Array} signature
|
|
137
|
+
* @returns {boolean}
|
|
138
|
+
*/
|
|
139
|
+
function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
140
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
141
|
+
const len0 = WASM_VECTOR_LEN;
|
|
142
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
143
|
+
const len1 = WASM_VECTOR_LEN;
|
|
144
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
145
|
+
const len2 = WASM_VECTOR_LEN;
|
|
146
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
147
|
+
const len3 = WASM_VECTOR_LEN;
|
|
148
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
149
|
+
return ret !== 0;
|
|
55
150
|
}
|
|
151
|
+
exports.ecdsa_secp256r1_verify = ecdsa_secp256r1_verify;
|
|
56
152
|
|
|
57
|
-
|
|
153
|
+
/**
|
|
154
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
155
|
+
*
|
|
156
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
157
|
+
* @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `circuit`..
|
|
158
|
+
* @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the circuit.
|
|
159
|
+
* @returns {`WitnessMap`} The solved witness calculated by executing the circuit on the provided inputs.
|
|
160
|
+
*/
|
|
161
|
+
function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
162
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
163
|
+
const len0 = WASM_VECTOR_LEN;
|
|
164
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
165
|
+
return ret;
|
|
166
|
+
}
|
|
167
|
+
exports.executeCircuit = executeCircuit;
|
|
58
168
|
|
|
59
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
171
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
172
|
+
*
|
|
173
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
174
|
+
* @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `circuit`..
|
|
175
|
+
* @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the circuit.
|
|
176
|
+
* @returns {`SolvedAndReturnWitness`} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
177
|
+
*/
|
|
178
|
+
function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
179
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
180
|
+
const len0 = WASM_VECTOR_LEN;
|
|
181
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
182
|
+
return ret;
|
|
183
|
+
}
|
|
184
|
+
exports.executeCircuitWithReturnWitness = executeCircuitWithReturnWitness;
|
|
60
185
|
|
|
61
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
188
|
+
*
|
|
189
|
+
* @param {`Uint8Array`} program - A serialized representation of an ACIR program
|
|
190
|
+
* @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `program`.
|
|
191
|
+
* @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the program.
|
|
192
|
+
* @returns {`WitnessStack`} The solved witness calculated by executing the program on the provided inputs.
|
|
193
|
+
*/
|
|
194
|
+
function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
195
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
196
|
+
const len0 = WASM_VECTOR_LEN;
|
|
197
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
198
|
+
return ret;
|
|
199
|
+
}
|
|
200
|
+
exports.executeProgram = executeProgram;
|
|
62
201
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
204
|
+
*
|
|
205
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
206
|
+
* @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
|
|
207
|
+
* @returns {`WitnessMap`} A witness map containing the circuit's public parameters.
|
|
208
|
+
* @param {Uint8Array} program
|
|
209
|
+
* @param {WitnessMap} solved_witness
|
|
210
|
+
* @returns {WitnessMap}
|
|
211
|
+
*/
|
|
212
|
+
function getPublicParametersWitness(program, solved_witness) {
|
|
213
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
214
|
+
const len0 = WASM_VECTOR_LEN;
|
|
215
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
216
|
+
if (ret[2]) {
|
|
217
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
66
218
|
}
|
|
67
|
-
return
|
|
219
|
+
return takeFromExternrefTable0(ret[0]);
|
|
68
220
|
}
|
|
221
|
+
exports.getPublicParametersWitness = getPublicParametersWitness;
|
|
69
222
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
223
|
+
/**
|
|
224
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
225
|
+
*
|
|
226
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
227
|
+
* @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
|
|
228
|
+
* @returns {`WitnessMap`} A witness map containing the circuit's public inputs.
|
|
229
|
+
* @param {Uint8Array} program
|
|
230
|
+
* @param {WitnessMap} solved_witness
|
|
231
|
+
* @returns {WitnessMap}
|
|
232
|
+
*/
|
|
233
|
+
function getPublicWitness(program, solved_witness) {
|
|
234
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
235
|
+
const len0 = WASM_VECTOR_LEN;
|
|
236
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
237
|
+
if (ret[2]) {
|
|
238
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
239
|
+
}
|
|
240
|
+
return takeFromExternrefTable0(ret[0]);
|
|
73
241
|
}
|
|
242
|
+
exports.getPublicWitness = getPublicWitness;
|
|
74
243
|
|
|
75
|
-
|
|
244
|
+
/**
|
|
245
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
246
|
+
*
|
|
247
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
248
|
+
* @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
|
|
249
|
+
* @returns {`WitnessMap`} A witness map containing the circuit's return values.
|
|
250
|
+
* @param {Uint8Array} program
|
|
251
|
+
* @param {WitnessMap} witness_map
|
|
252
|
+
* @returns {WitnessMap}
|
|
253
|
+
*/
|
|
254
|
+
function getReturnWitness(program, witness_map) {
|
|
255
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
256
|
+
const len0 = WASM_VECTOR_LEN;
|
|
257
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
258
|
+
if (ret[2]) {
|
|
259
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
260
|
+
}
|
|
261
|
+
return takeFromExternrefTable0(ret[0]);
|
|
262
|
+
}
|
|
263
|
+
exports.getReturnWitness = getReturnWitness;
|
|
76
264
|
|
|
77
|
-
|
|
265
|
+
/**
|
|
266
|
+
* Sets the package's logging level.
|
|
267
|
+
*
|
|
268
|
+
* @param {`LogLevel`} level - The maximum level of logging to be emitted.
|
|
269
|
+
*/
|
|
270
|
+
function initLogLevel(filter) {
|
|
271
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
272
|
+
const len0 = WASM_VECTOR_LEN;
|
|
273
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
274
|
+
if (ret[1]) {
|
|
275
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.initLogLevel = initLogLevel;
|
|
78
279
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
280
|
+
/**
|
|
281
|
+
* Sha256 compression function
|
|
282
|
+
* @param {Uint32Array} inputs
|
|
283
|
+
* @param {Uint32Array} state
|
|
284
|
+
* @returns {Uint32Array}
|
|
285
|
+
*/
|
|
286
|
+
function sha256_compression(inputs, state) {
|
|
287
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
288
|
+
const len0 = WASM_VECTOR_LEN;
|
|
289
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
290
|
+
const len1 = WASM_VECTOR_LEN;
|
|
291
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
292
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
293
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
294
|
+
return v3;
|
|
82
295
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
296
|
+
exports.sha256_compression = sha256_compression;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
300
|
+
* @param {string} lhs
|
|
301
|
+
* @param {string} rhs
|
|
302
|
+
* @returns {string}
|
|
303
|
+
*/
|
|
304
|
+
function xor(lhs, rhs) {
|
|
305
|
+
const ret = wasm.xor(lhs, rhs);
|
|
306
|
+
return ret;
|
|
307
|
+
}
|
|
308
|
+
exports.xor = xor;
|
|
309
|
+
|
|
310
|
+
function __wbg_get_imports() {
|
|
311
|
+
const import0 = {
|
|
312
|
+
__proto__: null,
|
|
313
|
+
__wbg___wbindgen_debug_string_ddde1867f49c2442: function(arg0, arg1) {
|
|
314
|
+
const ret = debugString(arg1);
|
|
315
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
316
|
+
const len1 = WASM_VECTOR_LEN;
|
|
317
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
318
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
319
|
+
},
|
|
320
|
+
__wbg___wbindgen_is_function_d633e708baf0d146: function(arg0) {
|
|
321
|
+
const ret = typeof(arg0) === 'function';
|
|
322
|
+
return ret;
|
|
323
|
+
},
|
|
324
|
+
__wbg___wbindgen_is_string_7debe47dc1e045c2: function(arg0) {
|
|
325
|
+
const ret = typeof(arg0) === 'string';
|
|
326
|
+
return ret;
|
|
327
|
+
},
|
|
328
|
+
__wbg___wbindgen_is_undefined_c18285b9fc34cb7d: function(arg0) {
|
|
329
|
+
const ret = arg0 === undefined;
|
|
330
|
+
return ret;
|
|
331
|
+
},
|
|
332
|
+
__wbg___wbindgen_number_get_5854912275df1894: function(arg0, arg1) {
|
|
333
|
+
const obj = arg1;
|
|
334
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
335
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
336
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
337
|
+
},
|
|
338
|
+
__wbg___wbindgen_string_get_3e5751597f39a112: function(arg0, arg1) {
|
|
339
|
+
const obj = arg1;
|
|
340
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
341
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
342
|
+
var len1 = WASM_VECTOR_LEN;
|
|
343
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
344
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
345
|
+
},
|
|
346
|
+
__wbg___wbindgen_throw_39bc967c0e5a9b58: function(arg0, arg1) {
|
|
347
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
348
|
+
},
|
|
349
|
+
__wbg__wbg_cb_unref_b6d832240a919168: function(arg0) {
|
|
350
|
+
arg0._wbg_cb_unref();
|
|
351
|
+
},
|
|
352
|
+
__wbg_call_08ad0d89caa7cb79: function() { return handleError(function (arg0, arg1, arg2) {
|
|
353
|
+
const ret = arg0.call(arg1, arg2);
|
|
354
|
+
return ret;
|
|
355
|
+
}, arguments); },
|
|
356
|
+
__wbg_call_c974f0bf2231552e: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
357
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
358
|
+
return ret;
|
|
359
|
+
}, arguments); },
|
|
360
|
+
__wbg_constructor_8ecaa06e31f2da98: function(arg0) {
|
|
361
|
+
const ret = new Error(arg0);
|
|
362
|
+
return ret;
|
|
363
|
+
},
|
|
364
|
+
__wbg_constructor_bcbf1d677593ace5: function(arg0) {
|
|
365
|
+
const ret = new Error(arg0);
|
|
366
|
+
return ret;
|
|
367
|
+
},
|
|
368
|
+
__wbg_debug_8804c16f548276da: function(arg0, arg1, arg2, arg3) {
|
|
369
|
+
console.debug(arg0, arg1, arg2, arg3);
|
|
370
|
+
},
|
|
371
|
+
__wbg_debug_e69ad32e6af73f94: function(arg0) {
|
|
372
|
+
console.debug(arg0);
|
|
373
|
+
},
|
|
374
|
+
__wbg_error_91d10625a3b36a08: function(arg0, arg1, arg2, arg3) {
|
|
375
|
+
console.error(arg0, arg1, arg2, arg3);
|
|
376
|
+
},
|
|
377
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
378
|
+
let deferred0_0;
|
|
379
|
+
let deferred0_1;
|
|
380
|
+
try {
|
|
381
|
+
deferred0_0 = arg0;
|
|
382
|
+
deferred0_1 = arg1;
|
|
383
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
384
|
+
} finally {
|
|
385
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
__wbg_error_ad28debb48b5c6bb: function(arg0) {
|
|
389
|
+
console.error(arg0);
|
|
390
|
+
},
|
|
391
|
+
__wbg_forEach_9694464cb60ea370: function(arg0, arg1, arg2) {
|
|
392
|
+
try {
|
|
393
|
+
var state0 = {a: arg1, b: arg2};
|
|
394
|
+
var cb0 = (arg0, arg1) => {
|
|
395
|
+
const a = state0.a;
|
|
396
|
+
state0.a = 0;
|
|
397
|
+
try {
|
|
398
|
+
return wasm_bindgen__convert__closures_____invoke__h75e989036704f034(a, state0.b, arg0, arg1);
|
|
399
|
+
} finally {
|
|
400
|
+
state0.a = a;
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
arg0.forEach(cb0);
|
|
404
|
+
} finally {
|
|
405
|
+
state0.a = state0.b = 0;
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
__wbg_forEach_f33e388a24ae7d4f: function(arg0, arg1, arg2) {
|
|
409
|
+
try {
|
|
410
|
+
var state0 = {a: arg1, b: arg2};
|
|
411
|
+
var cb0 = (arg0, arg1, arg2) => {
|
|
412
|
+
const a = state0.a;
|
|
413
|
+
state0.a = 0;
|
|
414
|
+
try {
|
|
415
|
+
return wasm_bindgen__convert__closures_____invoke__h19cd9ea1cbe9b0b3(a, state0.b, arg0, arg1, arg2);
|
|
416
|
+
} finally {
|
|
417
|
+
state0.a = a;
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
arg0.forEach(cb0);
|
|
421
|
+
} finally {
|
|
422
|
+
state0.a = state0.b = 0;
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
__wbg_fromEntries_2f51c4024e2a7aa3: function() { return handleError(function (arg0) {
|
|
426
|
+
const ret = Object.fromEntries(arg0);
|
|
427
|
+
return ret;
|
|
428
|
+
}, arguments); },
|
|
429
|
+
__wbg_from_d7e888a2e9063b32: function(arg0) {
|
|
430
|
+
const ret = Array.from(arg0);
|
|
431
|
+
return ret;
|
|
432
|
+
},
|
|
433
|
+
__wbg_get_f09c3a16f8848381: function(arg0, arg1) {
|
|
434
|
+
const ret = arg0[arg1 >>> 0];
|
|
435
|
+
return ret;
|
|
436
|
+
},
|
|
437
|
+
__wbg_get_unchecked_3d0f4b91c8eca4f0: function(arg0, arg1) {
|
|
438
|
+
const ret = arg0[arg1 >>> 0];
|
|
439
|
+
return ret;
|
|
440
|
+
},
|
|
441
|
+
__wbg_info_28d530adaabdab8c: function(arg0, arg1, arg2, arg3) {
|
|
442
|
+
console.info(arg0, arg1, arg2, arg3);
|
|
443
|
+
},
|
|
444
|
+
__wbg_info_72e7e65fa3fc8b25: function(arg0) {
|
|
445
|
+
console.info(arg0);
|
|
446
|
+
},
|
|
447
|
+
__wbg_isArray_581b02d0060c9728: function(arg0) {
|
|
448
|
+
const ret = Array.isArray(arg0);
|
|
449
|
+
return ret;
|
|
450
|
+
},
|
|
451
|
+
__wbg_length_a31e05262e09b7f8: function(arg0) {
|
|
452
|
+
const ret = arg0.length;
|
|
453
|
+
return ret;
|
|
454
|
+
},
|
|
455
|
+
__wbg_new_1213b57bccbdbb66: function(arg0, arg1) {
|
|
456
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
457
|
+
return ret;
|
|
458
|
+
},
|
|
459
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
460
|
+
const ret = new Error();
|
|
461
|
+
return ret;
|
|
462
|
+
},
|
|
463
|
+
__wbg_new_30bb59575bdc96f7: function() {
|
|
464
|
+
const ret = new Array();
|
|
465
|
+
return ret;
|
|
466
|
+
},
|
|
467
|
+
__wbg_new_6f45ce010e10900b: function() {
|
|
468
|
+
const ret = new Map();
|
|
469
|
+
return ret;
|
|
470
|
+
},
|
|
471
|
+
__wbg_new_92df58a8ec3bfb6b: function() {
|
|
472
|
+
const ret = new Map();
|
|
473
|
+
return ret;
|
|
474
|
+
},
|
|
475
|
+
__wbg_new_cbee8c0d5c479eac: function() {
|
|
476
|
+
const ret = new Array();
|
|
477
|
+
return ret;
|
|
478
|
+
},
|
|
479
|
+
__wbg_new_typed_8258a0d8488ef2a2: function(arg0, arg1) {
|
|
480
|
+
try {
|
|
481
|
+
var state0 = {a: arg0, b: arg1};
|
|
482
|
+
var cb0 = (arg0, arg1) => {
|
|
483
|
+
const a = state0.a;
|
|
484
|
+
state0.a = 0;
|
|
485
|
+
try {
|
|
486
|
+
return wasm_bindgen__convert__closures_____invoke__h75e989036704f034_21(a, state0.b, arg0, arg1);
|
|
487
|
+
} finally {
|
|
488
|
+
state0.a = a;
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
const ret = new Promise(cb0);
|
|
492
|
+
return ret;
|
|
493
|
+
} finally {
|
|
494
|
+
state0.a = state0.b = 0;
|
|
495
|
+
}
|
|
496
|
+
},
|
|
497
|
+
__wbg_parse_6dfe891b5bafb5cd: function() { return handleError(function (arg0, arg1) {
|
|
498
|
+
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
499
|
+
return ret;
|
|
500
|
+
}, arguments); },
|
|
501
|
+
__wbg_push_a6f9488ffd3fae3b: function(arg0, arg1) {
|
|
502
|
+
const ret = arg0.push(arg1);
|
|
503
|
+
return ret;
|
|
504
|
+
},
|
|
505
|
+
__wbg_queueMicrotask_2c8dfd1056f24fdc: function(arg0) {
|
|
506
|
+
const ret = arg0.queueMicrotask;
|
|
507
|
+
return ret;
|
|
508
|
+
},
|
|
509
|
+
__wbg_queueMicrotask_8985ad63815852e7: function(arg0) {
|
|
510
|
+
queueMicrotask(arg0);
|
|
511
|
+
},
|
|
512
|
+
__wbg_resolve_5d61e0d10c14730a: function(arg0) {
|
|
513
|
+
const ret = Promise.resolve(arg0);
|
|
514
|
+
return ret;
|
|
515
|
+
},
|
|
516
|
+
__wbg_reverse_fcf59127ee940f96: function(arg0) {
|
|
517
|
+
const ret = arg0.reverse();
|
|
518
|
+
return ret;
|
|
519
|
+
},
|
|
520
|
+
__wbg_set_bad5c505cc70b5f8: function() { return handleError(function (arg0, arg1, arg2) {
|
|
521
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
522
|
+
return ret;
|
|
523
|
+
}, arguments); },
|
|
524
|
+
__wbg_set_cause_7f44b7881bde2bb6: function(arg0, arg1) {
|
|
525
|
+
arg0.cause = arg1;
|
|
526
|
+
},
|
|
527
|
+
__wbg_set_cfc6de03f990decf: function(arg0, arg1, arg2) {
|
|
528
|
+
const ret = arg0.set(arg1, arg2);
|
|
529
|
+
return ret;
|
|
530
|
+
},
|
|
531
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
532
|
+
const ret = arg1.stack;
|
|
533
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
534
|
+
const len1 = WASM_VECTOR_LEN;
|
|
535
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
536
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
537
|
+
},
|
|
538
|
+
__wbg_static_accessor_GLOBAL_THIS_14325d8cca34bb77: function() {
|
|
539
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
540
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
541
|
+
},
|
|
542
|
+
__wbg_static_accessor_GLOBAL_f3a1e69f9c5a7e8e: function() {
|
|
543
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
544
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
545
|
+
},
|
|
546
|
+
__wbg_static_accessor_SELF_50cdb5b517789aca: function() {
|
|
547
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
548
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
549
|
+
},
|
|
550
|
+
__wbg_static_accessor_WINDOW_d6c4126e4c244380: function() {
|
|
551
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
552
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
553
|
+
},
|
|
554
|
+
__wbg_then_d4163530723f56f4: function(arg0, arg1, arg2) {
|
|
555
|
+
const ret = arg0.then(arg1, arg2);
|
|
556
|
+
return ret;
|
|
557
|
+
},
|
|
558
|
+
__wbg_then_f1c954fe00733701: function(arg0, arg1) {
|
|
559
|
+
const ret = arg0.then(arg1);
|
|
560
|
+
return ret;
|
|
561
|
+
},
|
|
562
|
+
__wbg_values_623449cff68c6e40: function(arg0) {
|
|
563
|
+
const ret = Object.values(arg0);
|
|
564
|
+
return ret;
|
|
565
|
+
},
|
|
566
|
+
__wbg_warn_2540fe736f19ad5c: function(arg0, arg1, arg2, arg3) {
|
|
567
|
+
console.warn(arg0, arg1, arg2, arg3);
|
|
568
|
+
},
|
|
569
|
+
__wbg_warn_3310c7343993c074: function(arg0) {
|
|
570
|
+
console.warn(arg0);
|
|
571
|
+
},
|
|
572
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
573
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 477, function: Function { arguments: [Externref], shim_idx: 478, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
574
|
+
const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h2cbd9f7ce6b3c35b, wasm_bindgen__convert__closures_____invoke__h00439a7bc380f87a);
|
|
575
|
+
return ret;
|
|
576
|
+
},
|
|
577
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
578
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
579
|
+
const ret = arg0;
|
|
580
|
+
return ret;
|
|
581
|
+
},
|
|
582
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
583
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
584
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
585
|
+
return ret;
|
|
586
|
+
},
|
|
587
|
+
__wbindgen_init_externref_table: function() {
|
|
588
|
+
const table = wasm.__wbindgen_externrefs;
|
|
589
|
+
const offset = table.grow(4);
|
|
590
|
+
table.set(0, undefined);
|
|
591
|
+
table.set(offset + 0, undefined);
|
|
592
|
+
table.set(offset + 1, null);
|
|
593
|
+
table.set(offset + 2, true);
|
|
594
|
+
table.set(offset + 3, false);
|
|
595
|
+
},
|
|
596
|
+
};
|
|
86
597
|
return {
|
|
87
|
-
|
|
88
|
-
|
|
598
|
+
__proto__: null,
|
|
599
|
+
"./acvm_js_bg.js": import0,
|
|
89
600
|
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
601
|
+
}
|
|
93
602
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
WASM_VECTOR_LEN = buf.length;
|
|
99
|
-
return ptr;
|
|
603
|
+
function wasm_bindgen__convert__closures_____invoke__h00439a7bc380f87a(arg0, arg1, arg2) {
|
|
604
|
+
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h00439a7bc380f87a(arg0, arg1, arg2);
|
|
605
|
+
if (ret[1]) {
|
|
606
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
100
607
|
}
|
|
608
|
+
}
|
|
101
609
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const mem = getUint8Memory0();
|
|
106
|
-
|
|
107
|
-
let offset = 0;
|
|
108
|
-
|
|
109
|
-
for (; offset < len; offset++) {
|
|
110
|
-
const code = arg.charCodeAt(offset);
|
|
111
|
-
if (code > 0x7F) break;
|
|
112
|
-
mem[ptr + offset] = code;
|
|
113
|
-
}
|
|
610
|
+
function wasm_bindgen__convert__closures_____invoke__h75e989036704f034(arg0, arg1, arg2, arg3) {
|
|
611
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h75e989036704f034(arg0, arg1, arg2, arg3);
|
|
612
|
+
}
|
|
114
613
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3) >>> 0;
|
|
120
|
-
const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
|
|
121
|
-
const ret = encodeString(arg, view);
|
|
614
|
+
function wasm_bindgen__convert__closures_____invoke__h75e989036704f034_21(arg0, arg1, arg2, arg3) {
|
|
615
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h75e989036704f034_21(arg0, arg1, arg2, arg3);
|
|
616
|
+
}
|
|
122
617
|
|
|
123
|
-
|
|
124
|
-
|
|
618
|
+
function wasm_bindgen__convert__closures_____invoke__h19cd9ea1cbe9b0b3(arg0, arg1, arg2, arg3, arg4) {
|
|
619
|
+
wasm.wasm_bindgen__convert__closures_____invoke__h19cd9ea1cbe9b0b3(arg0, arg1, arg2, arg3, arg4);
|
|
620
|
+
}
|
|
125
621
|
|
|
126
|
-
|
|
127
|
-
|
|
622
|
+
function addToExternrefTable0(obj) {
|
|
623
|
+
const idx = wasm.__externref_table_alloc();
|
|
624
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
625
|
+
return idx;
|
|
128
626
|
}
|
|
129
627
|
|
|
628
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
629
|
+
? { register: () => {}, unregister: () => {} }
|
|
630
|
+
: new FinalizationRegistry(state => state.dtor(state.a, state.b));
|
|
631
|
+
|
|
130
632
|
function debugString(val) {
|
|
131
633
|
// primitive types
|
|
132
634
|
const type = typeof val;
|
|
@@ -168,7 +670,7 @@ function debugString(val) {
|
|
|
168
670
|
// Test for built-in
|
|
169
671
|
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
170
672
|
let className;
|
|
171
|
-
if (builtInMatches.length > 1) {
|
|
673
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
172
674
|
className = builtInMatches[1];
|
|
173
675
|
} else {
|
|
174
676
|
// Failed to match the standard '[object ClassName]'
|
|
@@ -192,740 +694,166 @@ function debugString(val) {
|
|
|
192
694
|
return className;
|
|
193
695
|
}
|
|
194
696
|
|
|
195
|
-
function
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
// First up with a closure we increment the internal reference
|
|
199
|
-
// count. This ensures that the Rust closure environment won't
|
|
200
|
-
// be deallocated while we're invoking it.
|
|
201
|
-
state.cnt++;
|
|
202
|
-
const a = state.a;
|
|
203
|
-
state.a = 0;
|
|
204
|
-
try {
|
|
205
|
-
return f(a, state.b, ...args);
|
|
206
|
-
} finally {
|
|
207
|
-
if (--state.cnt === 0) {
|
|
208
|
-
wasm.__wbindgen_export_2.get(state.dtor)(a, state.b);
|
|
209
|
-
|
|
210
|
-
} else {
|
|
211
|
-
state.a = a;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
real.original = state;
|
|
216
|
-
|
|
217
|
-
return real;
|
|
218
|
-
}
|
|
219
|
-
function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
220
|
-
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(arg0, arg1, addHeapObject(arg2));
|
|
697
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
698
|
+
ptr = ptr >>> 0;
|
|
699
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
221
700
|
}
|
|
222
701
|
|
|
223
702
|
function getArrayU8FromWasm0(ptr, len) {
|
|
224
703
|
ptr = ptr >>> 0;
|
|
225
|
-
return
|
|
704
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
226
705
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
*/
|
|
233
|
-
module.exports.compressWitness = function(witness_map) {
|
|
234
|
-
try {
|
|
235
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
236
|
-
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
237
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
238
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
239
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
240
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
241
|
-
if (r3) {
|
|
242
|
-
throw takeObject(r2);
|
|
243
|
-
}
|
|
244
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
245
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
246
|
-
return v1;
|
|
247
|
-
} finally {
|
|
248
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
706
|
+
|
|
707
|
+
let cachedDataViewMemory0 = null;
|
|
708
|
+
function getDataViewMemory0() {
|
|
709
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
710
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
249
711
|
}
|
|
250
|
-
|
|
712
|
+
return cachedDataViewMemory0;
|
|
713
|
+
}
|
|
251
714
|
|
|
252
|
-
function
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
WASM_VECTOR_LEN = arg.length;
|
|
256
|
-
return ptr;
|
|
715
|
+
function getStringFromWasm0(ptr, len) {
|
|
716
|
+
ptr = ptr >>> 0;
|
|
717
|
+
return decodeText(ptr, len);
|
|
257
718
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
264
|
-
*/
|
|
265
|
-
module.exports.decompressWitness = function(compressed_witness) {
|
|
266
|
-
try {
|
|
267
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
268
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
269
|
-
const len0 = WASM_VECTOR_LEN;
|
|
270
|
-
wasm.decompressWitness(retptr, ptr0, len0);
|
|
271
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
272
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
273
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
274
|
-
if (r2) {
|
|
275
|
-
throw takeObject(r1);
|
|
276
|
-
}
|
|
277
|
-
return takeObject(r0);
|
|
278
|
-
} finally {
|
|
279
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
719
|
+
|
|
720
|
+
let cachedUint32ArrayMemory0 = null;
|
|
721
|
+
function getUint32ArrayMemory0() {
|
|
722
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
723
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
280
724
|
}
|
|
281
|
-
|
|
725
|
+
return cachedUint32ArrayMemory0;
|
|
726
|
+
}
|
|
282
727
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
288
|
-
*/
|
|
289
|
-
module.exports.compressWitnessStack = function(witness_stack) {
|
|
290
|
-
try {
|
|
291
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
292
|
-
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
293
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
294
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
295
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
296
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
297
|
-
if (r3) {
|
|
298
|
-
throw takeObject(r2);
|
|
299
|
-
}
|
|
300
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
301
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
302
|
-
return v1;
|
|
303
|
-
} finally {
|
|
304
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
728
|
+
let cachedUint8ArrayMemory0 = null;
|
|
729
|
+
function getUint8ArrayMemory0() {
|
|
730
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
731
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
305
732
|
}
|
|
306
|
-
|
|
733
|
+
return cachedUint8ArrayMemory0;
|
|
734
|
+
}
|
|
307
735
|
|
|
308
|
-
|
|
309
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
310
|
-
*
|
|
311
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
312
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
313
|
-
*/
|
|
314
|
-
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
736
|
+
function handleError(f, args) {
|
|
315
737
|
try {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
const
|
|
319
|
-
wasm.
|
|
320
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
321
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
322
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
323
|
-
if (r2) {
|
|
324
|
-
throw takeObject(r1);
|
|
325
|
-
}
|
|
326
|
-
return takeObject(r0);
|
|
327
|
-
} finally {
|
|
328
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
738
|
+
return f.apply(this, args);
|
|
739
|
+
} catch (e) {
|
|
740
|
+
const idx = addToExternrefTable0(e);
|
|
741
|
+
wasm.__wbindgen_exn_store(idx);
|
|
329
742
|
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
334
|
-
*
|
|
335
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
336
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
337
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
338
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
339
|
-
*/
|
|
340
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
341
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
342
|
-
const len0 = WASM_VECTOR_LEN;
|
|
343
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
344
|
-
return takeObject(ret);
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
349
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
350
|
-
*
|
|
351
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
352
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
353
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
354
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
355
|
-
*/
|
|
356
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
357
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
358
|
-
const len0 = WASM_VECTOR_LEN;
|
|
359
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
360
|
-
return takeObject(ret);
|
|
361
|
-
};
|
|
743
|
+
}
|
|
362
744
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
367
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
368
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
369
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
370
|
-
*/
|
|
371
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
372
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
373
|
-
const len0 = WASM_VECTOR_LEN;
|
|
374
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
375
|
-
return takeObject(ret);
|
|
376
|
-
};
|
|
745
|
+
function isLikeNone(x) {
|
|
746
|
+
return x === undefined || x === null;
|
|
747
|
+
}
|
|
377
748
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
* @param {string} rhs
|
|
382
|
-
* @returns {string}
|
|
383
|
-
*/
|
|
384
|
-
module.exports.and = function(lhs, rhs) {
|
|
385
|
-
const ret = wasm.and(addHeapObject(lhs), addHeapObject(rhs));
|
|
386
|
-
return takeObject(ret);
|
|
387
|
-
};
|
|
749
|
+
function makeMutClosure(arg0, arg1, dtor, f) {
|
|
750
|
+
const state = { a: arg0, b: arg1, cnt: 1, dtor };
|
|
751
|
+
const real = (...args) => {
|
|
388
752
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
753
|
+
// First up with a closure we increment the internal reference
|
|
754
|
+
// count. This ensures that the Rust closure environment won't
|
|
755
|
+
// be deallocated while we're invoking it.
|
|
756
|
+
state.cnt++;
|
|
757
|
+
const a = state.a;
|
|
758
|
+
state.a = 0;
|
|
759
|
+
try {
|
|
760
|
+
return f(a, state.b, ...args);
|
|
761
|
+
} finally {
|
|
762
|
+
state.a = a;
|
|
763
|
+
real._wbg_cb_unref();
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
real._wbg_cb_unref = () => {
|
|
767
|
+
if (--state.cnt === 0) {
|
|
768
|
+
state.dtor(state.a, state.b);
|
|
769
|
+
state.a = 0;
|
|
770
|
+
CLOSURE_DTORS.unregister(state);
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
774
|
+
return real;
|
|
407
775
|
}
|
|
408
776
|
|
|
409
777
|
function passArray32ToWasm0(arg, malloc) {
|
|
410
|
-
const ptr = malloc(arg.length * 4) >>> 0;
|
|
411
|
-
|
|
778
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
779
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
412
780
|
WASM_VECTOR_LEN = arg.length;
|
|
413
781
|
return ptr;
|
|
414
782
|
}
|
|
415
783
|
|
|
416
|
-
function
|
|
417
|
-
ptr =
|
|
418
|
-
|
|
784
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
785
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
786
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
787
|
+
WASM_VECTOR_LEN = arg.length;
|
|
788
|
+
return ptr;
|
|
419
789
|
}
|
|
420
|
-
/**
|
|
421
|
-
* Sha256 compression function
|
|
422
|
-
* @param {Uint32Array} inputs
|
|
423
|
-
* @param {Uint32Array} state
|
|
424
|
-
* @returns {Uint32Array}
|
|
425
|
-
*/
|
|
426
|
-
module.exports.sha256_compression = function(inputs, state) {
|
|
427
|
-
try {
|
|
428
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
429
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
430
|
-
const len0 = WASM_VECTOR_LEN;
|
|
431
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
432
|
-
const len1 = WASM_VECTOR_LEN;
|
|
433
|
-
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
|
|
434
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
435
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
436
|
-
var v3 = getArrayU32FromWasm0(r0, r1).slice();
|
|
437
|
-
wasm.__wbindgen_free(r0, r1 * 4);
|
|
438
|
-
return v3;
|
|
439
|
-
} finally {
|
|
440
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
441
|
-
}
|
|
442
|
-
};
|
|
443
790
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
452
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
453
|
-
const len0 = WASM_VECTOR_LEN;
|
|
454
|
-
wasm.blake2s256(retptr, ptr0, len0);
|
|
455
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
456
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
457
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
458
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
459
|
-
return v2;
|
|
460
|
-
} finally {
|
|
461
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
791
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
792
|
+
if (realloc === undefined) {
|
|
793
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
794
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
795
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
796
|
+
WASM_VECTOR_LEN = buf.length;
|
|
797
|
+
return ptr;
|
|
462
798
|
}
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
467
|
-
* @param {Uint8Array} hashed_msg
|
|
468
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
469
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
470
|
-
* @param {Uint8Array} signature
|
|
471
|
-
* @returns {boolean}
|
|
472
|
-
*/
|
|
473
|
-
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
474
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
475
|
-
const len0 = WASM_VECTOR_LEN;
|
|
476
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
477
|
-
const len1 = WASM_VECTOR_LEN;
|
|
478
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
479
|
-
const len2 = WASM_VECTOR_LEN;
|
|
480
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
481
|
-
const len3 = WASM_VECTOR_LEN;
|
|
482
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
483
|
-
return ret !== 0;
|
|
484
|
-
};
|
|
485
799
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
* @param {Uint8Array} hashed_msg
|
|
489
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
490
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
491
|
-
* @param {Uint8Array} signature
|
|
492
|
-
* @returns {boolean}
|
|
493
|
-
*/
|
|
494
|
-
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
495
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
496
|
-
const len0 = WASM_VECTOR_LEN;
|
|
497
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
498
|
-
const len1 = WASM_VECTOR_LEN;
|
|
499
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
500
|
-
const len2 = WASM_VECTOR_LEN;
|
|
501
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
502
|
-
const len3 = WASM_VECTOR_LEN;
|
|
503
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
504
|
-
return ret !== 0;
|
|
505
|
-
};
|
|
800
|
+
let len = arg.length;
|
|
801
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
506
802
|
|
|
507
|
-
|
|
508
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
509
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
510
|
-
*/
|
|
511
|
-
module.exports.buildInfo = function() {
|
|
512
|
-
const ret = wasm.buildInfo();
|
|
513
|
-
return takeObject(ret);
|
|
514
|
-
};
|
|
803
|
+
const mem = getUint8ArrayMemory0();
|
|
515
804
|
|
|
516
|
-
|
|
517
|
-
* Sets the package's logging level.
|
|
518
|
-
*
|
|
519
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
520
|
-
*/
|
|
521
|
-
module.exports.initLogLevel = function(filter) {
|
|
522
|
-
try {
|
|
523
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
524
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
525
|
-
const len0 = WASM_VECTOR_LEN;
|
|
526
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
527
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
528
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
529
|
-
if (r1) {
|
|
530
|
-
throw takeObject(r0);
|
|
531
|
-
}
|
|
532
|
-
} finally {
|
|
533
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
534
|
-
}
|
|
535
|
-
};
|
|
805
|
+
let offset = 0;
|
|
536
806
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
542
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
543
|
-
* @param {Uint8Array} program
|
|
544
|
-
* @param {WitnessMap} witness_map
|
|
545
|
-
* @returns {WitnessMap}
|
|
546
|
-
*/
|
|
547
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
548
|
-
try {
|
|
549
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
550
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
551
|
-
const len0 = WASM_VECTOR_LEN;
|
|
552
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
553
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
554
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
555
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
556
|
-
if (r2) {
|
|
557
|
-
throw takeObject(r1);
|
|
558
|
-
}
|
|
559
|
-
return takeObject(r0);
|
|
560
|
-
} finally {
|
|
561
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
807
|
+
for (; offset < len; offset++) {
|
|
808
|
+
const code = arg.charCodeAt(offset);
|
|
809
|
+
if (code > 0x7F) break;
|
|
810
|
+
mem[ptr + offset] = code;
|
|
562
811
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
567
|
-
*
|
|
568
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
569
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
570
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
571
|
-
* @param {Uint8Array} program
|
|
572
|
-
* @param {WitnessMap} solved_witness
|
|
573
|
-
* @returns {WitnessMap}
|
|
574
|
-
*/
|
|
575
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
576
|
-
try {
|
|
577
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
578
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
579
|
-
const len0 = WASM_VECTOR_LEN;
|
|
580
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
581
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
582
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
583
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
584
|
-
if (r2) {
|
|
585
|
-
throw takeObject(r1);
|
|
812
|
+
if (offset !== len) {
|
|
813
|
+
if (offset !== 0) {
|
|
814
|
+
arg = arg.slice(offset);
|
|
586
815
|
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
}
|
|
591
|
-
};
|
|
816
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
817
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
818
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
592
819
|
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
*
|
|
596
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
597
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
598
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
599
|
-
* @param {Uint8Array} program
|
|
600
|
-
* @param {WitnessMap} solved_witness
|
|
601
|
-
* @returns {WitnessMap}
|
|
602
|
-
*/
|
|
603
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
604
|
-
try {
|
|
605
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
606
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
607
|
-
const len0 = WASM_VECTOR_LEN;
|
|
608
|
-
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
609
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
610
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
611
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
612
|
-
if (r2) {
|
|
613
|
-
throw takeObject(r1);
|
|
614
|
-
}
|
|
615
|
-
return takeObject(r0);
|
|
616
|
-
} finally {
|
|
617
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
820
|
+
offset += ret.written;
|
|
821
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
618
822
|
}
|
|
619
|
-
};
|
|
620
823
|
|
|
621
|
-
|
|
622
|
-
|
|
824
|
+
WASM_VECTOR_LEN = offset;
|
|
825
|
+
return ptr;
|
|
623
826
|
}
|
|
624
827
|
|
|
625
|
-
function
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
|
|
633
|
-
wasm.wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
828
|
+
function takeFromExternrefTable0(idx) {
|
|
829
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
830
|
+
wasm.__externref_table_dealloc(idx);
|
|
831
|
+
return value;
|
|
634
832
|
}
|
|
635
833
|
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
const obj = takeObject(arg0).original;
|
|
642
|
-
if (obj.cnt-- == 1) {
|
|
643
|
-
obj.a = 0;
|
|
644
|
-
return true;
|
|
645
|
-
}
|
|
646
|
-
const ret = false;
|
|
647
|
-
return ret;
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
module.exports.__wbindgen_is_array = function(arg0) {
|
|
651
|
-
const ret = Array.isArray(getObject(arg0));
|
|
652
|
-
return ret;
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
656
|
-
const obj = getObject(arg1);
|
|
657
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
658
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
659
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
660
|
-
};
|
|
661
|
-
|
|
662
|
-
module.exports.__wbg_new_f4a2f4980eb0a66e = function() {
|
|
663
|
-
const ret = new Array();
|
|
664
|
-
return addHeapObject(ret);
|
|
665
|
-
};
|
|
666
|
-
|
|
667
|
-
module.exports.__wbindgen_number_new = function(arg0) {
|
|
668
|
-
const ret = arg0;
|
|
669
|
-
return addHeapObject(ret);
|
|
670
|
-
};
|
|
671
|
-
|
|
672
|
-
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
673
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
674
|
-
return addHeapObject(ret);
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
module.exports.__wbg_constructor_bb18ee055059e54b = function(arg0) {
|
|
678
|
-
const ret = new Error(takeObject(arg0));
|
|
679
|
-
return addHeapObject(ret);
|
|
680
|
-
};
|
|
681
|
-
|
|
682
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
683
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
684
|
-
return ret;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
|
-
module.exports.__wbg_new_e0a89522928fc0a3 = function() {
|
|
688
|
-
const ret = new Map();
|
|
689
|
-
return addHeapObject(ret);
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
693
|
-
const obj = getObject(arg1);
|
|
694
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
695
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
696
|
-
var len1 = WASM_VECTOR_LEN;
|
|
697
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
698
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
702
|
-
const ret = new Error();
|
|
703
|
-
return addHeapObject(ret);
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
module.exports.__wbg_stack_658279fe44541cf6 = function(arg0, arg1) {
|
|
707
|
-
const ret = getObject(arg1).stack;
|
|
708
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
709
|
-
const len1 = WASM_VECTOR_LEN;
|
|
710
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
711
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
712
|
-
};
|
|
713
|
-
|
|
714
|
-
module.exports.__wbg_error_f851667af71bcfc6 = function(arg0, arg1) {
|
|
715
|
-
let deferred0_0;
|
|
716
|
-
let deferred0_1;
|
|
717
|
-
try {
|
|
718
|
-
deferred0_0 = arg0;
|
|
719
|
-
deferred0_1 = arg1;
|
|
720
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
721
|
-
} finally {
|
|
722
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1);
|
|
723
|
-
}
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
module.exports.__wbg_debug_e3f6a1578e6d45ca = function(arg0) {
|
|
727
|
-
console.debug(getObject(arg0));
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
module.exports.__wbg_debug_efabe4eb183aa5d4 = function(arg0, arg1, arg2, arg3) {
|
|
731
|
-
console.debug(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
module.exports.__wbg_error_a7e23606158b68b9 = function(arg0) {
|
|
735
|
-
console.error(getObject(arg0));
|
|
736
|
-
};
|
|
737
|
-
|
|
738
|
-
module.exports.__wbg_error_50f42b952a595a23 = function(arg0, arg1, arg2, arg3) {
|
|
739
|
-
console.error(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
740
|
-
};
|
|
741
|
-
|
|
742
|
-
module.exports.__wbg_info_05db236d79f1b785 = function(arg0) {
|
|
743
|
-
console.info(getObject(arg0));
|
|
744
|
-
};
|
|
745
|
-
|
|
746
|
-
module.exports.__wbg_info_24d8f53d98f12b95 = function(arg0, arg1, arg2, arg3) {
|
|
747
|
-
console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
748
|
-
};
|
|
749
|
-
|
|
750
|
-
module.exports.__wbg_warn_9bdd743e9f5fe1e0 = function(arg0) {
|
|
751
|
-
console.warn(getObject(arg0));
|
|
752
|
-
};
|
|
753
|
-
|
|
754
|
-
module.exports.__wbg_warn_8342bfbc6028193a = function(arg0, arg1, arg2, arg3) {
|
|
755
|
-
console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
module.exports.__wbg_get_7303ed2ef026b2f5 = function(arg0, arg1) {
|
|
759
|
-
const ret = getObject(arg0)[arg1 >>> 0];
|
|
760
|
-
return addHeapObject(ret);
|
|
761
|
-
};
|
|
762
|
-
|
|
763
|
-
module.exports.__wbg_length_820c786973abdd8a = function(arg0) {
|
|
764
|
-
const ret = getObject(arg0).length;
|
|
765
|
-
return ret;
|
|
766
|
-
};
|
|
767
|
-
|
|
768
|
-
module.exports.__wbg_new_0394642eae39db16 = function() {
|
|
769
|
-
const ret = new Array();
|
|
770
|
-
return addHeapObject(ret);
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
module.exports.__wbg_new_0f2b71ca2f2a6029 = function() {
|
|
774
|
-
const ret = new Map();
|
|
775
|
-
return addHeapObject(ret);
|
|
776
|
-
};
|
|
777
|
-
|
|
778
|
-
module.exports.__wbg_from_6bc98a09a0b58bb1 = function(arg0) {
|
|
779
|
-
const ret = Array.from(getObject(arg0));
|
|
780
|
-
return addHeapObject(ret);
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
module.exports.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) {
|
|
784
|
-
try {
|
|
785
|
-
var state0 = {a: arg1, b: arg2};
|
|
786
|
-
var cb0 = (arg0, arg1, arg2) => {
|
|
787
|
-
const a = state0.a;
|
|
788
|
-
state0.a = 0;
|
|
789
|
-
try {
|
|
790
|
-
return __wbg_adapter_75(a, state0.b, arg0, arg1, arg2);
|
|
791
|
-
} finally {
|
|
792
|
-
state0.a = a;
|
|
793
|
-
}
|
|
794
|
-
};
|
|
795
|
-
getObject(arg0).forEach(cb0);
|
|
796
|
-
} finally {
|
|
797
|
-
state0.a = state0.b = 0;
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
|
|
801
|
-
module.exports.__wbg_push_109cfc26d02582dd = function(arg0, arg1) {
|
|
802
|
-
const ret = getObject(arg0).push(getObject(arg1));
|
|
803
|
-
return ret;
|
|
804
|
-
};
|
|
805
|
-
|
|
806
|
-
module.exports.__wbg_reverse_a322332d916e2705 = function(arg0) {
|
|
807
|
-
const ret = getObject(arg0).reverse();
|
|
808
|
-
return addHeapObject(ret);
|
|
809
|
-
};
|
|
810
|
-
|
|
811
|
-
module.exports.__wbg_new_87297f22973157c8 = function(arg0, arg1) {
|
|
812
|
-
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
813
|
-
return addHeapObject(ret);
|
|
814
|
-
};
|
|
815
|
-
|
|
816
|
-
module.exports.__wbg_setcause_394738aae0ce9341 = function(arg0, arg1) {
|
|
817
|
-
getObject(arg0).cause = getObject(arg1);
|
|
818
|
-
};
|
|
819
|
-
|
|
820
|
-
module.exports.__wbg_call_587b30eea3e09332 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
821
|
-
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
822
|
-
return addHeapObject(ret);
|
|
823
|
-
}, arguments) };
|
|
824
|
-
|
|
825
|
-
module.exports.__wbg_call_4c73e4aecced6a7d = function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
826
|
-
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
|
827
|
-
return addHeapObject(ret);
|
|
828
|
-
}, arguments) };
|
|
829
|
-
|
|
830
|
-
module.exports.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
|
|
831
|
-
try {
|
|
832
|
-
var state0 = {a: arg1, b: arg2};
|
|
833
|
-
var cb0 = (arg0, arg1) => {
|
|
834
|
-
const a = state0.a;
|
|
835
|
-
state0.a = 0;
|
|
836
|
-
try {
|
|
837
|
-
return __wbg_adapter_92(a, state0.b, arg0, arg1);
|
|
838
|
-
} finally {
|
|
839
|
-
state0.a = a;
|
|
840
|
-
}
|
|
841
|
-
};
|
|
842
|
-
getObject(arg0).forEach(cb0);
|
|
843
|
-
} finally {
|
|
844
|
-
state0.a = state0.b = 0;
|
|
845
|
-
}
|
|
846
|
-
};
|
|
847
|
-
|
|
848
|
-
module.exports.__wbg_set_da7be7bf0e037b14 = function(arg0, arg1, arg2) {
|
|
849
|
-
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
850
|
-
return addHeapObject(ret);
|
|
851
|
-
};
|
|
852
|
-
|
|
853
|
-
module.exports.__wbg_fromEntries_d1b310956d20d858 = function() { return handleError(function (arg0) {
|
|
854
|
-
const ret = Object.fromEntries(getObject(arg0));
|
|
855
|
-
return addHeapObject(ret);
|
|
856
|
-
}, arguments) };
|
|
834
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
835
|
+
cachedTextDecoder.decode();
|
|
836
|
+
function decodeText(ptr, len) {
|
|
837
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
838
|
+
}
|
|
857
839
|
|
|
858
|
-
|
|
859
|
-
const ret = Object.values(getObject(arg0));
|
|
860
|
-
return addHeapObject(ret);
|
|
861
|
-
};
|
|
840
|
+
const cachedTextEncoder = new TextEncoder();
|
|
862
841
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
return __wbg_adapter_92(a, state0.b, arg0, arg1);
|
|
871
|
-
} finally {
|
|
872
|
-
state0.a = a;
|
|
873
|
-
}
|
|
842
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
843
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
844
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
845
|
+
view.set(buf);
|
|
846
|
+
return {
|
|
847
|
+
read: arg.length,
|
|
848
|
+
written: buf.length
|
|
874
849
|
};
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
} finally {
|
|
878
|
-
state0.a = state0.b = 0;
|
|
879
|
-
}
|
|
880
|
-
};
|
|
881
|
-
|
|
882
|
-
module.exports.__wbg_resolve_ae38ad63c43ff98b = function(arg0) {
|
|
883
|
-
const ret = Promise.resolve(getObject(arg0));
|
|
884
|
-
return addHeapObject(ret);
|
|
885
|
-
};
|
|
886
|
-
|
|
887
|
-
module.exports.__wbg_then_8df675b8bb5d5e3c = function(arg0, arg1) {
|
|
888
|
-
const ret = getObject(arg0).then(getObject(arg1));
|
|
889
|
-
return addHeapObject(ret);
|
|
890
|
-
};
|
|
891
|
-
|
|
892
|
-
module.exports.__wbg_then_835b073a479138e5 = function(arg0, arg1, arg2) {
|
|
893
|
-
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
894
|
-
return addHeapObject(ret);
|
|
895
|
-
};
|
|
896
|
-
|
|
897
|
-
module.exports.__wbg_parse_76a8a18ca3f8730b = function() { return handleError(function (arg0, arg1) {
|
|
898
|
-
const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
|
|
899
|
-
return addHeapObject(ret);
|
|
900
|
-
}, arguments) };
|
|
901
|
-
|
|
902
|
-
module.exports.__wbg_set_07da13cc24b69217 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
903
|
-
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
904
|
-
return ret;
|
|
905
|
-
}, arguments) };
|
|
906
|
-
|
|
907
|
-
module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
908
|
-
const ret = debugString(getObject(arg1));
|
|
909
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
910
|
-
const len1 = WASM_VECTOR_LEN;
|
|
911
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
912
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
916
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
module.exports.__wbindgen_closure_wrapper726 = function(arg0, arg1, arg2) {
|
|
920
|
-
const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
|
|
921
|
-
return addHeapObject(ret);
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
const path = require('path').join(__dirname, 'acvm_js_bg.wasm');
|
|
925
|
-
const bytes = require('fs').readFileSync(path);
|
|
850
|
+
};
|
|
851
|
+
}
|
|
926
852
|
|
|
927
|
-
|
|
928
|
-
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
929
|
-
wasm = wasmInstance.exports;
|
|
930
|
-
module.exports.__wasm = wasm;
|
|
853
|
+
let WASM_VECTOR_LEN = 0;
|
|
931
854
|
|
|
855
|
+
const wasmPath = `${__dirname}/acvm_js_bg.wasm`;
|
|
856
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
857
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
858
|
+
let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
859
|
+
wasm.__wbindgen_start();
|