@noir-lang/acvm_js 0.53.0 → 0.54.0-b65a63d.nightly

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,44 +1,39 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
4
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
5
  *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
6
+ * @param {WitnessMap} witness_map - A witness map.
7
+ * @returns {Uint8Array} A compressed witness map
7
8
  */
8
- export function initLogLevel(filter: string): void;
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
9
10
  /**
10
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
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.
11
13
  *
12
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
13
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
14
- * @returns {WitnessMap} A witness map containing the circuit's return values.
15
- * @param {Uint8Array} program
16
- * @param {WitnessMap} witness_map
17
- * @returns {WitnessMap}
14
+ * @param {Uint8Array} compressed_witness - A compressed witness.
15
+ * @returns {WitnessMap} The decompressed witness map.
18
16
  */
19
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
20
18
  /**
21
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
19
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
22
20
  *
23
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
24
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
25
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
26
- * @param {Uint8Array} program
27
- * @param {WitnessMap} solved_witness
28
- * @returns {WitnessMap}
21
+ * @param {WitnessStack} witness_stack - A witness stack.
22
+ * @returns {Uint8Array} A compressed witness stack
29
23
  */
30
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
24
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
31
25
  /**
32
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
26
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
33
27
  *
34
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
35
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
36
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
37
- * @param {Uint8Array} program
38
- * @param {WitnessMap} solved_witness
39
- * @returns {WitnessMap}
28
+ * @param {Uint8Array} compressed_witness - A compressed witness.
29
+ * @returns {WitnessStack} The decompressed witness stack.
40
30
  */
41
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
31
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
32
+ /**
33
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
34
+ * @returns {BuildInfo} - Information on how the installed package was built.
35
+ */
36
+ export function buildInfo(): BuildInfo;
42
37
  /**
43
38
  * Performs a bitwise AND operation between `lhs` and `rhs`
44
39
  * @param {string} lhs
@@ -85,39 +80,44 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
85
80
  */
86
81
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
87
82
  /**
88
- * Returns the `BuildInfo` object containing information about how the installed package was built.
89
- * @returns {BuildInfo} - Information on how the installed package was built.
90
- */
91
- export function buildInfo(): BuildInfo;
92
- /**
93
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
83
+ * Sets the package's logging level.
94
84
  *
95
- * @param {WitnessMap} witness_map - A witness map.
96
- * @returns {Uint8Array} A compressed witness map
85
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
97
86
  */
98
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
87
+ export function initLogLevel(filter: string): void;
99
88
  /**
100
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
101
- * This should be used to only fetch the witness map for the main function.
89
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
102
90
  *
103
- * @param {Uint8Array} compressed_witness - A compressed witness.
104
- * @returns {WitnessMap} The decompressed witness map.
91
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
92
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
93
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
94
+ * @param {Uint8Array} program
95
+ * @param {WitnessMap} witness_map
96
+ * @returns {WitnessMap}
105
97
  */
106
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
98
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
107
99
  /**
108
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
100
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
109
101
  *
110
- * @param {WitnessStack} witness_stack - A witness stack.
111
- * @returns {Uint8Array} A compressed witness stack
102
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
103
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
104
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
105
+ * @param {Uint8Array} program
106
+ * @param {WitnessMap} solved_witness
107
+ * @returns {WitnessMap}
112
108
  */
113
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
109
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
114
110
  /**
115
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
111
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
116
112
  *
117
- * @param {Uint8Array} compressed_witness - A compressed witness.
118
- * @returns {WitnessStack} The decompressed witness stack.
113
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
114
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
115
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
116
+ * @param {Uint8Array} program
117
+ * @param {WitnessMap} solved_witness
118
+ * @returns {WitnessMap}
119
119
  */
120
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
120
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
121
121
  /**
122
122
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
123
123
  *
@@ -147,28 +147,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
147
147
  */
148
148
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
149
149
 
