@noir-lang/acvm_js 1.0.0-beta.17-32f513f.nightly → 1.0.0-beta.18-c9a8bf8.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.
@@ -1,69 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Returns the `BuildInfo` object containing information about how the installed package was built.
5
- * @returns {BuildInfo} - Information on how the installed package was built.
6
- */
7
- export function buildInfo(): BuildInfo;
8
- /**
9
- * Performs a bitwise AND operation between `lhs` and `rhs`
10
- */
11
- export function and(lhs: string, rhs: string): string;
12
- /**
13
- * Performs a bitwise XOR operation between `lhs` and `rhs`
14
- */
15
- export function xor(lhs: string, rhs: string): string;
16
- /**
17
- * Sha256 compression function
18
- */
19
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
20
- /**
21
- * Calculates the Blake2s256 hash of the input bytes
22
- */
23
- export function blake2s256(inputs: Uint8Array): Uint8Array;
24
- /**
25
- * Verifies a ECDSA signature over the secp256k1 curve.
26
- */
27
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
28
- /**
29
- * Verifies a ECDSA signature over the secp256r1 curve.
30
- */
31
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
32
3
  /**
33
4
  * Sets the package's logging level.
34
5
  *
35
6
  * @param {LogLevel} level - The maximum level of logging to be emitted.
36
7
  */
37
8
  export function initLogLevel(filter: string): void;
38
- /**
39
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
40
- *
41
- * @param {WitnessMap} witness_map - A witness map.
42
- * @returns {Uint8Array} A compressed witness map
43
- */
44
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
45
- /**
46
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
47
- * This should be used to only fetch the witness map for the main function.
48
- *
49
- * @param {Uint8Array} compressed_witness - A compressed witness.
50
- * @returns {WitnessMap} The decompressed witness map.
51
- */
52
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
53
- /**
54
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
55
- *
56
- * @param {WitnessStack} witness_stack - A witness stack.
57
- * @returns {Uint8Array} A compressed witness stack
58
- */
59
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
60
- /**
61
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
62
- *
63
- * @param {Uint8Array} compressed_witness - A compressed witness.
64
- * @returns {WitnessStack} The decompressed witness stack.
65
- */
66
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
67
9
  /**
68
10
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
69
11
  *
@@ -116,29 +58,64 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
116
58
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
59
  */
118
60
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
-
120
61
  /**
121
- * @typedef {Object} BuildInfo - Information about how the installed package was built
122
- * @property {string} gitHash - The hash of the git commit from which the package was built.
123
- * @property {string} version - The version of the package at the built git commit.
124
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
62
+ * Performs a bitwise AND operation between `lhs` and `rhs`
125
63
  */
126
- export type BuildInfo = {
127
- gitHash: string;
128
- version: string;
129
- dirty: string;
130
- }
131
-
132
-
133
-
134
- export type StackItem = {
135
- index: number;
136
- witness: WitnessMap;
137
- }
138
-
139
- export type WitnessStack = Array<StackItem>;
140
-
141
-
64
+ export function and(lhs: string, rhs: string): string;
65
+ /**
66
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
67
+ */
68
+ export function xor(lhs: string, rhs: string): string;
69
+ /**
70
+ * Sha256 compression function
71
+ */
72
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
73
+ /**
74
+ * Calculates the Blake2s256 hash of the input bytes
75
+ */
76
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
77
+ /**
78
+ * Verifies a ECDSA signature over the secp256k1 curve.
79
+ */
80
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
81
+ /**
82
+ * Verifies a ECDSA signature over the secp256r1 curve.
83
+ */
84
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
85
+ /**
86
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
87
+ *
88
+ * @param {WitnessMap} witness_map - A witness map.
89
+ * @returns {Uint8Array} A compressed witness map
90
+ */
91
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
92
+ /**
93
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
94
+ * This should be used to only fetch the witness map for the main function.
95
+ *
96
+ * @param {Uint8Array} compressed_witness - A compressed witness.
97
+ * @returns {WitnessMap} The decompressed witness map.
98
+ */
99
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
100
+ /**
101
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
102
+ *
103
+ * @param {WitnessStack} witness_stack - A witness stack.
104
+ * @returns {Uint8Array} A compressed witness stack
105
+ */
106
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
107
+ /**
108
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
109
+ *
110
+ * @param {Uint8Array} compressed_witness - A compressed witness.
111
+ * @returns {WitnessStack} The decompressed witness stack.
112
+ */
113
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
114
+ /**
115
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
116
+ * @returns {BuildInfo} - Information on how the installed package was built.
117
+ */
118
+ export function buildInfo(): BuildInfo;
142
119
 
