@aztec/noir-acvm_js 0.77.0 → 0.78.0

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.
@@ -29,40 +29,40 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
29
29
  */
30
30
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
31
  /**
32
- * Sets the package's logging level.
32
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
33
33
  *
34
- * @param {LogLevel} level - The maximum level of logging to be emitted.
34
+ * @param {WitnessMap} witness_map - A witness map.
35
+ * @returns {Uint8Array} A compressed witness map
35
36
  */
36
- export function initLogLevel(filter: string): void;
37
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
37
38
  /**
38
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
40
+ * This should be used to only fetch the witness map for the main function.
39
41
  *
40
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
41
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
42
- * @returns {WitnessMap} A witness map containing the circuit's return values.
42
+ * @param {Uint8Array} compressed_witness - A compressed witness.
43
+ * @returns {WitnessMap} The decompressed witness map.
43
44
  */
44
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
45
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
45
46
  /**
46
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
47
48
  *
48
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
49
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
50
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
49
+ * @param {WitnessStack} witness_stack - A witness stack.
50
+ * @returns {Uint8Array} A compressed witness stack
51
51
  */
52
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
52
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
53
53
  /**
54
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
54
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
55
55
  *
56
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
57
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
58
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
56
+ * @param {Uint8Array} compressed_witness - A compressed witness.
57
+ * @returns {WitnessStack} The decompressed witness stack.
59
58
  */
60
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
59
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
61
60
  /**
62
- * Returns the `BuildInfo` object containing information about how the installed package was built.
63
- * @returns {BuildInfo} - Information on how the installed package was built.
61
+ * Sets the package's logging level.
62
+ *
63
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
64
64
  */
65
- export function buildInfo(): BuildInfo;
65
+ export function initLogLevel(filter: string): void;
66
66
  /**
67
67
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
68
  */
@@ -88,34 +88,34 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
88
88
  */
89
89
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
90
  /**
91
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
92
- *
93
- * @param {WitnessMap} witness_map - A witness map.
94
- * @returns {Uint8Array} A compressed witness map
91
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
92
+ * @returns {BuildInfo} - Information on how the installed package was built.
95
93
  */
96
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
94
+ export function buildInfo(): BuildInfo;
97
95
  /**
98
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
99
- * This should be used to only fetch the witness map for the main function.
96
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
100
97
  *
101
- * @param {Uint8Array} compressed_witness - A compressed witness.
102
- * @returns {WitnessMap} The decompressed witness map.
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.
103
101
  */
104
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
102
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
105
103
  /**
106
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
104
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
107
105
  *
108
- * @param {WitnessStack} witness_stack - A witness stack.
109
- * @returns {Uint8Array} A compressed witness stack
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.
110
109
  */
111
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
110
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
112
111
  /**
113
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
112
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
114
113
  *
115
- * @param {Uint8Array} compressed_witness - A compressed witness.
116
- * @returns {WitnessStack} The decompressed witness stack.
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
117
  */
118
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
118
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
119
 
