@aztec/noir-acvm_js 0.0.1-commit.d431d1c → 0.0.1-commit.dbf9cec

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,10 +1,34 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
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.
4
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
+ *
6
+ * @param {WitnessMap} witness_map - A witness map.
7
+ * @returns {Uint8Array} A compressed witness map
6
8
  */
7
- export function buildInfo(): BuildInfo;
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
10
+ /**
11
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
12
+ * This should be used to only fetch the witness map for the main function.
13
+ *
14
+ * @param {Uint8Array} compressed_witness - A compressed witness.
15
+ * @returns {WitnessMap} The decompressed witness map.
16
+ */
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
18
+ /**
19
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
20
+ *
21
+ * @param {WitnessStack} witness_stack - A witness stack.
22
+ * @returns {Uint8Array} A compressed witness stack
23
+ */
24
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
25
+ /**
26
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
27
+ *
28
+ * @param {Uint8Array} compressed_witness - A compressed witness.
29
+ * @returns {WitnessStack} The decompressed witness stack.
30
+ */
31
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
8
32
  /**
9
33
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
10
34
  *
@@ -34,34 +58,29 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
34
58
  */
35
59
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
36
60
  /**
37
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
38
- *
39
- * @param {WitnessMap} witness_map - A witness map.
40
- * @returns {Uint8Array} A compressed witness map
41
- */
42
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
43
- /**
44
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
45
- * This should be used to only fetch the witness map for the main function.
61
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
46
62
  *
47
- * @param {Uint8Array} compressed_witness - A compressed witness.
48
- * @returns {WitnessMap} The decompressed witness map.
63
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
64
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
65
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
49
66
  */
50
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
67
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
51
68
  /**
52
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
69
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
53
70
  *
54
- * @param {WitnessStack} witness_stack - A witness stack.
55
- * @returns {Uint8Array} A compressed witness stack
71
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
72
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
73
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
56
74
  */
57
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
75
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
58
76
  /**
59
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
77
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
60
78
  *
61
- * @param {Uint8Array} compressed_witness - A compressed witness.
62
- * @returns {WitnessStack} The decompressed witness stack.
79
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
80
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
81
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
63
82
  */
64
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
83
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
65
84
  /**
66
85
  * Performs a bitwise AND operation between `lhs` and `rhs`
67
86
  */
@@ -86,36 +105,31 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
86
105
  * Verifies a ECDSA signature over the secp256r1 curve.
87
106
  */
88
107
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
108
+ /**
109
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
110
+ * @returns {BuildInfo} - Information on how the installed package was built.
111
+ */
112
+ export function buildInfo(): BuildInfo;
89
113
  /**
90
114
  * Sets the package's logging level.
91
115
  *
92
116
  * @param {LogLevel} level - The maximum level of logging to be emitted.
93
117
  */
94
118
  export function initLogLevel(filter: string): void;
95
- /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
- *
98
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
99
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
100
- * @returns {WitnessMap} A witness map containing the circuit's return values.
101
- */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
103
- /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
105
- *
106
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
107
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
108
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
109
- */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
111
- /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
113
- *
114
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
- */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
+
120
+ export type RawAssertionPayload = {
121
+ selector: string;
122
+ data: string[];
123
+ };
124
+
125
+ export type ExecutionError = Error & {
126
+ callStack?: string[];
127
+ rawAssertionPayload?: RawAssertionPayload;
128
+ acirFunctionId?: number;
129
+ brilligFunctionId?: number;
130
+ };
131
+
132
+
119
133
 