143
120
  export type RawAssertionPayload = {
144
121
  selector: string;
@@ -182,3 +159,26 @@ export type SolvedAndReturnWitness = {
182
159
  }
183
160
 
184
161
 
162
+
163
+ export type StackItem = {
164
+ index: number;
165
+ witness: WitnessMap;
166
+ }
167
+
168
+ export type WitnessStack = Array<StackItem>;
169
+
170
+
171
+
172
+ /**
173
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
174
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
175
+ * @property {string} version - The version of the package at the built git commit.
176
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
+ */
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
182
+ }
183
+
184
+
package/nodejs/acvm_js.js CHANGED
@@ -201,15 +201,138 @@ function debugString(val) {
201
201
  // TODO we could test for more things here, like `Set`s and `Map`s.
202
202
  return className;
203
203
  }
204
+
205
+ function takeFromExternrefTable0(idx) {
206
+ const value = wasm.__wbindgen_export_2.get(idx);
207
+ wasm.__externref_table_dealloc(idx);
208
+ return value;
209
+ }
204
210
  /**
205
- * Returns the `BuildInfo` object containing information about how the installed package was built.
206
- * @returns {BuildInfo} - Information on how the installed package was built.
211
+ * Sets the package's logging level.
212
+ *
213
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
207
214
  */
208
- module.exports.buildInfo = function() {
209
- const ret = wasm.buildInfo();
215
+ module.exports.initLogLevel = function(filter) {
216
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
217
+ const len0 = WASM_VECTOR_LEN;
218
+ const ret = wasm.initLogLevel(ptr0, len0);
219
+ if (ret[1]) {
220
+ throw takeFromExternrefTable0(ret[0]);
221
+ }
222
+ };
223
+
224
+ function passArray8ToWasm0(arg, malloc) {
225
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
226
+ getUint8ArrayMemory0().set(arg, ptr / 1);
227
+ WASM_VECTOR_LEN = arg.length;
228
+ return ptr;
229
+ }
230
+ /**
231
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
232
+ *
233
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
234
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
235
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
236
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
237
+ */
238
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
239
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
240
+ const len0 = WASM_VECTOR_LEN;
241
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
210
242
  return ret;
211
243
  };
212
244
 