120
120
  export type RawAssertionPayload = {
121
121
  selector: string;
@@ -139,21 +139,6 @@ export type WitnessStack = Array<StackItem>;
139
139
 
140
140
 
141
141
 
142
- // Map from witness index to hex string value of witness.
143
- export type WitnessMap = Map<number, string>;
144
-
145
- /**
146
- * An execution result containing two witnesses.
147
- * 1. The full solved witness of the execution.
148
- * 2. The return witness which contains the given public return values within the full witness.
149
- */
150
- export type SolvedAndReturnWitness = {
151
- solvedWitness: WitnessMap;
152
- returnWitness: WitnessMap;
153
- }
154
-
155
-
156
-
157
142
  /**
158
143
  * @typedef {Object} BuildInfo - Information about how the installed package was built
159
144
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -181,3 +166,18 @@ export type ForeignCallOutput = string | string[]
181
166
  export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
182
167
 
183
168
 
169
+
170
+ // Map from witness index to hex string value of witness.
171
+ export type WitnessMap = Map<number, string>;
172
+
173
+ /**
174
+ * An execution result containing two witnesses.
175
+ * 1. The full solved witness of the execution.
176
+ * 2. The return witness which contains the given public return values within the full witness.
177
+ */
178
+ export type SolvedAndReturnWitness = {
179
+ solvedWitness: WitnessMap;
180
+ returnWitness: WitnessMap;
181
+ }
182
+
183
+
package/nodejs/acvm_js.js CHANGED
@@ -259,34 +259,38 @@ function takeFromExternrefTable0(idx) {
259
259
  wasm.__externref_table_dealloc(idx);
260
260
  return value;
261
261
  }
262
+
263
+ function getArrayU8FromWasm0(ptr, len) {
264
+ ptr = ptr >>> 0;
265
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
266
+ }
262
267
  /**
263
- * Sets the package's logging level.
268
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
264
269
  *
265
- * @param {LogLevel} level - The maximum level of logging to be emitted.
270
+ * @param {WitnessMap} witness_map - A witness map.
271
+ * @returns {Uint8Array} A compressed witness map
266
272
  */
267
- module.exports.initLogLevel = function(filter) {
268
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
269
- const len0 = WASM_VECTOR_LEN;
270
- const ret = wasm.initLogLevel(ptr0, len0);
271
- if (ret[1]) {
272
- throw takeFromExternrefTable0(ret[0]);
273
+ module.exports.compressWitness = function(witness_map) {
274
+ const ret = wasm.compressWitness(witness_map);
275
+ if (ret[3]) {
276
+ throw takeFromExternrefTable0(ret[2]);
273
277
  }
278
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
279
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
280
+ return v1;
274
281
  };
275
282
 
276
283
  /**
277
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
284
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
285
+ * This should be used to only fetch the witness map for the main function.
278
286
  *
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}
287
+ * @param {Uint8Array} compressed_witness - A compressed witness.
288
+ * @returns {WitnessMap} The decompressed witness map.
285
289
  */
286
- module.exports.getReturnWitness = function(program, witness_map) {
287
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
290
+ module.exports.decompressWitness = function(compressed_witness) {
291
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
288
292
  const len0 = WASM_VECTOR_LEN;
289
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
293
+ const ret = wasm.decompressWitness(ptr0, len0);
290
294
  if (ret[2]) {
291
295
  throw takeFromExternrefTable0(ret[1]);
292
296
  }
@@ -294,39 +298,31 @@ module.exports.getReturnWitness = function(program, witness_map) {
294
298
  };
295
299
 
296
300
  /**
297
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
301
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
298
302
  *
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}
303
+ * @param {WitnessStack} witness_stack - A witness stack.
304
+ * @returns {Uint8Array} A compressed witness stack
305
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]);
306
+ module.exports.compressWitnessStack = function(witness_stack) {
307
+ const ret = wasm.compressWitnessStack(witness_stack);
308
+ if (ret[3]) {
309
+ throw takeFromExternrefTable0(ret[2]);
312
310
  }
313
- return takeFromExternrefTable0(ret[0]);
311
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
312
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
313
+ return v1;
314
314
  };
315
315
 
316
316
  /**
317
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
317
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
318
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}
319
+ * @param {Uint8Array} compressed_witness - A compressed witness.
320
+ * @returns {WitnessStack} The decompressed witness stack.
325
321
  */
326
- module.exports.getPublicWitness = function(program, solved_witness) {
327
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
322
+ module.exports.decompressWitnessStack = function(compressed_witness) {
323
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
328
324
  const len0 = WASM_VECTOR_LEN;
329
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
325
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
330
326
  if (ret[2]) {
331
327
  throw takeFromExternrefTable0(ret[1]);
332
328
  }
@@ -334,12 +330,17 @@ module.exports.getPublicWitness = function(program, solved_witness) {
334
330
  };
335
331
 
336
332
  /**
337
- * Returns the `BuildInfo` object containing information about how the installed package was built.
338
- * @returns {BuildInfo} - Information on how the installed package was built.
333
+ * Sets the package's logging level.
334
+ *
335
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
339
336
  */
340
- module.exports.buildInfo = function() {
341
- const ret = wasm.buildInfo();
342
- return ret;
337
+ module.exports.initLogLevel = function(filter) {
338
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
+ const len0 = WASM_VECTOR_LEN;
340
+ const ret = wasm.initLogLevel(ptr0, len0);
341
+ if (ret[1]) {
342
+ throw takeFromExternrefTable0(ret[0]);
343
+ }
343
344
  };
344
345
 
345
346
  /**
@@ -401,10 +402,6 @@ module.exports.sha256_compression = function(inputs, state) {
401
402
  return v3;
402
403
  };
403
404
 
404
- function getArrayU8FromWasm0(ptr, len) {
405
- ptr = ptr >>> 0;
406
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
407
- }
408
405
  /**
409
406
  * Calculates the Blake2s256 hash of the input bytes
410
407
  * @param {Uint8Array} inputs
@@ -462,32 +459,28 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
462
459
  };
463
460
 
464
461
  /**
465
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
466
- *
467
- * @param {WitnessMap} witness_map - A witness map.
468
- * @returns {Uint8Array} A compressed witness map
462
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
463
+ * @returns {BuildInfo} - Information on how the installed package was built.
469
464
  */
470
- module.exports.compressWitness = function(witness_map) {
471
- const ret = wasm.compressWitness(witness_map);
472
- if (ret[3]) {
473
- throw takeFromExternrefTable0(ret[2]);
474
- }
475
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
476
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
477
- return v1;
465
+ module.exports.buildInfo = function() {
466
+ const ret = wasm.buildInfo();
467
+ return ret;
478
468
  };
479
469
 
480
470
  /**
481
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
482
- * This should be used to only fetch the witness map for the main function.
471
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
483
472
  *
484
- * @param {Uint8Array} compressed_witness - A compressed witness.
485
- * @returns {WitnessMap} The decompressed witness map.
473
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
474
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
475
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
476
+ * @param {Uint8Array} program
477
+ * @param {WitnessMap} witness_map
478
+ * @returns {WitnessMap}
486
479
  */
487
- module.exports.decompressWitness = function(compressed_witness) {
488
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
480
+ module.exports.getReturnWitness = function(program, witness_map) {
481
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
489
482
  const len0 = WASM_VECTOR_LEN;
490
- const ret = wasm.decompressWitness(ptr0, len0);
483
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
491
484
  if (ret[2]) {
492
485
  throw takeFromExternrefTable0(ret[1]);
493
486
  }
@@ -495,31 +488,39 @@ module.exports.decompressWitness = function(compressed_witness) {
495
488
  };
496
489
 
497
490
  /**
498
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
491
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
499
492
  *
500
- * @param {WitnessStack} witness_stack - A witness stack.
501
- * @returns {Uint8Array} A compressed witness stack
493
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
494
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
495
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
496
+ * @param {Uint8Array} program
497
+ * @param {WitnessMap} solved_witness
498
+ * @returns {WitnessMap}
502
499
  */
503
- module.exports.compressWitnessStack = function(witness_stack) {
504
- const ret = wasm.compressWitnessStack(witness_stack);
505
- if (ret[3]) {
506
- throw takeFromExternrefTable0(ret[2]);
500
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
501
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
502
+ const len0 = WASM_VECTOR_LEN;
503
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
504
+ if (ret[2]) {
505
+ throw takeFromExternrefTable0(ret[1]);
507
506
  }
508
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
509
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
510
- return v1;
507
+ return takeFromExternrefTable0(ret[0]);
511
508
  };
512
509
 
513
510
  /**
514
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
511
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
515
512
  *
516
- * @param {Uint8Array} compressed_witness - A compressed witness.
517
- * @returns {WitnessStack} The decompressed witness stack.
513
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
514
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
515
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
516
+ * @param {Uint8Array} program
517
+ * @param {WitnessMap} solved_witness
518
+ * @returns {WitnessMap}
518
519
  */
519
- module.exports.decompressWitnessStack = function(compressed_witness) {
520
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
520
+ module.exports.getPublicWitness = function(program, solved_witness) {
521
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
521
522
  const len0 = WASM_VECTOR_LEN;
522
- const ret = wasm.decompressWitnessStack(ptr0, len0);
523
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
523
524
  if (ret[2]) {
524
525
  throw takeFromExternrefTable0(ret[1]);
525
526
  }
@@ -527,15 +528,15 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
527
528
  };
528
529
 
529
530
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure269_externref_shim(arg0, arg1, arg2);
531
+ wasm.closure265_externref_shim(arg0, arg1, arg2);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure834_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
+ wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
536
  }
536
537
 
537
538
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure838_externref_shim(arg0, arg1, arg2, arg3);
539
+ wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
539
540
  }
540
541
 
541
542
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -814,7 +815,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
814
815
  };
815
816
 
816
817
  module.exports.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 270, __wbg_adapter_30);
818
+ const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
818
819
  return ret;
819
820
  };
820
821
 
Binary file
@@ -4,21 +4,21 @@ export const memory: WebAssembly.Memory;
4
4
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
5
5
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
6
6
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
7
+ export const compressWitness: (a: any) => [number, number, number, number];
8
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
9
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
10
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
7
11
  export const initLogLevel: (a: number, b: number) => [number, number];
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];
11
- export const buildInfo: () => any;
12
12
  export const and: (a: any, b: any) => any;
13
13
  export const xor: (a: any, b: any) => any;
14
14
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
15
  export const blake2s256: (a: number, b: number) => [number, number];
16
16
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
17
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
18
- export const compressWitness: (a: any) => [number, number, number, number];
19
- export const decompressWitness: (a: number, b: number) => [number, number, number];
20
- export const compressWitnessStack: (a: any) => [number, number, number, number];
21
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
18
+ export const buildInfo: () => 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];
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 closure269_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure834_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure838_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure265_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure830_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.77.0",
3
+ "version": "0.78.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -29,40 +29,40 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
29
29
  */
30
30
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
31
31
  /**
32
- * Sets the package's logging level.
32
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
33
33
  *
34
- * @param {LogLevel} level - The maximum level of logging to be emitted.
34
+ * @param {WitnessMap} witness_map - A witness map.
35
+ * @returns {Uint8Array} A compressed witness map
35
36
  */
36
- export function initLogLevel(filter: string): void;
37
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
37
38
  /**
38
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
40
+ * This should be used to only fetch the witness map for the main function.
39
41
  *
40
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
41
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
42
- * @returns {WitnessMap} A witness map containing the circuit's return values.
42
+ * @param {Uint8Array} compressed_witness - A compressed witness.
43
+ * @returns {WitnessMap} The decompressed witness map.
43
44
  */
44
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
45
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
45
46
  /**
46
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
47
48
  *
48
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
49
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
50
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
49
+ * @param {WitnessStack} witness_stack - A witness stack.
50
+ * @returns {Uint8Array} A compressed witness stack
51
51
  */
52
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
52
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
53
53
  /**
54
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
54
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
55
55
  *
56
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
57
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
58
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
56
+ * @param {Uint8Array} compressed_witness - A compressed witness.
57
+ * @returns {WitnessStack} The decompressed witness stack.
59
58
  */
60
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
59
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
61
60
  /**
62
- * Returns the `BuildInfo` object containing information about how the installed package was built.
63
- * @returns {BuildInfo} - Information on how the installed package was built.
61
+ * Sets the package's logging level.
62
+ *
63
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
64
64
  */
65
- export function buildInfo(): BuildInfo;
65
+ export function initLogLevel(filter: string): void;
66
66
  /**
67
67
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
68
  */
@@ -88,34 +88,34 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
88
88
  */
89
89
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
90
  /**
91
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
92
- *
93
- * @param {WitnessMap} witness_map - A witness map.
94
- * @returns {Uint8Array} A compressed witness map
91
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
92
+ * @returns {BuildInfo} - Information on how the installed package was built.
95
93
  */
96
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
94
+ export function buildInfo(): BuildInfo;
97
95
  /**
98
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
99
- * This should be used to only fetch the witness map for the main function.
96
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
100
97
  *
101
- * @param {Uint8Array} compressed_witness - A compressed witness.
102
- * @returns {WitnessMap} The decompressed witness map.
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.
103
101
  */
104
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
102
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
105
103
  /**
106
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
104
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
107
105
  *
108
- * @param {WitnessStack} witness_stack - A witness stack.
109
- * @returns {Uint8Array} A compressed witness stack
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.
110
109
  */
111
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
110
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
112
111
  /**
113
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
112
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
114
113
  *
115
- * @param {Uint8Array} compressed_witness - A compressed witness.
116
- * @returns {WitnessStack} The decompressed witness stack.
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
117
  */
118
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
118
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
119
 
120
120
  export type RawAssertionPayload = {
121
121
  selector: string;
@@ -139,21 +139,6 @@ export type WitnessStack = Array<StackItem>;
139
139
 
140
140
 
141
141
 
142
- // Map from witness index to hex string value of witness.
143
- export type WitnessMap = Map<number, string>;
144
-
145
- /**
146
- * An execution result containing two witnesses.
147
- * 1. The full solved witness of the execution.
148
- * 2. The return witness which contains the given public return values within the full witness.
149
- */
150
- export type SolvedAndReturnWitness = {
151
- solvedWitness: WitnessMap;
152
- returnWitness: WitnessMap;
153
- }
154
-
155
-
156
-
157
142
  /**
158
143
  * @typedef {Object} BuildInfo - Information about how the installed package was built
159
144
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -182,6 +167,21 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
182
167
 
183
168
 
184
169
 
170
+ // Map from witness index to hex string value of witness.
171
+ export type WitnessMap = Map<number, string>;
172
+
173
+ /**
174
+ * An execution result containing two witnesses.
175
+ * 1. The full solved witness of the execution.
176
+ * 2. The return witness which contains the given public return values within the full witness.
177
+ */
178
+ export type SolvedAndReturnWitness = {
179
+ solvedWitness: WitnessMap;
180
+ returnWitness: WitnessMap;
181
+ }
182
+
183
+
184
+
185
185
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
186
186
 
187
187
  export interface InitOutput {
@@ -189,21 +189,21 @@ export interface InitOutput {
189
189
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
190
190
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
191
191
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
192
+ readonly compressWitness: (a: any) => [number, number, number, number];
193
+ readonly decompressWitness: (a: number, b: number) => [number, number, number];
194
+ readonly compressWitnessStack: (a: any) => [number, number, number, number];
195
+ readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
192
196
  readonly initLogLevel: (a: number, b: number) => [number, number];
193
- readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
194
- readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
195
- readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
196
- readonly buildInfo: () => any;
197
197
  readonly and: (a: any, b: any) => any;
198
198
  readonly xor: (a: any, b: any) => any;
199
199
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
200
200
  readonly blake2s256: (a: number, b: number) => [number, number];
201
201
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
202
202
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
- readonly compressWitness: (a: any) => [number, number, number, number];
204
- readonly decompressWitness: (a: number, b: number) => [number, number, number];
205
- readonly compressWitnessStack: (a: any) => [number, number, number, number];
206
- readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
203
+ readonly buildInfo: () => any;
204
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
205
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
206
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
207
207
  readonly __wbindgen_exn_store: (a: number) => void;
208
208
  readonly __externref_table_alloc: () => number;
209
209
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -212,9 +212,9 @@ export interface InitOutput {
212
212
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
213
213
  readonly __wbindgen_export_6: WebAssembly.Table;
214
214
  readonly __externref_table_dealloc: (a: number) => void;
215
- readonly closure269_externref_shim: (a: number, b: number, c: any) => void;
216
- readonly closure834_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
217
- readonly closure838_externref_shim: (a: number, b: number, c: any, d: any) => void;
215
+ readonly closure265_externref_shim: (a: number, b: number, c: any) => void;
216
+ readonly closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
217
+ readonly closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
218
218
  readonly __wbindgen_start: () => void;
219
219
  }
220
220
 
package/web/acvm_js.js CHANGED
@@ -255,34 +255,38 @@ function takeFromExternrefTable0(idx) {
255
255
  wasm.__externref_table_dealloc(idx);
256
256
  return value;
257
257
  }
258
+
259
+ function getArrayU8FromWasm0(ptr, len) {
260
+ ptr = ptr >>> 0;
261
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
262
+ }
258
263
  /**
259
- * Sets the package's logging level.
264
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
260
265
  *
261
- * @param {LogLevel} level - The maximum level of logging to be emitted.
266
+ * @param {WitnessMap} witness_map - A witness map.
267
+ * @returns {Uint8Array} A compressed witness map
262
268
  */
263
- export function initLogLevel(filter) {
264
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
265
- const len0 = WASM_VECTOR_LEN;
266
- const ret = wasm.initLogLevel(ptr0, len0);
267
- if (ret[1]) {
268
- throw takeFromExternrefTable0(ret[0]);
269
+ export function compressWitness(witness_map) {
270
+ const ret = wasm.compressWitness(witness_map);
271
+ if (ret[3]) {
272
+ throw takeFromExternrefTable0(ret[2]);
269
273
  }
274
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
275
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
276
+ return v1;
270
277
  }
271
278
 
272
279
  /**
273
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
280
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
281
+ * This should be used to only fetch the witness map for the main function.
274
282
  *
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}
283
+ * @param {Uint8Array} compressed_witness - A compressed witness.
284
+ * @returns {WitnessMap} The decompressed witness map.
281
285
  */
282
- export function getReturnWitness(program, witness_map) {
283
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
286
+ export function decompressWitness(compressed_witness) {
287
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
284
288
  const len0 = WASM_VECTOR_LEN;
285
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
289
+ const ret = wasm.decompressWitness(ptr0, len0);
286
290
  if (ret[2]) {
287
291
  throw takeFromExternrefTable0(ret[1]);
288
292
  }
@@ -290,39 +294,31 @@ export function getReturnWitness(program, witness_map) {
290
294
  }
291
295
 
292
296
  /**
293
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
297
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
294
298
  *
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}
299
+ * @param {WitnessStack} witness_stack - A witness stack.
300
+ * @returns {Uint8Array} A compressed witness stack
301
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]);
302
+ export function compressWitnessStack(witness_stack) {
303
+ const ret = wasm.compressWitnessStack(witness_stack);
304
+ if (ret[3]) {
305
+ throw takeFromExternrefTable0(ret[2]);
308
306
  }
309
- return takeFromExternrefTable0(ret[0]);
307
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
308
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
309
+ return v1;
310
310
  }
311
311
 
312
312
  /**
313
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
313
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
314
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}
315
+ * @param {Uint8Array} compressed_witness - A compressed witness.
316
+ * @returns {WitnessStack} The decompressed witness stack.
321
317
  */
322
- export function getPublicWitness(program, solved_witness) {
323
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
318
+ export function decompressWitnessStack(compressed_witness) {
319
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
324
320
  const len0 = WASM_VECTOR_LEN;
325
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
321
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
326
322
  if (ret[2]) {
327
323
  throw takeFromExternrefTable0(ret[1]);
328
324
  }
@@ -330,12 +326,17 @@ export function getPublicWitness(program, solved_witness) {
330
326
  }
331
327
 
332
328
  /**
333
- * Returns the `BuildInfo` object containing information about how the installed package was built.
334
- * @returns {BuildInfo} - Information on how the installed package was built.
329
+ * Sets the package's logging level.
330
+ *
331
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
335
332
  */
336
- export function buildInfo() {
337
- const ret = wasm.buildInfo();
338
- return ret;
333
+ export function initLogLevel(filter) {
334
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
335
+ const len0 = WASM_VECTOR_LEN;
336
+ const ret = wasm.initLogLevel(ptr0, len0);
337
+ if (ret[1]) {
338
+ throw takeFromExternrefTable0(ret[0]);
339
+ }
339
340
  }
340
341
 
341
342
  /**
@@ -397,10 +398,6 @@ export function sha256_compression(inputs, state) {
397
398
  return v3;
398
399
  }
399
400
 
400
- function getArrayU8FromWasm0(ptr, len) {
401
- ptr = ptr >>> 0;
402
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
403
- }
404
401
  /**
405
402
  * Calculates the Blake2s256 hash of the input bytes
406
403
  * @param {Uint8Array} inputs
@@ -458,32 +455,28 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
458
455
  }
459
456
 
460
457
  /**
461
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
462
- *
463
- * @param {WitnessMap} witness_map - A witness map.
464
- * @returns {Uint8Array} A compressed witness map
458
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
459
+ * @returns {BuildInfo} - Information on how the installed package was built.
465
460
  */
466
- export function compressWitness(witness_map) {
467
- const ret = wasm.compressWitness(witness_map);
468
- if (ret[3]) {
469
- throw takeFromExternrefTable0(ret[2]);
470
- }
471
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
472
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
473
- return v1;
461
+ export function buildInfo() {
462
+ const ret = wasm.buildInfo();
463
+ return ret;
474
464
  }
475
465
 
476
466
  /**
477
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
478
- * This should be used to only fetch the witness map for the main function.
467
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
479
468
  *
480
- * @param {Uint8Array} compressed_witness - A compressed witness.
481
- * @returns {WitnessMap} The decompressed witness map.
469
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
470
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
471
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
472
+ * @param {Uint8Array} program
473
+ * @param {WitnessMap} witness_map
474
+ * @returns {WitnessMap}
482
475
  */
483
- export function decompressWitness(compressed_witness) {
484
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
476
+ export function getReturnWitness(program, witness_map) {
477
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
485
478
  const len0 = WASM_VECTOR_LEN;
486
- const ret = wasm.decompressWitness(ptr0, len0);
479
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
487
480
  if (ret[2]) {
488
481
  throw takeFromExternrefTable0(ret[1]);
489
482
  }
@@ -491,31 +484,39 @@ export function decompressWitness(compressed_witness) {
491
484
  }
492
485
 
493
486
  /**
494
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
487
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
495
488
  *
496
- * @param {WitnessStack} witness_stack - A witness stack.
497
- * @returns {Uint8Array} A compressed witness stack
489
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
490
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
491
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
492
+ * @param {Uint8Array} program
493
+ * @param {WitnessMap} solved_witness
494
+ * @returns {WitnessMap}
498
495
  */
499
- export function compressWitnessStack(witness_stack) {
500
- const ret = wasm.compressWitnessStack(witness_stack);
501
- if (ret[3]) {
502
- throw takeFromExternrefTable0(ret[2]);
496
+ export function getPublicParametersWitness(program, solved_witness) {
497
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
498
+ const len0 = WASM_VECTOR_LEN;
499
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
500
+ if (ret[2]) {
501
+ throw takeFromExternrefTable0(ret[1]);
503
502
  }
504
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
505
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
506
- return v1;
503
+ return takeFromExternrefTable0(ret[0]);
507
504
  }
508
505
 
509
506
  /**
510
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
507
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
511
508
  *
512
- * @param {Uint8Array} compressed_witness - A compressed witness.
513
- * @returns {WitnessStack} The decompressed witness stack.
509
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
510
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
511
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
512
+ * @param {Uint8Array} program
513
+ * @param {WitnessMap} solved_witness
514
+ * @returns {WitnessMap}
514
515
  */
515
- export function decompressWitnessStack(compressed_witness) {
516
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
516
+ export function getPublicWitness(program, solved_witness) {
517
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
517
518
  const len0 = WASM_VECTOR_LEN;
518
- const ret = wasm.decompressWitnessStack(ptr0, len0);
519
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
519
520
  if (ret[2]) {
520
521
  throw takeFromExternrefTable0(ret[1]);
521
522
  }
@@ -523,15 +524,15 @@ export function decompressWitnessStack(compressed_witness) {
523
524
  }
524
525
 
525
526
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure269_externref_shim(arg0, arg1, arg2);
527
+ wasm.closure265_externref_shim(arg0, arg1, arg2);
527
528
  }
528
529
 
529
530
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure834_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
+ wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure838_externref_shim(arg0, arg1, arg2, arg3);
535
+ wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
535
536
  }
536
537
 
537
538
  async function __wbg_load(module, imports) {
@@ -798,7 +799,7 @@ function __wbg_get_imports() {
798
799
  return ret;
799
800
  };
800
801
  imports.wbg.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 270, __wbg_adapter_30);
802
+ const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
802
803
  return ret;
803
804
  };
804
805
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -4,21 +4,21 @@ export const memory: WebAssembly.Memory;
4
4
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
5
5
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
6
6
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
7
+ export const compressWitness: (a: any) => [number, number, number, number];
8
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
9
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
10
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
7
11
  export const initLogLevel: (a: number, b: number) => [number, number];
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];
11
- export const buildInfo: () => any;
12
12
  export const and: (a: any, b: any) => any;
13
13
  export const xor: (a: any, b: any) => any;
14
14
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
15
  export const blake2s256: (a: number, b: number) => [number, number];
16
16
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
17
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
18
- export const compressWitness: (a: any) => [number, number, number, number];
19
- export const decompressWitness: (a: number, b: number) => [number, number, number];
20
- export const compressWitnessStack: (a: any) => [number, number, number, number];
21
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
18
+ export const buildInfo: () => 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];
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 closure269_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure834_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure838_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure265_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;