120
134
  export type StackItem = {
121
135
  index: number;
@@ -140,20 +154,6 @@ export type BuildInfo = {
140
154
 
141
155
 
142
156
 
143
- export type RawAssertionPayload = {
144
- selector: string;
145
- data: string[];
146
- };
147
-
148
- export type ExecutionError = Error & {
149
- callStack?: string[];
150
- rawAssertionPayload?: RawAssertionPayload;
151
- acirFunctionId?: number;
152
- brilligFunctionId?: number;
153
- };
154
-
155
-
156
-
157
157
  // Map from witness index to hex string value of witness.
158
158
  export type WitnessMap = Map<number, string>;
159
159
 
package/nodejs/acvm_js.js CHANGED
@@ -201,13 +201,31 @@ 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
+ }
210
+
211
+ function getArrayU8FromWasm0(ptr, len) {
212
+ ptr = ptr >>> 0;
213
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
214
+ }
204
215
  /**
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.
216
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
217
+ *
218
+ * @param {WitnessMap} witness_map - A witness map.
219
+ * @returns {Uint8Array} A compressed witness map
207
220
  */
208
- module.exports.buildInfo = function() {
209
- const ret = wasm.buildInfo();
210
- return ret;
221
+ module.exports.compressWitness = function(witness_map) {
222
+ const ret = wasm.compressWitness(witness_map);
223
+ if (ret[3]) {
224
+ throw takeFromExternrefTable0(ret[2]);
225
+ }
226
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
227
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
228
+ return v1;
211
229
  };
212
230
 
213
231
  function passArray8ToWasm0(arg, malloc) {
@@ -216,6 +234,55 @@ function passArray8ToWasm0(arg, malloc) {
216
234
  WASM_VECTOR_LEN = arg.length;
217
235
  return ptr;
218
236
  }
237
+ /**
238
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
239
+ * This should be used to only fetch the witness map for the main function.
240
+ *
241
+ * @param {Uint8Array} compressed_witness - A compressed witness.
242
+ * @returns {WitnessMap} The decompressed witness map.
243
+ */
244
+ module.exports.decompressWitness = function(compressed_witness) {
245
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
246
+ const len0 = WASM_VECTOR_LEN;
247
+ const ret = wasm.decompressWitness(ptr0, len0);
248
+ if (ret[2]) {
249
+ throw takeFromExternrefTable0(ret[1]);
250
+ }
251
+ return takeFromExternrefTable0(ret[0]);
252
+ };
253
+
254
+ /**
255
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
256
+ *
257
+ * @param {WitnessStack} witness_stack - A witness stack.
258
+ * @returns {Uint8Array} A compressed witness stack
259
+ */
260
+ module.exports.compressWitnessStack = function(witness_stack) {
261
+ const ret = wasm.compressWitnessStack(witness_stack);
262
+ if (ret[3]) {
263
+ throw takeFromExternrefTable0(ret[2]);
264
+ }
265
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
266
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
267
+ return v1;
268
+ };
269
+
270
+ /**
271
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
272
+ *
273
+ * @param {Uint8Array} compressed_witness - A compressed witness.
274
+ * @returns {WitnessStack} The decompressed witness stack.
275
+ */
276
+ module.exports.decompressWitnessStack = function(compressed_witness) {
277
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
278
+ const len0 = WASM_VECTOR_LEN;
279
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
280
+ if (ret[2]) {
281
+ throw takeFromExternrefTable0(ret[1]);
282
+ }
283
+ return takeFromExternrefTable0(ret[0]);
284
+ };
285
+
219
286
  /**
220
287
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
221
288
  *
@@ -262,43 +329,20 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
262
329
  return ret;
263
330
  };
264
331
 
265
- function takeFromExternrefTable0(idx) {
266
- const value = wasm.__wbindgen_export_2.get(idx);
267
- wasm.__externref_table_dealloc(idx);
268
- return value;
269
- }
270
-
271
- function getArrayU8FromWasm0(ptr, len) {
272
- ptr = ptr >>> 0;
273
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
274
- }
275
- /**
276
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
277
- *
278
- * @param {WitnessMap} witness_map - A witness map.
279
- * @returns {Uint8Array} A compressed witness map
280
- */
281
- module.exports.compressWitness = function(witness_map) {
282
- const ret = wasm.compressWitness(witness_map);
283
- if (ret[3]) {
284
- throw takeFromExternrefTable0(ret[2]);
285
- }
286
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
287
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
288
- return v1;
289
- };
290
-
291
332
  /**
292
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
293
- * This should be used to only fetch the witness map for the main function.
333
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
294
334
  *
295
- * @param {Uint8Array} compressed_witness - A compressed witness.
296
- * @returns {WitnessMap} The decompressed witness map.
335
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
336
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
337
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
338
+ * @param {Uint8Array} program
339
+ * @param {WitnessMap} witness_map
340
+ * @returns {WitnessMap}
297
341
  */
298
- module.exports.decompressWitness = function(compressed_witness) {
299
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
342
+ module.exports.getReturnWitness = function(program, witness_map) {
343
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
300
344
  const len0 = WASM_VECTOR_LEN;
301
- const ret = wasm.decompressWitness(ptr0, len0);
345
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
302
346
  if (ret[2]) {
303
347
  throw takeFromExternrefTable0(ret[1]);
304
348
  }
@@ -306,31 +350,39 @@ module.exports.decompressWitness = function(compressed_witness) {
306
350
  };
307
351
 
308
352
  /**
309
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
353
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
310
354
  *
311
- * @param {WitnessStack} witness_stack - A witness stack.
312
- * @returns {Uint8Array} A compressed witness stack
355
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
356
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
357
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
358
+ * @param {Uint8Array} program
359
+ * @param {WitnessMap} solved_witness
360
+ * @returns {WitnessMap}
313
361
  */
314
- module.exports.compressWitnessStack = function(witness_stack) {
315
- const ret = wasm.compressWitnessStack(witness_stack);
316
- if (ret[3]) {
317
- throw takeFromExternrefTable0(ret[2]);
362
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
363
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
364
+ const len0 = WASM_VECTOR_LEN;
365
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
366
+ if (ret[2]) {
367
+ throw takeFromExternrefTable0(ret[1]);
318
368
  }
319
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
320
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
321
- return v1;
369
+ return takeFromExternrefTable0(ret[0]);
322
370
  };
323
371
 
324
372
  /**
325
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
373
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
326
374
  *
327
- * @param {Uint8Array} compressed_witness - A compressed witness.
328
- * @returns {WitnessStack} The decompressed witness stack.
375
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
376
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
377
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
378
+ * @param {Uint8Array} program
379
+ * @param {WitnessMap} solved_witness
380
+ * @returns {WitnessMap}
329
381
  */
330
- module.exports.decompressWitnessStack = function(compressed_witness) {
331
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
382
+ module.exports.getPublicWitness = function(program, solved_witness) {
383
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
332
384
  const len0 = WASM_VECTOR_LEN;
333
- const ret = wasm.decompressWitnessStack(ptr0, len0);
385
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
334
386
  if (ret[2]) {
335
387
  throw takeFromExternrefTable0(ret[1]);
336
388
  }
@@ -452,6 +504,15 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
452
504
  return ret !== 0;
453
505
  };
454
506
 
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 ret;
514
+ };
515
+
455
516
  /**
456
517
  * Sets the package's logging level.
457
518
  *
@@ -466,76 +527,16 @@ module.exports.initLogLevel = function(filter) {
466
527
  }
467
528
  };
468
529
 
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
530
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure447_externref_shim(arg0, arg1, arg2);
531
+ wasm.closure445_externref_shim(arg0, arg1, arg2);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
+ wasm.closure924_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
536
  }
536
537
 
537
538
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
539
+ wasm.closure928_externref_shim(arg0, arg1, arg2, arg3);
539
540
  }
540
541
 
541
542
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -553,12 +554,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
553
554
  return ret;
554
555
  }, arguments) };
555
556
 
556
- module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
557
+ module.exports.__wbg_constructor_2b49e4454d172081 = function(arg0) {
557
558
  const ret = new Error(arg0);
558
559
  return ret;
559
560
  };
560
561
 
561
- module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
562
+ module.exports.__wbg_constructor_dddf0209b25406fd = function(arg0) {
562
563
  const ret = new Error(arg0);
563
564
  return ret;
564
565
  };
@@ -674,6 +675,11 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
674
675
  }
675
676
  };
676
677
 
678
+ module.exports.__wbg_new_2812f5f6a6bd8bcf = function() {
679
+ const ret = new Array();
680
+ return ret;
681
+ };
682
+
677
683
  module.exports.__wbg_new_5e0be73521bc8c17 = function() {
678
684
  const ret = new Map();
679
685
  return ret;
@@ -689,8 +695,8 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
689
695
  return ret;
690
696
  };
691
697
 
692
- module.exports.__wbg_new_9f501325818b4158 = function() {
693
- const ret = new Array();
698
+ module.exports.__wbg_new_b110592360513189 = function() {
699
+ const ret = new Map();
694
700
  return ret;
695
701
  };
696
702
 
@@ -699,11 +705,6 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
699
705
  return ret;
700
706
  };
701
707
 
702
- module.exports.__wbg_new_ec40611a7805f1f0 = function() {
703
- const ret = new Map();
704
- return ret;
705
- };
706
-
707
708
  module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
708
709
  const ret = new Function(getStringFromWasm0(arg0, arg1));
709
710
  return ret;
@@ -813,8 +814,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
814
  return ret;
814
815
  };
815
816
 
816
- module.exports.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
817
+ module.exports.__wbindgen_closure_wrapper1366 = function(arg0, arg1, arg2) {
818
+ const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
818
819
  return ret;
819
820
  };
820
821
 
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;
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
4
  export const compressWitness: (a: any) => [number, number, number, number];
9
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
10
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
11
7
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
8
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
9
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
10
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
11
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
12
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
13
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
14
  export const and: (a: any, b: any) => any;
13
15
  export const xor: (a: any, b: any) => any;
14
16
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
17
  export const blake2s256: (a: number, b: number) => [number, number];
16
18
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
19
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
20
+ export const buildInfo: () => any;
18
21
  export const initLogLevel: (a: number, b: number) => [number, number];
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];
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 closure447_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure445_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure928_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": "@aztec/noir-acvm_js",
3
- "version": "0.0.1-commit.d431d1c",
3
+ "version": "0.0.1-commit.dbf9cec",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,14 +38,14 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@esm-bundle/chai": "^4.3.4-fix.0",
41
- "@web/dev-server-esbuild": "^1.0.4",
41
+ "@web/dev-server-esbuild": "^1.0.5",
42
42
  "@web/test-runner": "^0.20.2",
43
43
  "@web/test-runner-playwright": "^0.11.1",
44
44
  "chai": "^6.2.2",
45
- "eslint": "^9.39.2",
46
- "eslint-plugin-prettier": "^5.5.4",
45
+ "eslint": "^10.0.0",
46
+ "eslint-plugin-prettier": "^5.5.5",
47
47
  "mocha": "^11.7.5",
48
- "prettier": "3.7.4",
48
+ "prettier": "3.8.1",
49
49
  "ts-node": "^10.9.2",
50
50
  "typescript": "^5.8.3"
51
51
  }
package/web/acvm_js.d.ts CHANGED
@@ -1,10 +1,34 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
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.
4
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
+ *
6
+ * @param {WitnessMap} witness_map - A witness map.
7
+ * @returns {Uint8Array} A compressed witness map
6
8
  */
7
- export function buildInfo(): BuildInfo;
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
10
+ /**
11
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
12
+ * This should be used to only fetch the witness map for the main function.
13
+ *
14
+ * @param {Uint8Array} compressed_witness - A compressed witness.
15
+ * @returns {WitnessMap} The decompressed witness map.
16
+ */
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
18
+ /**
19
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
20
+ *
21
+ * @param {WitnessStack} witness_stack - A witness stack.
22
+ * @returns {Uint8Array} A compressed witness stack
23
+ */
24
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
25
+ /**
26
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
27
+ *
28
+ * @param {Uint8Array} compressed_witness - A compressed witness.
29
+ * @returns {WitnessStack} The decompressed witness stack.
30
+ */
31
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
8
32
  /**
9
33
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
10
34
  *
@@ -34,34 +58,29 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
34
58
  */
35
59
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
36
60
  /**
37
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
38
- *
39
- * @param {WitnessMap} witness_map - A witness map.
40
- * @returns {Uint8Array} A compressed witness map
41
- */
42
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
43
- /**
44
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
45
- * This should be used to only fetch the witness map for the main function.
61
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
46
62
  *
47
- * @param {Uint8Array} compressed_witness - A compressed witness.
48
- * @returns {WitnessMap} The decompressed witness map.
63
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
64
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
65
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
49
66
  */
50
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
67
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
51
68
  /**
52
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
69
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
53
70
  *
54
- * @param {WitnessStack} witness_stack - A witness stack.
55
- * @returns {Uint8Array} A compressed witness stack
71
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
72
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
73
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
56
74
  */
57
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
75
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
58
76
  /**
59
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
77
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
60
78
  *
61
- * @param {Uint8Array} compressed_witness - A compressed witness.
62
- * @returns {WitnessStack} The decompressed witness stack.
79
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
80
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
81
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
63
82
  */
64
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
83
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
65
84
  /**
66
85
  * Performs a bitwise AND operation between `lhs` and `rhs`
67
86
  */
@@ -86,36 +105,31 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
86
105
  * Verifies a ECDSA signature over the secp256r1 curve.
87
106
  */
88
107
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
108
+ /**
109
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
110
+ * @returns {BuildInfo} - Information on how the installed package was built.
111
+ */
112
+ export function buildInfo(): BuildInfo;
89
113
  /**
90
114
  * Sets the package's logging level.
91
115
  *
92
116
  * @param {LogLevel} level - The maximum level of logging to be emitted.
93
117
  */
94
118
  export function initLogLevel(filter: string): void;
95
- /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
- *
98
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
99
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
100
- * @returns {WitnessMap} A witness map containing the circuit's return values.
101
- */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
103
- /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
105
- *
106
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
107
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
108
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
109
- */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
111
- /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
113
- *
114
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
- */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
+
120
+ export type RawAssertionPayload = {
121
+ selector: string;
122
+ data: string[];
123
+ };
124
+
125
+ export type ExecutionError = Error & {
126
+ callStack?: string[];
127
+ rawAssertionPayload?: RawAssertionPayload;
128
+ acirFunctionId?: number;
129
+ brilligFunctionId?: number;
130
+ };
131
+
132
+
119
133
 
120
134
  export type StackItem = {
121
135
  index: number;
@@ -140,20 +154,6 @@ export type BuildInfo = {
140
154
 
141
155
 
142
156
 
143
- export type RawAssertionPayload = {
144
- selector: string;
145
- data: string[];
146
- };
147
-
148
- export type ExecutionError = Error & {
149
- callStack?: string[];
150
- rawAssertionPayload?: RawAssertionPayload;
151
- acirFunctionId?: number;
152
- brilligFunctionId?: number;
153
- };
154
-
155
-
156
-
157
157
  // Map from witness index to hex string value of witness.
158
158
  export type WitnessMap = Map<number, string>;
159
159
 
@@ -187,24 +187,24 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
- readonly buildInfo: () => any;
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
190
  readonly compressWitness: (a: any) => [number, number, number, number];
195
191
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
196
192
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
197
193
  readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
194
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
195
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
196
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
197
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
198
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
199
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
198
200
  readonly and: (a: any, b: any) => any;
199
201
  readonly xor: (a: any, b: any) => any;
200
202
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
201
203
  readonly blake2s256: (a: number, b: number) => [number, number];
202
204
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
205
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
206
+ readonly buildInfo: () => any;
204
207
  readonly initLogLevel: (a: number, b: number) => [number, number];
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];
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 closure447_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure445_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure928_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,13 +197,31 @@ 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
+ }
206
+
207
+ function getArrayU8FromWasm0(ptr, len) {
208
+ ptr = ptr >>> 0;
209
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
210
+ }
200
211
  /**
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.
212
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
213
+ *
214
+ * @param {WitnessMap} witness_map - A witness map.
215
+ * @returns {Uint8Array} A compressed witness map
203
216
  */
204
- export function buildInfo() {
205
- const ret = wasm.buildInfo();
206
- return ret;
217
+ export function compressWitness(witness_map) {
218
+ const ret = wasm.compressWitness(witness_map);
219
+ if (ret[3]) {
220
+ throw takeFromExternrefTable0(ret[2]);
221
+ }
222
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
223
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
224
+ return v1;
207
225
  }
208
226
 
209
227
  function passArray8ToWasm0(arg, malloc) {
@@ -212,6 +230,55 @@ function passArray8ToWasm0(arg, malloc) {
212
230
  WASM_VECTOR_LEN = arg.length;
213
231
  return ptr;
214
232
  }
233
+ /**
234
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
235
+ * This should be used to only fetch the witness map for the main function.
236
+ *
237
+ * @param {Uint8Array} compressed_witness - A compressed witness.
238
+ * @returns {WitnessMap} The decompressed witness map.
239
+ */
240
+ export function decompressWitness(compressed_witness) {
241
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
242
+ const len0 = WASM_VECTOR_LEN;
243
+ const ret = wasm.decompressWitness(ptr0, len0);
244
+ if (ret[2]) {
245
+ throw takeFromExternrefTable0(ret[1]);
246
+ }
247
+ return takeFromExternrefTable0(ret[0]);
248
+ }
249
+
250
+ /**
251
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
252
+ *
253
+ * @param {WitnessStack} witness_stack - A witness stack.
254
+ * @returns {Uint8Array} A compressed witness stack
255
+ */
256
+ export function compressWitnessStack(witness_stack) {
257
+ const ret = wasm.compressWitnessStack(witness_stack);
258
+ if (ret[3]) {
259
+ throw takeFromExternrefTable0(ret[2]);
260
+ }
261
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
262
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
263
+ return v1;
264
+ }
265
+
266
+ /**
267
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
268
+ *
269
+ * @param {Uint8Array} compressed_witness - A compressed witness.
270
+ * @returns {WitnessStack} The decompressed witness stack.
271
+ */
272
+ export function decompressWitnessStack(compressed_witness) {
273
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
274
+ const len0 = WASM_VECTOR_LEN;
275
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
276
+ if (ret[2]) {
277
+ throw takeFromExternrefTable0(ret[1]);
278
+ }
279
+ return takeFromExternrefTable0(ret[0]);
280
+ }
281
+
215
282
  /**
216
283
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
217
284
  *
@@ -258,43 +325,20 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
258
325
  return ret;
259
326
  }
260
327
 
261
- function takeFromExternrefTable0(idx) {
262
- const value = wasm.__wbindgen_export_2.get(idx);
263
- wasm.__externref_table_dealloc(idx);
264
- return value;
265
- }
266
-
267
- function getArrayU8FromWasm0(ptr, len) {
268
- ptr = ptr >>> 0;
269
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
270
- }
271
328
  /**
272
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
273
- *
274
- * @param {WitnessMap} witness_map - A witness map.
275
- * @returns {Uint8Array} A compressed witness map
276
- */
277
- export function compressWitness(witness_map) {
278
- const ret = wasm.compressWitness(witness_map);
279
- if (ret[3]) {
280
- throw takeFromExternrefTable0(ret[2]);
281
- }
282
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
283
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
284
- return v1;
285
- }
286
-
287
- /**
288
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
289
- * This should be used to only fetch the witness map for the main function.
329
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
290
330
  *
291
- * @param {Uint8Array} compressed_witness - A compressed witness.
292
- * @returns {WitnessMap} The decompressed witness map.
331
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
332
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
333
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
334
+ * @param {Uint8Array} program
335
+ * @param {WitnessMap} witness_map
336
+ * @returns {WitnessMap}
293
337
  */
294
- export function decompressWitness(compressed_witness) {
295
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
338
+ export function getReturnWitness(program, witness_map) {
339
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
296
340
  const len0 = WASM_VECTOR_LEN;
297
- const ret = wasm.decompressWitness(ptr0, len0);
341
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
298
342
  if (ret[2]) {
299
343
  throw takeFromExternrefTable0(ret[1]);
300
344
  }
@@ -302,31 +346,39 @@ export function decompressWitness(compressed_witness) {
302
346
  }
303
347
 
304
348
  /**
305
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
349
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
306
350
  *
307
- * @param {WitnessStack} witness_stack - A witness stack.
308
- * @returns {Uint8Array} A compressed witness stack
351
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
352
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
353
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
354
+ * @param {Uint8Array} program
355
+ * @param {WitnessMap} solved_witness
356
+ * @returns {WitnessMap}
309
357
  */
310
- export function compressWitnessStack(witness_stack) {
311
- const ret = wasm.compressWitnessStack(witness_stack);
312
- if (ret[3]) {
313
- throw takeFromExternrefTable0(ret[2]);
358
+ export function getPublicParametersWitness(program, solved_witness) {
359
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
360
+ const len0 = WASM_VECTOR_LEN;
361
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
362
+ if (ret[2]) {
363
+ throw takeFromExternrefTable0(ret[1]);
314
364
  }
315
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
316
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
317
- return v1;
365
+ return takeFromExternrefTable0(ret[0]);
318
366
  }
319
367
 
320
368
  /**
321
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
369
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
322
370
  *
323
- * @param {Uint8Array} compressed_witness - A compressed witness.
324
- * @returns {WitnessStack} The decompressed witness stack.
371
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
372
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
373
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
374
+ * @param {Uint8Array} program
375
+ * @param {WitnessMap} solved_witness
376
+ * @returns {WitnessMap}
325
377
  */
326
- export function decompressWitnessStack(compressed_witness) {
327
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
378
+ export function getPublicWitness(program, solved_witness) {
379
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
328
380
  const len0 = WASM_VECTOR_LEN;
329
- const ret = wasm.decompressWitnessStack(ptr0, len0);
381
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
330
382
  if (ret[2]) {
331
383
  throw takeFromExternrefTable0(ret[1]);
332
384
  }
@@ -448,6 +500,15 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
448
500
  return ret !== 0;
449
501
  }
450
502
 
503
+ /**
504
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
505
+ * @returns {BuildInfo} - Information on how the installed package was built.
506
+ */
507
+ export function buildInfo() {
508
+ const ret = wasm.buildInfo();
509
+ return ret;
510
+ }
511
+
451
512
  /**
452
513
  * Sets the package's logging level.
453
514
  *
@@ -462,76 +523,16 @@ export function initLogLevel(filter) {
462
523
  }
463
524
  }
464
525
 
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
526
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure447_externref_shim(arg0, arg1, arg2);
527
+ wasm.closure445_externref_shim(arg0, arg1, arg2);
527
528
  }
528
529
 
529
530
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
+ wasm.closure924_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
535
+ wasm.closure928_externref_shim(arg0, arg1, arg2, arg3);
535
536
  }
536
537
 
537
538
  async function __wbg_load(module, imports) {
@@ -580,11 +581,11 @@ function __wbg_get_imports() {
580
581
  const ret = arg0.call(arg1, arg2, arg3);
581
582
  return ret;
582
583
  }, arguments) };
583
- imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
584
+ imports.wbg.__wbg_constructor_2b49e4454d172081 = function(arg0) {
584
585
  const ret = new Error(arg0);
585
586
  return ret;
586
587
  };
587
- imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
588
+ imports.wbg.__wbg_constructor_dddf0209b25406fd = function(arg0) {
588
589
  const ret = new Error(arg0);
589
590
  return ret;
590
591
  };
@@ -685,6 +686,10 @@ function __wbg_get_imports() {
685
686
  state0.a = state0.b = 0;
686
687
  }
687
688
  };
689
+ imports.wbg.__wbg_new_2812f5f6a6bd8bcf = function() {
690
+ const ret = new Array();
691
+ return ret;
692
+ };
688
693
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
689
694
  const ret = new Map();
690
695
  return ret;
@@ -697,18 +702,14 @@ function __wbg_get_imports() {
697
702
  const ret = new Error();
698
703
  return ret;
699
704
  };
700
- imports.wbg.__wbg_new_9f501325818b4158 = function() {
701
- const ret = new Array();
705
+ imports.wbg.__wbg_new_b110592360513189 = function() {
706
+ const ret = new Map();
702
707
  return ret;
703
708
  };
704
709
  imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
705
710
  const ret = new Error(getStringFromWasm0(arg0, arg1));
706
711
  return ret;
707
712
  };
708
- imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
709
- const ret = new Map();
710
- return ret;
711
- };
712
713
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
713
714
  const ret = new Function(getStringFromWasm0(arg0, arg1));
714
715
  return ret;
@@ -797,8 +798,8 @@ function __wbg_get_imports() {
797
798
  const ret = false;
798
799
  return ret;
799
800
  };
800
- imports.wbg.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
801
+ imports.wbg.__wbindgen_closure_wrapper1366 = function(arg0, arg1, arg2) {
802
+ const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
802
803
  return ret;
803
804
  };
804
805
  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;
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
4
  export const compressWitness: (a: any) => [number, number, number, number];
9
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
10
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
11
7
  export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
8
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
9
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
10
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
11
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
12
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
13
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
14
  export const and: (a: any, b: any) => any;
13
15
  export const xor: (a: any, b: any) => any;
14
16
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
17
  export const blake2s256: (a: number, b: number) => [number, number];
16
18
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
19
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
20
+ export const buildInfo: () => any;
18
21
  export const initLogLevel: (a: number, b: number) => [number, number];
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];
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 closure447_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure445_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure928_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;