245
+ /**
246
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
247
+ * This method also extracts the public return values from the solved witness into its own return witness.
248
+ *
249
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
250
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
251
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
252
+ * @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.
253
+ */
254
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
255
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
256
+ const len0 = WASM_VECTOR_LEN;
257
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
258
+ return ret;
259
+ };
260
+
261
+ /**
262
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
263
+ *
264
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
265
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
266
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
267
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
268
+ */
269
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
270
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
271
+ const len0 = WASM_VECTOR_LEN;
272
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
273
+ return ret;
274
+ };
275
+
276
+ /**
277
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
278
+ *
279
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
280
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
281
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
282
+ * @param {Uint8Array} program
283
+ * @param {WitnessMap} witness_map
284
+ * @returns {WitnessMap}
285
+ */
286
+ module.exports.getReturnWitness = function(program, witness_map) {
287
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
288
+ const len0 = WASM_VECTOR_LEN;
289
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
290
+ if (ret[2]) {
291
+ throw takeFromExternrefTable0(ret[1]);
292
+ }
293
+ return takeFromExternrefTable0(ret[0]);
294
+ };
295
+
296
+ /**
297
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
298
+ *
299
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
300
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
301
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
302
+ * @param {Uint8Array} program
303
+ * @param {WitnessMap} solved_witness
304
+ * @returns {WitnessMap}
305
+ */
306
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
307
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
308
+ const len0 = WASM_VECTOR_LEN;
309
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
310
+ if (ret[2]) {
311
+ throw takeFromExternrefTable0(ret[1]);
312
+ }
313
+ return takeFromExternrefTable0(ret[0]);
314
+ };
315
+
316
+ /**
317
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
318
+ *
319
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
320
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
321
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
322
+ * @param {Uint8Array} program
323
+ * @param {WitnessMap} solved_witness
324
+ * @returns {WitnessMap}
325
+ */
326
+ module.exports.getPublicWitness = function(program, solved_witness) {
327
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
328
+ const len0 = WASM_VECTOR_LEN;
329
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
330
+ if (ret[2]) {
331
+ throw takeFromExternrefTable0(ret[1]);
332
+ }
333
+ return takeFromExternrefTable0(ret[0]);
334
+ };
335
+
213
336
  /**
214
337
  * Performs a bitwise AND operation between `lhs` and `rhs`
215
338
  * @param {string} lhs
@@ -269,13 +392,6 @@ module.exports.sha256_compression = function(inputs, state) {
269
392
  return v3;
270
393
  };
271
394
 
272
- function passArray8ToWasm0(arg, malloc) {
273
- const ptr = malloc(arg.length * 1, 1) >>> 0;
274
- getUint8ArrayMemory0().set(arg, ptr / 1);
275
- WASM_VECTOR_LEN = arg.length;
276
- return ptr;
277
- }
278
-
279
395
  function getArrayU8FromWasm0(ptr, len) {
280
396
  ptr = ptr >>> 0;
281
397
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -336,25 +452,6 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
336
452
  return ret !== 0;
337
453
  };
338
454
 
339
- function takeFromExternrefTable0(idx) {
340
- const value = wasm.__wbindgen_export_2.get(idx);
341
- wasm.__externref_table_dealloc(idx);
342
- return value;
343
- }
344
- /**
345
- * Sets the package's logging level.
346
- *
347
- * @param {LogLevel} level - The maximum level of logging to be emitted.
348
- */
349
- module.exports.initLogLevel = function(filter) {
350
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
351
- const len0 = WASM_VECTOR_LEN;
352
- const ret = wasm.initLogLevel(ptr0, len0);
353
- if (ret[1]) {
354
- throw takeFromExternrefTable0(ret[0]);
355
- }
356
- };
357
-
358
455
  /**
359
456
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
360
457
  *
@@ -421,121 +518,24 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
421
518
  };
422
519
 
423
520
  /**
424
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
425
- *
426
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
427
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
428
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
429
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
430
- */
431
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
432
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
433
- const len0 = WASM_VECTOR_LEN;
434
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
435
- return ret;
436
- };
437
-
438
- /**
439
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
440
- * This method also extracts the public return values from the solved witness into its own return witness.
441
- *
442
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
443
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
444
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
445
- * @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.
446
- */
447
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
448
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
449
- const len0 = WASM_VECTOR_LEN;
450
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
451
- return ret;
452
- };
453
-
454
- /**
455
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
456
- *
457
- * @param {Uint8Array} program - A serialized representation of an ACIR program
458
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
459
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
460
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
521
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
522
+ * @returns {BuildInfo} - Information on how the installed package was built.
461
523
  */
462
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
463
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
464
- const len0 = WASM_VECTOR_LEN;
465
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
524
+ module.exports.buildInfo = function() {
525
+ const ret = wasm.buildInfo();
466
526
  return ret;
467
527
  };
468
528
 
469
- /**
470
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
471
- *
472
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
473
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
474
- * @returns {WitnessMap} A witness map containing the circuit's return values.
475
- * @param {Uint8Array} program
476
- * @param {WitnessMap} witness_map
477
- * @returns {WitnessMap}
478
- */
479
- module.exports.getReturnWitness = function(program, witness_map) {
480
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
481
- const len0 = WASM_VECTOR_LEN;
482
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
483
- if (ret[2]) {
484
- throw takeFromExternrefTable0(ret[1]);
485
- }
486
- return takeFromExternrefTable0(ret[0]);
487
- };
488
-
489
- /**
490
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
491
- *
492
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
493
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
494
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
495
- * @param {Uint8Array} program
496
- * @param {WitnessMap} solved_witness
497
- * @returns {WitnessMap}
498
- */
499
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
500
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
501
- const len0 = WASM_VECTOR_LEN;
502
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
503
- if (ret[2]) {
504
- throw takeFromExternrefTable0(ret[1]);
505
- }
506
- return takeFromExternrefTable0(ret[0]);
507
- };
508
-
509
- /**
510
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
511
- *
512
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
513
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
514
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
515
- * @param {Uint8Array} program
516
- * @param {WitnessMap} solved_witness
517
- * @returns {WitnessMap}
518
- */
519
- module.exports.getPublicWitness = function(program, solved_witness) {
520
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
521
- const len0 = WASM_VECTOR_LEN;
522
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
523
- if (ret[2]) {
524
- throw takeFromExternrefTable0(ret[1]);
525
- }
526
- return takeFromExternrefTable0(ret[0]);
527
- };
528
-
529
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure482_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure490_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure988_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure992_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
539
539
  }