150
- export type RawAssertionPayload = {
151
- selector: string;
152
- data: string[];
153
- };
154
-
155
- export type ExecutionError = Error & {
156
- callStack?: string[];
157
- rawAssertionPayload?: RawAssertionPayload;
158
- brilligFunctionId?: number;
159
- };
160
-
161
-
162
-
163
- export type StackItem = {
164
- index: number;
165
- witness: WitnessMap;
166
- }
167
-
168
- export type WitnessStack = Array<StackItem>;
169
-
170
-
171
-
172
150
  /**
173
151
  * @typedef {Object} BuildInfo - Information about how the installed package was built
174
152
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -197,6 +175,28 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
197
175
 
198
176
 
199
177
 
178
+ export type RawAssertionPayload = {
179
+ selector: string;
180
+ data: string[];
181
+ };
182
+
183
+ export type ExecutionError = Error & {
184
+ callStack?: string[];
185
+ rawAssertionPayload?: RawAssertionPayload;
186
+ brilligFunctionId?: number;
187
+ };
188
+
189
+
190
+
191
+ export type StackItem = {
192
+ index: number;
193
+ witness: WitnessMap;
194
+ }
195
+
196
+ export type WitnessStack = Array<StackItem>;
197
+
198
+
199
+
200
200
  // Map from witness index to hex string value of witness.
201
201
  export type WitnessMap = Map<number, string>;
202
202
 
package/nodejs/acvm_js.js CHANGED
@@ -23,6 +23,28 @@ function takeObject(idx) {
23
23
  return ret;
24
24
  }
25
25
 
26
+ function isLikeNone(x) {
27
+ return x === undefined || x === null;
28
+ }
29
+
30
+ let cachedFloat64Memory0 = null;
31
+
32
+ function getFloat64Memory0() {
33
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
34
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
35
+ }
36
+ return cachedFloat64Memory0;
37
+ }
38
+
39
+ let cachedInt32Memory0 = null;
40
+
41
+ function getInt32Memory0() {
42
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
43
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
44
+ }
45
+ return cachedInt32Memory0;
46
+ }
47
+
26
48
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
27
49
 
28
50
  cachedTextDecoder.decode();
@@ -50,28 +72,6 @@ function addHeapObject(obj) {
50
72
  return idx;
51
73
  }
52
74
 
53
- function isLikeNone(x) {
54
- return x === undefined || x === null;
55
- }
56
-
57
- let cachedFloat64Memory0 = null;
58
-
59
- function getFloat64Memory0() {
60
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
61
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
62
- }
63
- return cachedFloat64Memory0;
64
- }
65
-
66
- let cachedInt32Memory0 = null;
67
-
68
- function getInt32Memory0() {
69
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
70
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
71
- }
72
- return cachedInt32Memory0;
73
- }
74
-
75
75
  let WASM_VECTOR_LEN = 0;
76
76
 
77
77
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -217,25 +217,33 @@ function makeMutClosure(arg0, arg1, dtor, f) {
217
217
  return real;
218
218
  }
219
219
  function __wbg_adapter_22(arg0, arg1, arg2) {
220
- wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
220
+ wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h624a3dfbf78ca22a(arg0, arg1, addHeapObject(arg2));
221
221
  }
222
222
 
223
+ function getArrayU8FromWasm0(ptr, len) {
224
+ ptr = ptr >>> 0;
225
+ return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
226
+ }
223
227
  /**
224
- * Sets the package's logging level.
228
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
225
229
  *
226
- * @param {LogLevel} level - The maximum level of logging to be emitted.
230
+ * @param {WitnessMap} witness_map - A witness map.
231
+ * @returns {Uint8Array} A compressed witness map
227
232
  */