540
540
 
541
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -553,12 +553,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
553
553
  return ret;
554
554
  }, arguments) };
555
555
 
556
- module.exports.__wbg_constructor_396cb42ec8c8dca1 = function(arg0) {
556
+ module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
557
557
  const ret = new Error(arg0);
558
558
  return ret;
559
559
  };
560
560
 
561
- module.exports.__wbg_constructor_ea6e3e30ca9aa30c = function(arg0) {
561
+ module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
562
562
  const ret = new Error(arg0);
563
563
  return ret;
564
564
  };
@@ -655,11 +655,6 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function(arg0) {
655
655
  return ret;
656
656
  };
657
657
 
658
- module.exports.__wbg_new_15469fe041a20dc6 = function() {
659
- const ret = new Array();
660
- return ret;
661
- };
662
-
663
658
  module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
664
659
  try {
665
660
  var state0 = {a: arg0, b: arg1};
@@ -679,11 +674,6 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
679
674
  }
680
675
  };
681
676
 
682
- module.exports.__wbg_new_494426b3386f8e2c = function() {
683
- const ret = new Map();
684
- return ret;
685
- };
686
-
687
677
  module.exports.__wbg_new_5e0be73521bc8c17 = function() {
688
678
  const ret = new Map();
689
679
  return ret;
@@ -699,11 +689,21 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
699
689
  return ret;
700
690
  };
701
691
 
692
+ module.exports.__wbg_new_9f501325818b4158 = function() {
693
+ const ret = new Array();
694
+ return ret;
695
+ };
696
+
702
697
  module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
703
698
  const ret = new Error(getStringFromWasm0(arg0, arg1));
704
699
  return ret;
705
700
  };
706
701
 
702
+ module.exports.__wbg_new_ec40611a7805f1f0 = function() {
703
+ const ret = new Map();
704
+ return ret;
705
+ };
706
+
707
707
  module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
708
708
  const ret = new Function(getStringFromWasm0(arg0, arg1));
709
709
  return ret;
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
813
  return ret;
814
814
  };
815
815
 
816
- module.exports.__wbindgen_closure_wrapper1584 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 483, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const buildInfo: () => any;
4
+ export const initLogLevel: (a: number, b: number) => [number, number];
5
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
6
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
7
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
8
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
5
11
  export const and: (a: any, b: any) => any;
6
12
  export const xor: (a: any, b: any) => any;
7
13
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
8
14
  export const blake2s256: (a: number, b: number) => [number, number];
9
15
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
16
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
11
- export const initLogLevel: (a: number, b: number) => [number, number];
12
17
  export const compressWitness: (a: any) => [number, number, number, number];
13
18
  export const decompressWitness: (a: number, b: number) => [number, number, number];
14
19
  export const compressWitnessStack: (a: any) => [number, number, number, number];
15
20
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
16
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
17
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
18
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
19
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
21
+ export const buildInfo: () => any;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure482_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure988_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure992_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure490_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "1.0.0-beta.17-32f513f.nightly",
3
+ "version": "1.0.0-beta.18-c9a8bf8.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,69 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Returns the `BuildInfo` object containing information about how the installed package was built.
5
- * @returns {BuildInfo} - Information on how the installed package was built.
6
- */
7
- export function buildInfo(): BuildInfo;
8
- /**
9
- * Performs a bitwise AND operation between `lhs` and `rhs`
10
- */
11
- export function and(lhs: string, rhs: string): string;
12
- /**
13
- * Performs a bitwise XOR operation between `lhs` and `rhs`
14
- */
15
- export function xor(lhs: string, rhs: string): string;
16
- /**
17
- * Sha256 compression function
18
- */
19
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
20
- /**
21
- * Calculates the Blake2s256 hash of the input bytes
22
- */
23
- export function blake2s256(inputs: Uint8Array): Uint8Array;
24
- /**
25
- * Verifies a ECDSA signature over the secp256k1 curve.
26
- */
27
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
28
- /**
29
- * Verifies a ECDSA signature over the secp256r1 curve.
30
- */
31
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
32
3
  /**
33
4
  * Sets the package's logging level.
34
5
  *
35
6
  * @param {LogLevel} level - The maximum level of logging to be emitted.
36
7
  */
37
8
  export function initLogLevel(filter: string): void;
38
- /**
39
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
40
- *
41
- * @param {WitnessMap} witness_map - A witness map.
42
- * @returns {Uint8Array} A compressed witness map
43
- */
44
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
45
- /**
46
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
47
- * This should be used to only fetch the witness map for the main function.
48
- *
49
- * @param {Uint8Array} compressed_witness - A compressed witness.
50
- * @returns {WitnessMap} The decompressed witness map.
51
- */
52
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
53
- /**
54
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
55
- *
56
- * @param {WitnessStack} witness_stack - A witness stack.
57
- * @returns {Uint8Array} A compressed witness stack
58
- */
59
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
60
- /**
61
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
62
- *
63
- * @param {Uint8Array} compressed_witness - A compressed witness.
64
- * @returns {WitnessStack} The decompressed witness stack.
65
- */
66
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
67
9
  /**
68
10
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
69
11
  *
@@ -116,29 +58,64 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
116
58
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
59
  */
118
60
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
-
120
61
  /**
121
- * @typedef {Object} BuildInfo - Information about how the installed package was built
122
- * @property {string} gitHash - The hash of the git commit from which the package was built.
123
- * @property {string} version - The version of the package at the built git commit.
124
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
62
+ * Performs a bitwise AND operation between `lhs` and `rhs`
125
63
  */
126
- export type BuildInfo = {
127
- gitHash: string;
128
- version: string;
129
- dirty: string;
130
- }
131
-
132
-
133
-
134
- export type StackItem = {
135
- index: number;
136
- witness: WitnessMap;
137
- }
138
-
139
- export type WitnessStack = Array<StackItem>;
140
-
141
-
64
+ export function and(lhs: string, rhs: string): string;
65
+ /**
66
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
67
+ */
68
+ export function xor(lhs: string, rhs: string): string;
69
+ /**
70
+ * Sha256 compression function
71
+ */
72
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
73
+ /**
74
+ * Calculates the Blake2s256 hash of the input bytes
75
+ */
76
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
77
+ /**
78
+ * Verifies a ECDSA signature over the secp256k1 curve.
79
+ */
80
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
81
+ /**
82
+ * Verifies a ECDSA signature over the secp256r1 curve.
83
+ */
84
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
85
+ /**
86
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
87
+ *
88
+ * @param {WitnessMap} witness_map - A witness map.
89
+ * @returns {Uint8Array} A compressed witness map
90
+ */
91
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
92
+ /**
93
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
94
+ * This should be used to only fetch the witness map for the main function.
95
+ *
96
+ * @param {Uint8Array} compressed_witness - A compressed witness.
97
+ * @returns {WitnessMap} The decompressed witness map.
98
+ */
99
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
100
+ /**
101
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
102
+ *
103
+ * @param {WitnessStack} witness_stack - A witness stack.
104
+ * @returns {Uint8Array} A compressed witness stack
105
+ */
106
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
107
+ /**
108
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
109
+ *
110
+ * @param {Uint8Array} compressed_witness - A compressed witness.
111
+ * @returns {WitnessStack} The decompressed witness stack.
112
+ */
113
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
114
+ /**
115
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
116
+ * @returns {BuildInfo} - Information on how the installed package was built.
117
+ */
118
+ export function buildInfo(): BuildInfo;
142
119
 