228
- module.exports.initLogLevel = function(filter) {
233
+ module.exports.compressWitness = function(witness_map) {
229
234
  try {
230
235
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
231
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
232
- const len0 = WASM_VECTOR_LEN;
233
- wasm.initLogLevel(retptr, ptr0, len0);
236
+ wasm.compressWitness(retptr, addHeapObject(witness_map));
234
237
  var r0 = getInt32Memory0()[retptr / 4 + 0];
235
238
  var r1 = getInt32Memory0()[retptr / 4 + 1];
236
- if (r1) {
237
- throw takeObject(r0);
239
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
240
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
241
+ if (r3) {
242
+ throw takeObject(r2);
238
243
  }
244
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
245
+ wasm.__wbindgen_free(r0, r1 * 1);
246
+ return v1;
239
247
  } finally {
240
248
  wasm.__wbindgen_add_to_stack_pointer(16);
241
249
  }
@@ -248,21 +256,18 @@ function passArray8ToWasm0(arg, malloc) {
248
256
  return ptr;
249
257
  }
250
258
  /**
251
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
259
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
260
+ * This should be used to only fetch the witness map for the main function.
252
261
  *
253
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
254
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
255
- * @returns {WitnessMap} A witness map containing the circuit's return values.
256
- * @param {Uint8Array} program
257
- * @param {WitnessMap} witness_map
258
- * @returns {WitnessMap}
262
+ * @param {Uint8Array} compressed_witness - A compressed witness.
263
+ * @returns {WitnessMap} The decompressed witness map.
259
264
  */
260
- module.exports.getReturnWitness = function(program, witness_map) {
265
+ module.exports.decompressWitness = function(compressed_witness) {
261
266
  try {
262
267
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
263
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
268
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
264
269
  const len0 = WASM_VECTOR_LEN;
265
- wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
270
+ wasm.decompressWitness(retptr, ptr0, len0);
266
271
  var r0 = getInt32Memory0()[retptr / 4 + 0];
267
272
  var r1 = getInt32Memory0()[retptr / 4 + 1];
268
273
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -276,49 +281,42 @@ module.exports.getReturnWitness = function(program, witness_map) {
276
281
  };
277
282
 
278
283
  /**
279
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
284
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
280
285
  *
281
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
282
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
283
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
284
- * @param {Uint8Array} program
285
- * @param {WitnessMap} solved_witness
286
- * @returns {WitnessMap}
286
+ * @param {WitnessStack} witness_stack - A witness stack.
287
+ * @returns {Uint8Array} A compressed witness stack
287
288
  */
288
- module.exports.getPublicParametersWitness = function(program, solved_witness) {
289
+ module.exports.compressWitnessStack = function(witness_stack) {
289
290
  try {
290
291
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
291
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
292
- const len0 = WASM_VECTOR_LEN;
293
- wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
292
+ wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
294
293
  var r0 = getInt32Memory0()[retptr / 4 + 0];
295
294
  var r1 = getInt32Memory0()[retptr / 4 + 1];
296
295
  var r2 = getInt32Memory0()[retptr / 4 + 2];
297
- if (r2) {
298
- throw takeObject(r1);
296
+ var r3 = getInt32Memory0()[retptr / 4 + 3];
297
+ if (r3) {
298
+ throw takeObject(r2);
299
299
  }
300
- return takeObject(r0);
300
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
301
+ wasm.__wbindgen_free(r0, r1 * 1);
302
+ return v1;
301
303
  } finally {
302
304
  wasm.__wbindgen_add_to_stack_pointer(16);
303
305
  }
304
306
  };
305
307
 
306
308
  /**
307
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
309
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
308
310
  *
309
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
310
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
311
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
312
- * @param {Uint8Array} program
313
- * @param {WitnessMap} solved_witness
314
- * @returns {WitnessMap}
311
+ * @param {Uint8Array} compressed_witness - A compressed witness.
312
+ * @returns {WitnessStack} The decompressed witness stack.
315
313
  */
316
- module.exports.getPublicWitness = function(program, solved_witness) {
314
+ module.exports.decompressWitnessStack = function(compressed_witness) {
317
315
  try {
318
316
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
319
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
317
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
320
318
  const len0 = WASM_VECTOR_LEN;
321
- wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
319
+ wasm.decompressWitnessStack(retptr, ptr0, len0);
322
320
  var r0 = getInt32Memory0()[retptr / 4 + 0];
323
321
  var r1 = getInt32Memory0()[retptr / 4 + 1];
324
322
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -331,6 +329,15 @@ module.exports.getPublicWitness = function(program, solved_witness) {
331
329
  }
332
330
  };
333
331
 
332
+ /**
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.
335
+ */
336
+ module.exports.buildInfo = function() {
337
+ const ret = wasm.buildInfo();
338
+ return takeObject(ret);
339
+ };
340
+
334
341
  /**
335
342
  * Performs a bitwise AND operation between `lhs` and `rhs`
336
343
  * @param {string} lhs
@@ -397,10 +404,6 @@ module.exports.sha256_compression = function(inputs, state) {
397
404
  }
398
405
  };
399
406
 
400
- function getArrayU8FromWasm0(ptr, len) {
401
- ptr = ptr >>> 0;
402
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
403
- }
404
407
  /**
405
408
  * Calculates the Blake2s256 hash of the input bytes
406
409
  * @param {Uint8Array} inputs
@@ -465,52 +468,42 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
465
468
  };
466
469
 
467
470
  /**
468
- * Returns the `BuildInfo` object containing information about how the installed package was built.
469
- * @returns {BuildInfo} - Information on how the installed package was built.
470
- */
471
- module.exports.buildInfo = function() {
472
- const ret = wasm.buildInfo();
473
- return takeObject(ret);
474
- };
475
-
476
- /**
477
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
471
+ * Sets the package's logging level.
478
472
  *
479
- * @param {WitnessMap} witness_map - A witness map.
480
- * @returns {Uint8Array} A compressed witness map
473
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
481
474
  */
482
- module.exports.compressWitness = function(witness_map) {
475
+ module.exports.initLogLevel = function(filter) {
483
476
  try {
484
477
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
485
- wasm.compressWitness(retptr, addHeapObject(witness_map));
478
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
479
+ const len0 = WASM_VECTOR_LEN;
480
+ wasm.initLogLevel(retptr, ptr0, len0);
486
481
  var r0 = getInt32Memory0()[retptr / 4 + 0];
487
482
  var r1 = getInt32Memory0()[retptr / 4 + 1];
488
- var r2 = getInt32Memory0()[retptr / 4 + 2];
489
- var r3 = getInt32Memory0()[retptr / 4 + 3];
490
- if (r3) {
491
- throw takeObject(r2);
483
+ if (r1) {
484
+ throw takeObject(r0);
492
485
  }
493
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
494
- wasm.__wbindgen_free(r0, r1 * 1);
495
- return v1;
496
486
  } finally {
497
487
  wasm.__wbindgen_add_to_stack_pointer(16);
498
488
  }
499
489
  };
500
490
 
501
491
  /**
502
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
503
- * This should be used to only fetch the witness map for the main function.
492
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
504
493
  *
505
- * @param {Uint8Array} compressed_witness - A compressed witness.
506
- * @returns {WitnessMap} The decompressed witness map.
494
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
495
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
496
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
497
+ * @param {Uint8Array} program
498
+ * @param {WitnessMap} witness_map
499
+ * @returns {WitnessMap}
507
500
  */
508
- module.exports.decompressWitness = function(compressed_witness) {
501
+ module.exports.getReturnWitness = function(program, witness_map) {
509
502
  try {
510
503
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
511
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
504
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
512
505
  const len0 = WASM_VECTOR_LEN;
513
- wasm.decompressWitness(retptr, ptr0, len0);
506
+ wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
514
507
  var r0 = getInt32Memory0()[retptr / 4 + 0];
515
508
  var r1 = getInt32Memory0()[retptr / 4 + 1];
516
509
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -524,42 +517,49 @@ module.exports.decompressWitness = function(compressed_witness) {
524
517
  };
525
518
 
526
519
  /**
527
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
520
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
528
521
  *
529
- * @param {WitnessStack} witness_stack - A witness stack.
530
- * @returns {Uint8Array} A compressed witness stack
522
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
523
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
524
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
525
+ * @param {Uint8Array} program
526
+ * @param {WitnessMap} solved_witness
527
+ * @returns {WitnessMap}
531
528
  */
532
- module.exports.compressWitnessStack = function(witness_stack) {
529
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
533
530
  try {
534
531
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
535
- wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
532
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
533
+ const len0 = WASM_VECTOR_LEN;
534
+ wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
536
535
  var r0 = getInt32Memory0()[retptr / 4 + 0];
537
536
  var r1 = getInt32Memory0()[retptr / 4 + 1];
538
537
  var r2 = getInt32Memory0()[retptr / 4 + 2];
539
- var r3 = getInt32Memory0()[retptr / 4 + 3];
540
- if (r3) {
541
- throw takeObject(r2);
538
+ if (r2) {
539
+ throw takeObject(r1);
542
540
  }
543
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
544
- wasm.__wbindgen_free(r0, r1 * 1);
545
- return v1;
541
+ return takeObject(r0);
546
542
  } finally {
547
543
  wasm.__wbindgen_add_to_stack_pointer(16);
548
544
  }
549
545
  };
550
546
 
551
547
  /**
552
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
548
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
553
549
  *
554
- * @param {Uint8Array} compressed_witness - A compressed witness.
555
- * @returns {WitnessStack} The decompressed witness stack.
550
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
551
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
552
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
553
+ * @param {Uint8Array} program
554
+ * @param {WitnessMap} solved_witness
555
+ * @returns {WitnessMap}
556
556
  */
557
- module.exports.decompressWitnessStack = function(compressed_witness) {
557
+ module.exports.getPublicWitness = function(program, solved_witness) {
558
558
  try {
559
559
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
560
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
560
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
561
561
  const len0 = WASM_VECTOR_LEN;
562
- wasm.decompressWitnessStack(retptr, ptr0, len0);
562
+ wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
563
563
  var r0 = getInt32Memory0()[retptr / 4 + 0];
564
564
  var r1 = getInt32Memory0()[retptr / 4 + 1];
565
565
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -619,7 +619,7 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
619
619
  };
620
620
 
621
621
  function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
622
- wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
622
+ wasm.wasm_bindgen__convert__closures__invoke3_mut__h45040feada3ebb25(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
623
623
  }
624
624
 
625
625
  function handleError(f, args) {
@@ -630,13 +630,30 @@ function handleError(f, args) {
630
630
  }
631
631
  }
632
632
  function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
633
- wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
633
+ wasm.wasm_bindgen__convert__closures__invoke2_mut__h3f07259b3eb55784(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
634
634
  }
635
635
 
636
636
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
637
637
  takeObject(arg0);
638
638
  };
639
639
 
640
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
641
+ const obj = getObject(arg1);
642
+ const ret = typeof(obj) === 'number' ? obj : undefined;
643
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
644
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
645
+ };
646
+
647
+ module.exports.__wbindgen_is_string = function(arg0) {
648
+ const ret = typeof(getObject(arg0)) === 'string';
649
+ return ret;
650
+ };
651
+
652
+ module.exports.__wbindgen_is_array = function(arg0) {
653
+ const ret = Array.isArray(getObject(arg0));
654
+ return ret;
655
+ };
656
+
640
657
  module.exports.__wbindgen_cb_drop = function(arg0) {
641
658
  const obj = takeObject(arg0).original;
642
659
  if (obj.cnt-- == 1) {
@@ -647,7 +664,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
647
664
  return ret;
648
665
  };
649
666
 
650
- module.exports.__wbg_constructor_01cf62506201187d = function(arg0) {
667
+ module.exports.__wbg_constructor_79bab16c42849d1b = function(arg0) {
651
668
  const ret = new Error(takeObject(arg0));
652
669
  return addHeapObject(ret);
653
670
  };
@@ -657,7 +674,7 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
657
674
  return addHeapObject(ret);
658
675
  };
659
676
 
660
- module.exports.__wbg_new_0d58cd3f85c51a07 = function() {
677
+ module.exports.__wbg_new_610492d70b2d4e55 = function() {
661
678
  const ret = new Array();
662
679
  return addHeapObject(ret);
663
680
  };
@@ -667,24 +684,7 @@ module.exports.__wbindgen_number_new = function(arg0) {
667
684
  return addHeapObject(ret);
668
685
  };
669
686
 
670
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
671
- const obj = getObject(arg1);
672
- const ret = typeof(obj) === 'number' ? obj : undefined;
673
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
674
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
675
- };
676
-
677
- module.exports.__wbindgen_is_string = function(arg0) {
678
- const ret = typeof(getObject(arg0)) === 'string';
679
- return ret;
680
- };
681
-
682
- module.exports.__wbindgen_is_array = function(arg0) {
683
- const ret = Array.isArray(getObject(arg0));
684
- return ret;
685
- };
686
-
687
- module.exports.__wbg_new_ced18ca7e58573af = function() {
687
+ module.exports.__wbg_new_7b5514a697f386eb = function() {
688
688
  const ret = new Map();
689
689
  return addHeapObject(ret);
690
690
  };
@@ -916,8 +916,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
916
916
  throw new Error(getStringFromWasm0(arg0, arg1));
917
917
  };
918
918
 
919
- module.exports.__wbindgen_closure_wrapper736 = function(arg0, arg1, arg2) {
920
- const ret = makeMutClosure(arg0, arg1, 269, __wbg_adapter_22);
919
+ module.exports.__wbindgen_closure_wrapper737 = function(arg0, arg1, arg2) {
920
+ const ret = makeMutClosure(arg0, arg1, 265, __wbg_adapter_22);
921
921
  return addHeapObject(ret);
922
922
  };
923
923
 
Binary file