143
120
  export type RawAssertionPayload = {
144
121
  selector: string;
@@ -183,28 +160,51 @@ export type SolvedAndReturnWitness = {
183
160
 
184
161
 
185
162
 
163
+ export type StackItem = {
164
+ index: number;
165
+ witness: WitnessMap;
166
+ }
167
+
168
+ export type WitnessStack = Array<StackItem>;
169
+
170
+
171
+
172
+ /**
173
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
174
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
175
+ * @property {string} version - The version of the package at the built git commit.
176
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
+ */
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
182
+ }
183
+
184
+
185
+
186
186
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
- readonly buildInfo: () => any;
190
+ readonly initLogLevel: (a: number, b: number) => [number, number];
191
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
192
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
193
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
194
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
195
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
196
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
191
197
  readonly and: (a: any, b: any) => any;
192
198
  readonly xor: (a: any, b: any) => any;
193
199
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
194
200
  readonly blake2s256: (a: number, b: number) => [number, number];
195
201
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
196
202
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
197
- readonly initLogLevel: (a: number, b: number) => [number, number];
198
203
  readonly compressWitness: (a: any) => [number, number, number, number];
199
204
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
200
205
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
201
206
  readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
202
- readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
203
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
204
- readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
205
- readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
206
- readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
207
- readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
207
+ readonly buildInfo: () => any;
208
208
  readonly __wbindgen_exn_store: (a: number) => void;
209
209
  readonly __externref_table_alloc: () => number;
210
210
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -213,9 +213,9 @@ export interface InitOutput {
213
213
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
214
214
  readonly __wbindgen_export_6: WebAssembly.Table;
215
215
  readonly __externref_table_dealloc: (a: number) => void;
216
- readonly closure482_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure988_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure992_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure490_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -197,15 +197,138 @@ function debugString(val) {
197
197
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
198
  return className;
199
199
  }
200
+
201
+ function takeFromExternrefTable0(idx) {
202
+ const value = wasm.__wbindgen_export_2.get(idx);
203
+ wasm.__externref_table_dealloc(idx);
204
+ return value;
205
+ }
200
206
  /**
201
- * Returns the `BuildInfo` object containing information about how the installed package was built.
202
- * @returns {BuildInfo} - Information on how the installed package was built.
207
+ * Sets the package's logging level.
208
+ *
209
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
203
210
  */
204
- export function buildInfo() {
205
- const ret = wasm.buildInfo();
211
+ export function initLogLevel(filter) {
212
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
213
+ const len0 = WASM_VECTOR_LEN;
214
+ const ret = wasm.initLogLevel(ptr0, len0);
215
+ if (ret[1]) {
216
+ throw takeFromExternrefTable0(ret[0]);
217
+ }
218
+ }
219
+
220
+ function passArray8ToWasm0(arg, malloc) {
221
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
222
+ getUint8ArrayMemory0().set(arg, ptr / 1);
223
+ WASM_VECTOR_LEN = arg.length;
224
+ return ptr;
225
+ }
226
+ /**
227
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
228
+ *
229
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
230
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
231
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
232
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
233
+ */
234
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
235
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
236
+ const len0 = WASM_VECTOR_LEN;
237
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
238
+ return ret;
239
+ }
240
+
241
+ /**
242
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
243
+ * This method also extracts the public return values from the solved witness into its own return witness.
244
+ *
245
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
246
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
247
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
248
+ * @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.
249
+ */
250
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
251
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
252
+ const len0 = WASM_VECTOR_LEN;
253
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
206
254
  return ret;
207
255
  }
208
256
 
257
+ /**
258
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
259
+ *
260
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
261
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
262
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
263
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
264
+ */
265
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
266
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
267
+ const len0 = WASM_VECTOR_LEN;
268
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
269
+ return ret;
270
+ }
271
+
272
+ /**
273
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
274
+ *
275
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
276
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
277
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
278
+ * @param {Uint8Array} program
279
+ * @param {WitnessMap} witness_map
280
+ * @returns {WitnessMap}
281
+ */
282
+ export function getReturnWitness(program, witness_map) {
283
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
284
+ const len0 = WASM_VECTOR_LEN;
285
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
286
+ if (ret[2]) {
287
+ throw takeFromExternrefTable0(ret[1]);
288
+ }
289
+ return takeFromExternrefTable0(ret[0]);
290
+ }
291
+
292
+ /**
293
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
294
+ *
295
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
296
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
297
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
298
+ * @param {Uint8Array} program
299
+ * @param {WitnessMap} solved_witness
300
+ * @returns {WitnessMap}
301
+ */
302
+ export function getPublicParametersWitness(program, solved_witness) {
303
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
304
+ const len0 = WASM_VECTOR_LEN;
305
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
306
+ if (ret[2]) {
307
+ throw takeFromExternrefTable0(ret[1]);
308
+ }
309
+ return takeFromExternrefTable0(ret[0]);
310
+ }
311
+
312
+ /**
313
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
314
+ *
315
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
316
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
317
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
318
+ * @param {Uint8Array} program
319
+ * @param {WitnessMap} solved_witness
320
+ * @returns {WitnessMap}
321
+ */
322
+ export function getPublicWitness(program, solved_witness) {
323
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
324
+ const len0 = WASM_VECTOR_LEN;
325
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
326
+ if (ret[2]) {
327
+ throw takeFromExternrefTable0(ret[1]);
328
+ }
329
+ return takeFromExternrefTable0(ret[0]);
330
+ }
331
+
209
332
  /**
210
333
  * Performs a bitwise AND operation between `lhs` and `rhs`
211
334
  * @param {string} lhs
@@ -265,13 +388,6 @@ export function sha256_compression(inputs, state) {
265
388
  return v3;
266
389
  }
267
390
 
268
- function passArray8ToWasm0(arg, malloc) {
269
- const ptr = malloc(arg.length * 1, 1) >>> 0;
270
- getUint8ArrayMemory0().set(arg, ptr / 1);
271
- WASM_VECTOR_LEN = arg.length;
272
- return ptr;
273
- }
274
-
275
391
  function getArrayU8FromWasm0(ptr, len) {
276
392
  ptr = ptr >>> 0;
277
393
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
@@ -332,25 +448,6 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
332
448
  return ret !== 0;
333
449
  }
334
450
 
335
- function takeFromExternrefTable0(idx) {
336
- const value = wasm.__wbindgen_export_2.get(idx);
337
- wasm.__externref_table_dealloc(idx);
338
- return value;
339
- }
340
- /**
341
- * Sets the package's logging level.
342
- *
343
- * @param {LogLevel} level - The maximum level of logging to be emitted.
344
- */
345
- export function initLogLevel(filter) {
346
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
347
- const len0 = WASM_VECTOR_LEN;
348
- const ret = wasm.initLogLevel(ptr0, len0);
349
- if (ret[1]) {
350
- throw takeFromExternrefTable0(ret[0]);
351
- }
352
- }
353
-
354
451
  /**
355
452
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
356
453
  *
@@ -417,121 +514,24 @@ export function decompressWitnessStack(compressed_witness) {
417
514
  }
418
515
 
419
516
  /**
420
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
421
- *
422
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
423
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
424
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
425
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
426
- */
427
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
428
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
429
- const len0 = WASM_VECTOR_LEN;
430
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
431
- return ret;
432
- }
433
-
434
- /**
435
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
436
- * This method also extracts the public return values from the solved witness into its own return witness.
437
- *
438
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
439
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
440
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
441
- * @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.
442
- */
443
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
444
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
445
- const len0 = WASM_VECTOR_LEN;
446
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
447
- return ret;
448
- }
449
-
450
- /**
451
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
452
- *
453
- * @param {Uint8Array} program - A serialized representation of an ACIR program
454
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
455
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
456
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
517
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
518
+ * @returns {BuildInfo} - Information on how the installed package was built.
457
519
  */
458
- export function executeProgram(program, initial_witness, foreign_call_handler) {
459
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
460
- const len0 = WASM_VECTOR_LEN;
461
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
520
+ export function buildInfo() {
521
+ const ret = wasm.buildInfo();
462
522
  return ret;
463
523
  }
464
524
 
465
- /**
466
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
467
- *
468
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
469
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
470
- * @returns {WitnessMap} A witness map containing the circuit's return values.
471
- * @param {Uint8Array} program
472
- * @param {WitnessMap} witness_map
473
- * @returns {WitnessMap}
474
- */
475
- export function getReturnWitness(program, witness_map) {
476
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
477
- const len0 = WASM_VECTOR_LEN;
478
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
479
- if (ret[2]) {
480
- throw takeFromExternrefTable0(ret[1]);
481
- }
482
- return takeFromExternrefTable0(ret[0]);
483
- }
484
-
485
- /**
486
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
487
- *
488
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
489
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
490
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
491
- * @param {Uint8Array} program
492
- * @param {WitnessMap} solved_witness
493
- * @returns {WitnessMap}
494
- */
495
- export function getPublicParametersWitness(program, solved_witness) {
496
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
497
- const len0 = WASM_VECTOR_LEN;
498
- const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
499
- if (ret[2]) {
500
- throw takeFromExternrefTable0(ret[1]);
501
- }
502
- return takeFromExternrefTable0(ret[0]);
503
- }
504
-
505
- /**
506
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
507
- *
508
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
509
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
510
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
511
- * @param {Uint8Array} program
512
- * @param {WitnessMap} solved_witness
513
- * @returns {WitnessMap}
514
- */
515
- export function getPublicWitness(program, solved_witness) {
516
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
517
- const len0 = WASM_VECTOR_LEN;
518
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
519
- if (ret[2]) {
520
- throw takeFromExternrefTable0(ret[1]);
521
- }
522
- return takeFromExternrefTable0(ret[0]);
523
- }
524
-
525
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure482_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure490_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure988_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure992_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
535
535
  }
536
536
 
537
537
  async function __wbg_load(module, imports) {
@@ -580,11 +580,11 @@ function __wbg_get_imports() {
580
580
  const ret = arg0.call(arg1, arg2, arg3);
581
581
  return ret;
582
582
  }, arguments) };
583
- imports.wbg.__wbg_constructor_396cb42ec8c8dca1 = function(arg0) {
583
+ imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
584
584
  const ret = new Error(arg0);
585
585
  return ret;
586
586
  };
587
- imports.wbg.__wbg_constructor_ea6e3e30ca9aa30c = function(arg0) {
587
+ imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
588
588
  const ret = new Error(arg0);
589
589
  return ret;
590
590
  };
@@ -667,10 +667,6 @@ function __wbg_get_imports() {
667
667
  const ret = arg0.length;
668
668
  return ret;
669
669
  };
670
- imports.wbg.__wbg_new_15469fe041a20dc6 = function() {
671
- const ret = new Array();
672
- return ret;
673
- };
674
670
  imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
675
671
  try {
676
672
  var state0 = {a: arg0, b: arg1};
@@ -689,10 +685,6 @@ function __wbg_get_imports() {
689
685
  state0.a = state0.b = 0;
690
686
  }
691
687
  };
692
- imports.wbg.__wbg_new_494426b3386f8e2c = function() {
693
- const ret = new Map();
694
- return ret;
695
- };
696
688
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
697
689
  const ret = new Map();
698
690
  return ret;
@@ -705,10 +697,18 @@ function __wbg_get_imports() {
705
697
  const ret = new Error();
706
698
  return ret;
707
699
  };
700
+ imports.wbg.__wbg_new_9f501325818b4158 = function() {
701
+ const ret = new Array();
702
+ return ret;
703
+ };
708
704
  imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
709
705
  const ret = new Error(getStringFromWasm0(arg0, arg1));
710
706
  return ret;
711
707
  };
708
+ imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
709
+ const ret = new Map();
710
+ return ret;
711
+ };
712
712
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
713
713
  const ret = new Function(getStringFromWasm0(arg0, arg1));
714
714
  return ret;
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
797
797
  const ret = false;
798
798
  return ret;
799
799
  };
800
- imports.wbg.__wbindgen_closure_wrapper1584 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 483, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const buildInfo: () => any;
4
+ export const initLogLevel: (a: number, b: number) => [number, number];
5
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
6
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
7
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
8
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
5
11
  export const and: (a: any, b: any) => any;
6
12
  export const xor: (a: any, b: any) => any;
7
13
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
8
14
  export const blake2s256: (a: number, b: number) => [number, number];
9
15
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
16
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
11
- export const initLogLevel: (a: number, b: number) => [number, number];
12
17
  export const compressWitness: (a: any) => [number, number, number, number];
13
18
  export const decompressWitness: (a: number, b: number) => [number, number, number];
14
19
  export const compressWitnessStack: (a: any) => [number, number, number, number];
15
20
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
16
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
17
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
18
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
19
- export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
- export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
- export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
21
+ export const buildInfo: () => any;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure482_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure988_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure992_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure490_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;