@aztec/noir-acvm_js 4.0.0-nightly.20250907 → 4.0.0-nightly.20260108

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.
@@ -6,35 +6,6 @@
6
6
  * @param {LogLevel} level - The maximum level of logging to be emitted.
7
7
  */
8
8
  export function initLogLevel(filter: string): void;
9
- /**
10
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
11
- *
12
- * @param {WitnessMap} witness_map - A witness map.
13
- * @returns {Uint8Array} A compressed witness map
14
- */
15
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
16
- /**
17
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
18
- * This should be used to only fetch the witness map for the main function.
19
- *
20
- * @param {Uint8Array} compressed_witness - A compressed witness.
21
- * @returns {WitnessMap} The decompressed witness map.
22
- */
23
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
24
- /**
25
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
26
- *
27
- * @param {WitnessStack} witness_stack - A witness stack.
28
- * @returns {Uint8Array} A compressed witness stack
29
- */
30
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
31
- /**
32
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
33
- *
34
- * @param {Uint8Array} compressed_witness - A compressed witness.
35
- * @returns {WitnessStack} The decompressed witness stack.
36
- */
37
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
38
9
  /**
39
10
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
40
11
  *
@@ -63,6 +34,30 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
63
34
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
64
35
  */
65
36
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
37
+ /**
38
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
+ *
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.
43
+ */
44
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
45
+ /**
46
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
+ *
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.
51
+ */
52
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
+ /**
54
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
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.
59
+ */
60
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
61
  /**
67
62
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
63
  */
@@ -88,57 +83,39 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
88
83
  */
89
84
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
85
  /**
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.
86
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
87
+ *
88
+ * @param {WitnessMap} witness_map - A witness map.
89
+ * @returns {Uint8Array} A compressed witness map
93
90
  */
94
- export function buildInfo(): BuildInfo;
91
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
95
92
  /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
93
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
94
+ * This should be used to only fetch the witness map for the main function.
97
95
  *
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.
96
+ * @param {Uint8Array} compressed_witness - A compressed witness.
97
+ * @returns {WitnessMap} The decompressed witness map.
101
98
  */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
99
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
103
100
  /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
101
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
105
102
  *
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.
103
+ * @param {WitnessStack} witness_stack - A witness stack.
104
+ * @returns {Uint8Array} A compressed witness stack
109
105
  */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
106
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
111
107
  /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
108
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
113
109
  *
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.
110
+ * @param {Uint8Array} compressed_witness - A compressed witness.
111
+ * @returns {WitnessStack} The decompressed witness stack.
117
112
  */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
-
120
- export type StackItem = {
121
- index: number;
122
- witness: WitnessMap;
123
- }
124
-
125
- export type WitnessStack = Array<StackItem>;
126
-
127
-
128
-
113
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
129
114
  /**
130
- * @typedef {Object} BuildInfo - Information about how the installed package was built
131
- * @property {string} gitHash - The hash of the git commit from which the package was built.
132
- * @property {string} version - The version of the package at the built git commit.
133
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
115
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
116
+ * @returns {BuildInfo} - Information on how the installed package was built.
134
117
  */
135
- export type BuildInfo = {
136
- gitHash: string;
137
- version: string;
138
- dirty: string;
139
- }
140
-
141
-
118
+ export function buildInfo(): BuildInfo;
142
119
 
143
120
  export type RawAssertionPayload = {
144
121
  selector: string;
@@ -154,6 +131,20 @@ export type ExecutionError = Error & {
154
131
 
155
132
 
156
133
 
134
+ export type ForeignCallInput = string[]
135
+ export type ForeignCallOutput = string | string[]
136
+
137
+ /**
138
+ * A callback which performs an foreign call and returns the response.
139
+ * @callback ForeignCallHandler
140
+ * @param {string} name - The identifier for the type of foreign call being performed.
141
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
142
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
143
+ */
144
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
145
+
146
+
147
+
157
148
  // Map from witness index to hex string value of witness.
158
149
  export type WitnessMap = Map<number, string>;
159
150
 
@@ -169,16 +160,25 @@ export type SolvedAndReturnWitness = {
169
160
 
170
161
 
171
162
 
172
- export type ForeignCallInput = string[]
173
- export type ForeignCallOutput = string | string[]
163
+ export type StackItem = {
164
+ index: number;
165
+ witness: WitnessMap;
166
+ }
167
+
168
+ export type WitnessStack = Array<StackItem>;
169
+
170
+
174
171
 
175
172
  /**
176
- * A callback which performs an foreign call and returns the response.
177
- * @callback ForeignCallHandler
178
- * @param {string} name - The identifier for the type of foreign call being performed.
179
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
180
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
181
- */
182
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
173
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
174
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
175
+ * @property {string} version - The version of the package at the built git commit.
176
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
+ */
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
182
+ }
183
183
 
184
184
 
package/nodejs/acvm_js.js CHANGED
@@ -221,81 +221,12 @@ module.exports.initLogLevel = function(filter) {
221
221
  }
222
222
  };
223
223
 
224
- function getArrayU8FromWasm0(ptr, len) {
225
- ptr = ptr >>> 0;
226
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
227
- }
228
- /**
229
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
230
- *
231
- * @param {WitnessMap} witness_map - A witness map.
232
- * @returns {Uint8Array} A compressed witness map
233
- */
234
- module.exports.compressWitness = function(witness_map) {
235
- const ret = wasm.compressWitness(witness_map);
236
- if (ret[3]) {
237
- throw takeFromExternrefTable0(ret[2]);
238
- }
239
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
240
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
241
- return v1;
242
- };
243
-
244
224
  function passArray8ToWasm0(arg, malloc) {
245
225
  const ptr = malloc(arg.length * 1, 1) >>> 0;
246
226
  getUint8ArrayMemory0().set(arg, ptr / 1);
247
227
  WASM_VECTOR_LEN = arg.length;
248
228
  return ptr;
249
229
  }
250
- /**
251
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
252
- * This should be used to only fetch the witness map for the main function.
253
- *
254
- * @param {Uint8Array} compressed_witness - A compressed witness.
255
- * @returns {WitnessMap} The decompressed witness map.
256
- */
257
- module.exports.decompressWitness = function(compressed_witness) {
258
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
259
- const len0 = WASM_VECTOR_LEN;
260
- const ret = wasm.decompressWitness(ptr0, len0);
261
- if (ret[2]) {
262
- throw takeFromExternrefTable0(ret[1]);
263
- }
264
- return takeFromExternrefTable0(ret[0]);
265
- };
266
-
267
- /**
268
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
269
- *
270
- * @param {WitnessStack} witness_stack - A witness stack.
271
- * @returns {Uint8Array} A compressed witness stack
272
- */
273
- module.exports.compressWitnessStack = function(witness_stack) {
274
- const ret = wasm.compressWitnessStack(witness_stack);
275
- if (ret[3]) {
276
- throw takeFromExternrefTable0(ret[2]);
277
- }
278
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
279
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
280
- return v1;
281
- };
282
-
283
- /**
284
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
285
- *
286
- * @param {Uint8Array} compressed_witness - A compressed witness.
287
- * @returns {WitnessStack} The decompressed witness stack.
288
- */
289
- module.exports.decompressWitnessStack = function(compressed_witness) {
290
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
291
- const len0 = WASM_VECTOR_LEN;
292
- const ret = wasm.decompressWitnessStack(ptr0, len0);
293
- if (ret[2]) {
294
- throw takeFromExternrefTable0(ret[1]);
295
- }
296
- return takeFromExternrefTable0(ret[0]);
297
- };
298
-
299
230
  /**
300
231
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
301
232
  *
@@ -342,6 +273,66 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
342
273
  return ret;
343
274
  };
344
275
 
276
+ /**
277
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
278
+ *
279
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
280
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
281
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
282
+ * @param {Uint8Array} program
283
+ * @param {WitnessMap} witness_map
284
+ * @returns {WitnessMap}
285
+ */
286
+ module.exports.getReturnWitness = function(program, witness_map) {
287
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
288
+ const len0 = WASM_VECTOR_LEN;
289
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
290
+ if (ret[2]) {
291
+ throw takeFromExternrefTable0(ret[1]);
292
+ }
293
+ return takeFromExternrefTable0(ret[0]);
294
+ };
295
+
296
+ /**
297
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
298
+ *
299
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
300
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
301
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
302
+ * @param {Uint8Array} program
303
+ * @param {WitnessMap} solved_witness
304
+ * @returns {WitnessMap}
305
+ */
306
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
307
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
308
+ const len0 = WASM_VECTOR_LEN;
309
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
310
+ if (ret[2]) {
311
+ throw takeFromExternrefTable0(ret[1]);
312
+ }
313
+ return takeFromExternrefTable0(ret[0]);
314
+ };
315
+
316
+ /**
317
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
318
+ *
319
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
320
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
321
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
322
+ * @param {Uint8Array} program
323
+ * @param {WitnessMap} solved_witness
324
+ * @returns {WitnessMap}
325
+ */
326
+ module.exports.getPublicWitness = function(program, solved_witness) {
327
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
328
+ const len0 = WASM_VECTOR_LEN;
329
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
330
+ if (ret[2]) {
331
+ throw takeFromExternrefTable0(ret[1]);
332
+ }
333
+ return takeFromExternrefTable0(ret[0]);
334
+ };
335
+
345
336
  /**
346
337
  * Performs a bitwise AND operation between `lhs` and `rhs`
347
338
  * @param {string} lhs
@@ -401,6 +392,10 @@ module.exports.sha256_compression = function(inputs, state) {
401
392
  return v3;
402
393
  };
403
394
 
395
+ function getArrayU8FromWasm0(ptr, len) {
396
+ ptr = ptr >>> 0;
397
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
398
+ }
404
399
  /**
405
400
  * Calculates the Blake2s256 hash of the input bytes
406
401
  * @param {Uint8Array} inputs
@@ -458,28 +453,32 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
458
453
  };
459
454
 
460
455
  /**
461
- * Returns the `BuildInfo` object containing information about how the installed package was built.
462
- * @returns {BuildInfo} - Information on how the installed package was built.
456
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
457
+ *
458
+ * @param {WitnessMap} witness_map - A witness map.
459
+ * @returns {Uint8Array} A compressed witness map
463
460
  */
464
- module.exports.buildInfo = function() {
465
- const ret = wasm.buildInfo();
466
- return ret;
461
+ module.exports.compressWitness = function(witness_map) {
462
+ const ret = wasm.compressWitness(witness_map);
463
+ if (ret[3]) {
464
+ throw takeFromExternrefTable0(ret[2]);
465
+ }
466
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
467
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
468
+ return v1;
467
469
  };
468
470
 
469
471
  /**
470
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
472
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
473
+ * This should be used to only fetch the witness map for the main function.
471
474
  *
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}
475
+ * @param {Uint8Array} compressed_witness - A compressed witness.
476
+ * @returns {WitnessMap} The decompressed witness map.
478
477
  */
479
- module.exports.getReturnWitness = function(program, witness_map) {
480
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
478
+ module.exports.decompressWitness = function(compressed_witness) {
479
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
481
480
  const len0 = WASM_VECTOR_LEN;
482
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
481
+ const ret = wasm.decompressWitness(ptr0, len0);
483
482
  if (ret[2]) {
484
483
  throw takeFromExternrefTable0(ret[1]);
485
484
  }
@@ -487,55 +486,56 @@ module.exports.getReturnWitness = function(program, witness_map) {
487
486
  };
488
487
 
489
488
  /**
490
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
489
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
491
490
  *
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}
491
+ * @param {WitnessStack} witness_stack - A witness stack.
492
+ * @returns {Uint8Array} A compressed witness stack
498
493
  */
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]);
494
+ module.exports.compressWitnessStack = function(witness_stack) {
495
+ const ret = wasm.compressWitnessStack(witness_stack);
496
+ if (ret[3]) {
497
+ throw takeFromExternrefTable0(ret[2]);
505
498
  }
506
- return takeFromExternrefTable0(ret[0]);
499
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
500
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
501
+ return v1;
507
502
  };
508
503
 
509
504
  /**
510
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
505
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
511
506
  *
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}
507
+ * @param {Uint8Array} compressed_witness - A compressed witness.
508
+ * @returns {WitnessStack} The decompressed witness stack.
518
509
  */
519
- module.exports.getPublicWitness = function(program, solved_witness) {
520
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
510
+ module.exports.decompressWitnessStack = function(compressed_witness) {
511
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
521
512
  const len0 = WASM_VECTOR_LEN;
522
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
513
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
523
514
  if (ret[2]) {
524
515
  throw takeFromExternrefTable0(ret[1]);
525
516
  }
526
517
  return takeFromExternrefTable0(ret[0]);
527
518
  };
528
519
 
520
+ /**
521
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
522
+ * @returns {BuildInfo} - Information on how the installed package was built.
523
+ */
524
+ module.exports.buildInfo = function() {
525
+ const ret = wasm.buildInfo();
526
+ return ret;
527
+ };
528
+
529
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure571_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure490_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure1165_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure1169_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
539
539
  }
540
540
 
541
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -553,12 +553,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
553
553
  return ret;
554
554
  }, arguments) };
555
555
 
556
- module.exports.__wbg_constructor_78d4b46bae4ee3a6 = function(arg0) {
556
+ module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
557
557
  const ret = new Error(arg0);
558
558
  return ret;
559
559
  };
560
560
 
561
- module.exports.__wbg_constructor_e15d65f40a39eb05 = function(arg0) {
561
+ module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
562
562
  const ret = new Error(arg0);
563
563
  return ret;
564
564
  };
@@ -689,8 +689,8 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
689
689
  return ret;
690
690
  };
691
691
 
692
- module.exports.__wbg_new_95a101145c23dc1d = function() {
693
- const ret = new Map();
692
+ module.exports.__wbg_new_9f501325818b4158 = function() {
693
+ const ret = new Array();
694
694
  return ret;
695
695
  };
696
696
 
@@ -699,8 +699,8 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
699
699
  return ret;
700
700
  };
701
701
 
702
- module.exports.__wbg_new_d1312de2c48bf990 = function() {
703
- const ret = new Array();
702
+ module.exports.__wbg_new_ec40611a7805f1f0 = function() {
703
+ const ret = new Map();
704
704
  return ret;
705
705
  };
706
706
 
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
813
  return ret;
814
814
  };
815
815
 
816
- module.exports.__wbindgen_closure_wrapper1986 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 572, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -2,23 +2,23 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const initLogLevel: (a: number, b: number) => [number, number];
5
- export const compressWitness: (a: any) => [number, number, number, number];
6
- export const decompressWitness: (a: number, b: number) => [number, number, number];
7
- export const compressWitnessStack: (a: any) => [number, number, number, number];
8
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
9
5
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
10
6
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
11
7
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
8
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
11
  export const and: (a: any, b: any) => any;
13
12
  export const xor: (a: any, b: any) => any;
14
13
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
14
  export const blake2s256: (a: number, b: number) => [number, number];
16
15
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
16
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
+ export const compressWitness: (a: any) => [number, number, number, number];
18
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
19
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
20
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
18
21
  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 closure571_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1165_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1169_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure490_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/noir-acvm_js",
3
- "version": "4.0.0-nightly.20250907",
3
+ "version": "4.0.0-nightly.20260108",
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": "^0.3.6",
41
+ "@web/dev-server-esbuild": "^1.0.4",
42
42
  "@web/test-runner": "^0.20.2",
43
- "@web/test-runner-playwright": "^0.11.0",
44
- "chai": "^4.4.1",
45
- "eslint": "^9.28.0",
46
- "eslint-plugin-prettier": "^5.4.1",
47
- "mocha": "^11.5.0",
48
- "prettier": "3.5.3",
43
+ "@web/test-runner-playwright": "^0.11.1",
44
+ "chai": "^6.2.2",
45
+ "eslint": "^9.39.2",
46
+ "eslint-plugin-prettier": "^5.5.4",
47
+ "mocha": "^11.7.5",
48
+ "prettier": "3.7.4",
49
49
  "ts-node": "^10.9.2",
50
50
  "typescript": "^5.8.3"
51
51
  }
package/web/acvm_js.d.ts CHANGED
@@ -6,35 +6,6 @@
6
6
  * @param {LogLevel} level - The maximum level of logging to be emitted.
7
7
  */
8
8
  export function initLogLevel(filter: string): void;
9
- /**
10
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
11
- *
12
- * @param {WitnessMap} witness_map - A witness map.
13
- * @returns {Uint8Array} A compressed witness map
14
- */
15
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
16
- /**
17
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
18
- * This should be used to only fetch the witness map for the main function.
19
- *
20
- * @param {Uint8Array} compressed_witness - A compressed witness.
21
- * @returns {WitnessMap} The decompressed witness map.
22
- */
23
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
24
- /**
25
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
26
- *
27
- * @param {WitnessStack} witness_stack - A witness stack.
28
- * @returns {Uint8Array} A compressed witness stack
29
- */
30
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
31
- /**
32
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
33
- *
34
- * @param {Uint8Array} compressed_witness - A compressed witness.
35
- * @returns {WitnessStack} The decompressed witness stack.
36
- */
37
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
38
9
  /**
39
10
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
40
11
  *
@@ -63,6 +34,30 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
63
34
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
64
35
  */
65
36
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
37
+ /**
38
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
+ *
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.
43
+ */
44
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
45
+ /**
46
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
+ *
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.
51
+ */
52
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
53
+ /**
54
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
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.
59
+ */
60
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
66
61
  /**
67
62
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
63
  */
@@ -88,57 +83,39 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
88
83
  */
89
84
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
85
  /**
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.
86
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
87
+ *
88
+ * @param {WitnessMap} witness_map - A witness map.
89
+ * @returns {Uint8Array} A compressed witness map
93
90
  */
94
- export function buildInfo(): BuildInfo;
91
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
95
92
  /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
93
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
94
+ * This should be used to only fetch the witness map for the main function.
97
95
  *
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.
96
+ * @param {Uint8Array} compressed_witness - A compressed witness.
97
+ * @returns {WitnessMap} The decompressed witness map.
101
98
  */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
99
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
103
100
  /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
101
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
105
102
  *
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.
103
+ * @param {WitnessStack} witness_stack - A witness stack.
104
+ * @returns {Uint8Array} A compressed witness stack
109
105
  */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
106
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
111
107
  /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
108
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
113
109
  *
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.
110
+ * @param {Uint8Array} compressed_witness - A compressed witness.
111
+ * @returns {WitnessStack} The decompressed witness stack.
117
112
  */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
-
120
- export type StackItem = {
121
- index: number;
122
- witness: WitnessMap;
123
- }
124
-
125
- export type WitnessStack = Array<StackItem>;
126
-
127
-
128
-
113
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
129
114
  /**
130
- * @typedef {Object} BuildInfo - Information about how the installed package was built
131
- * @property {string} gitHash - The hash of the git commit from which the package was built.
132
- * @property {string} version - The version of the package at the built git commit.
133
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
115
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
116
+ * @returns {BuildInfo} - Information on how the installed package was built.
134
117
  */
135
- export type BuildInfo = {
136
- gitHash: string;
137
- version: string;
138
- dirty: string;
139
- }
140
-
141
-
118
+ export function buildInfo(): BuildInfo;
142
119
 
143
120
  export type RawAssertionPayload = {
144
121
  selector: string;
@@ -154,6 +131,20 @@ export type ExecutionError = Error & {
154
131
 
155
132
 
156
133
 
134
+ export type ForeignCallInput = string[]
135
+ export type ForeignCallOutput = string | string[]
136
+
137
+ /**
138
+ * A callback which performs an foreign call and returns the response.
139
+ * @callback ForeignCallHandler
140
+ * @param {string} name - The identifier for the type of foreign call being performed.
141
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
142
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
143
+ */
144
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
145
+
146
+
147
+
157
148
  // Map from witness index to hex string value of witness.
158
149
  export type WitnessMap = Map<number, string>;
159
150
 
@@ -169,17 +160,26 @@ export type SolvedAndReturnWitness = {
169
160
 
170
161
 
171
162
 
172
- export type ForeignCallInput = string[]
173
- export type ForeignCallOutput = string | string[]
163
+ export type StackItem = {
164
+ index: number;
165
+ witness: WitnessMap;
166
+ }
167
+
168
+ export type WitnessStack = Array<StackItem>;
169
+
170
+
174
171
 
175
172
  /**
176
- * A callback which performs an foreign call and returns the response.
177
- * @callback ForeignCallHandler
178
- * @param {string} name - The identifier for the type of foreign call being performed.
179
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
180
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
181
- */
182
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
173
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
174
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
175
+ * @property {string} version - The version of the package at the built git commit.
176
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
+ */
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
182
+ }
183
183
 
184
184
 
185
185
 
@@ -188,23 +188,23 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
190
  readonly initLogLevel: (a: number, b: number) => [number, number];
191
- readonly compressWitness: (a: any) => [number, number, number, number];
192
- readonly decompressWitness: (a: number, b: number) => [number, number, number];
193
- readonly compressWitnessStack: (a: any) => [number, number, number, number];
194
- readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
195
191
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
196
192
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
197
193
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
194
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
195
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
196
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
198
197
  readonly and: (a: any, b: any) => any;
199
198
  readonly xor: (a: any, b: any) => any;
200
199
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
201
200
  readonly blake2s256: (a: number, b: number) => [number, number];
202
201
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
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];
204
207
  readonly buildInfo: () => any;
205
- readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
206
- readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
207
- readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
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 closure571_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure1165_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure1169_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure490_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -217,81 +217,12 @@ export function initLogLevel(filter) {
217
217
  }
218
218
  }
219
219
 
220
- function getArrayU8FromWasm0(ptr, len) {
221
- ptr = ptr >>> 0;
222
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
223
- }
224
- /**
225
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
226
- *
227
- * @param {WitnessMap} witness_map - A witness map.
228
- * @returns {Uint8Array} A compressed witness map
229
- */
230
- export function compressWitness(witness_map) {
231
- const ret = wasm.compressWitness(witness_map);
232
- if (ret[3]) {
233
- throw takeFromExternrefTable0(ret[2]);
234
- }
235
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
236
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
237
- return v1;
238
- }
239
-
240
220
  function passArray8ToWasm0(arg, malloc) {
241
221
  const ptr = malloc(arg.length * 1, 1) >>> 0;
242
222
  getUint8ArrayMemory0().set(arg, ptr / 1);
243
223
  WASM_VECTOR_LEN = arg.length;
244
224
  return ptr;
245
225
  }
246
- /**
247
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
248
- * This should be used to only fetch the witness map for the main function.
249
- *
250
- * @param {Uint8Array} compressed_witness - A compressed witness.
251
- * @returns {WitnessMap} The decompressed witness map.
252
- */
253
- export function decompressWitness(compressed_witness) {
254
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
255
- const len0 = WASM_VECTOR_LEN;
256
- const ret = wasm.decompressWitness(ptr0, len0);
257
- if (ret[2]) {
258
- throw takeFromExternrefTable0(ret[1]);
259
- }
260
- return takeFromExternrefTable0(ret[0]);
261
- }
262
-
263
- /**
264
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
265
- *
266
- * @param {WitnessStack} witness_stack - A witness stack.
267
- * @returns {Uint8Array} A compressed witness stack
268
- */
269
- export function compressWitnessStack(witness_stack) {
270
- const ret = wasm.compressWitnessStack(witness_stack);
271
- if (ret[3]) {
272
- throw takeFromExternrefTable0(ret[2]);
273
- }
274
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
275
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
276
- return v1;
277
- }
278
-
279
- /**
280
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
281
- *
282
- * @param {Uint8Array} compressed_witness - A compressed witness.
283
- * @returns {WitnessStack} The decompressed witness stack.
284
- */
285
- export function decompressWitnessStack(compressed_witness) {
286
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
287
- const len0 = WASM_VECTOR_LEN;
288
- const ret = wasm.decompressWitnessStack(ptr0, len0);
289
- if (ret[2]) {
290
- throw takeFromExternrefTable0(ret[1]);
291
- }
292
- return takeFromExternrefTable0(ret[0]);
293
- }
294
-
295
226
  /**
296
227
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
297
228
  *
@@ -338,6 +269,66 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
338
269
  return ret;
339
270
  }
340
271
 
272
+ /**
273
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
274
+ *
275
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
276
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
277
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
278
+ * @param {Uint8Array} program
279
+ * @param {WitnessMap} witness_map
280
+ * @returns {WitnessMap}
281
+ */
282
+ export function getReturnWitness(program, witness_map) {
283
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
284
+ const len0 = WASM_VECTOR_LEN;
285
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
286
+ if (ret[2]) {
287
+ throw takeFromExternrefTable0(ret[1]);
288
+ }
289
+ return takeFromExternrefTable0(ret[0]);
290
+ }
291
+
292
+ /**
293
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
294
+ *
295
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
296
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
297
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
298
+ * @param {Uint8Array} program
299
+ * @param {WitnessMap} solved_witness
300
+ * @returns {WitnessMap}
301
+ */
302
+ export function getPublicParametersWitness(program, solved_witness) {
303
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
304
+ const len0 = WASM_VECTOR_LEN;
305
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
306
+ if (ret[2]) {
307
+ throw takeFromExternrefTable0(ret[1]);
308
+ }
309
+ return takeFromExternrefTable0(ret[0]);
310
+ }
311
+
312
+ /**
313
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
314
+ *
315
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
316
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
317
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
318
+ * @param {Uint8Array} program
319
+ * @param {WitnessMap} solved_witness
320
+ * @returns {WitnessMap}
321
+ */
322
+ export function getPublicWitness(program, solved_witness) {
323
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
324
+ const len0 = WASM_VECTOR_LEN;
325
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
326
+ if (ret[2]) {
327
+ throw takeFromExternrefTable0(ret[1]);
328
+ }
329
+ return takeFromExternrefTable0(ret[0]);
330
+ }
331
+
341
332
  /**
342
333
  * Performs a bitwise AND operation between `lhs` and `rhs`
343
334
  * @param {string} lhs
@@ -397,6 +388,10 @@ export function sha256_compression(inputs, state) {
397
388
  return v3;
398
389
  }
399
390
 
391
+ function getArrayU8FromWasm0(ptr, len) {
392
+ ptr = ptr >>> 0;
393
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
394
+ }
400
395
  /**
401
396
  * Calculates the Blake2s256 hash of the input bytes
402
397
  * @param {Uint8Array} inputs
@@ -454,28 +449,32 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
454
449
  }
455
450
 
456
451
  /**
457
- * Returns the `BuildInfo` object containing information about how the installed package was built.
458
- * @returns {BuildInfo} - Information on how the installed package was built.
452
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
453
+ *
454
+ * @param {WitnessMap} witness_map - A witness map.
455
+ * @returns {Uint8Array} A compressed witness map
459
456
  */
460
- export function buildInfo() {
461
- const ret = wasm.buildInfo();
462
- return ret;
457
+ export function compressWitness(witness_map) {
458
+ const ret = wasm.compressWitness(witness_map);
459
+ if (ret[3]) {
460
+ throw takeFromExternrefTable0(ret[2]);
461
+ }
462
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
463
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
464
+ return v1;
463
465
  }
464
466
 
465
467
  /**
466
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
468
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
469
+ * This should be used to only fetch the witness map for the main function.
467
470
  *
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}
471
+ * @param {Uint8Array} compressed_witness - A compressed witness.
472
+ * @returns {WitnessMap} The decompressed witness map.
474
473
  */
475
- export function getReturnWitness(program, witness_map) {
476
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
474
+ export function decompressWitness(compressed_witness) {
475
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
477
476
  const len0 = WASM_VECTOR_LEN;
478
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
477
+ const ret = wasm.decompressWitness(ptr0, len0);
479
478
  if (ret[2]) {
480
479
  throw takeFromExternrefTable0(ret[1]);
481
480
  }
@@ -483,55 +482,56 @@ export function getReturnWitness(program, witness_map) {
483
482
  }
484
483
 
485
484
  /**
486
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
485
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
487
486
  *
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}
487
+ * @param {WitnessStack} witness_stack - A witness stack.
488
+ * @returns {Uint8Array} A compressed witness stack
494
489
  */
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]);
490
+ export function compressWitnessStack(witness_stack) {
491
+ const ret = wasm.compressWitnessStack(witness_stack);
492
+ if (ret[3]) {
493
+ throw takeFromExternrefTable0(ret[2]);
501
494
  }
502
- return takeFromExternrefTable0(ret[0]);
495
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
496
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
497
+ return v1;
503
498
  }
504
499
 
505
500
  /**
506
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
501
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
507
502
  *
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}
503
+ * @param {Uint8Array} compressed_witness - A compressed witness.
504
+ * @returns {WitnessStack} The decompressed witness stack.
514
505
  */
515
- export function getPublicWitness(program, solved_witness) {
516
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
506
+ export function decompressWitnessStack(compressed_witness) {
507
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
517
508
  const len0 = WASM_VECTOR_LEN;
518
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
509
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
519
510
  if (ret[2]) {
520
511
  throw takeFromExternrefTable0(ret[1]);
521
512
  }
522
513
  return takeFromExternrefTable0(ret[0]);
523
514
  }
524
515
 
516
+ /**
517
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
518
+ * @returns {BuildInfo} - Information on how the installed package was built.
519
+ */
520
+ export function buildInfo() {
521
+ const ret = wasm.buildInfo();
522
+ return ret;
523
+ }
524
+
525
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure571_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure490_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure1165_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure996_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure1169_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure1000_externref_shim(arg0, arg1, arg2, arg3);
535
535
  }
536
536
 
537
537
  async function __wbg_load(module, imports) {
@@ -580,11 +580,11 @@ function __wbg_get_imports() {
580
580
  const ret = arg0.call(arg1, arg2, arg3);
581
581
  return ret;
582
582
  }, arguments) };
583
- imports.wbg.__wbg_constructor_78d4b46bae4ee3a6 = function(arg0) {
583
+ imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
584
584
  const ret = new Error(arg0);
585
585
  return ret;
586
586
  };
587
- imports.wbg.__wbg_constructor_e15d65f40a39eb05 = function(arg0) {
587
+ imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
588
588
  const ret = new Error(arg0);
589
589
  return ret;
590
590
  };
@@ -697,16 +697,16 @@ function __wbg_get_imports() {
697
697
  const ret = new Error();
698
698
  return ret;
699
699
  };
700
- imports.wbg.__wbg_new_95a101145c23dc1d = function() {
701
- const ret = new Map();
700
+ imports.wbg.__wbg_new_9f501325818b4158 = function() {
701
+ const ret = new Array();
702
702
  return ret;
703
703
  };
704
704
  imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
705
705
  const ret = new Error(getStringFromWasm0(arg0, arg1));
706
706
  return ret;
707
707
  };
708
- imports.wbg.__wbg_new_d1312de2c48bf990 = function() {
709
- const ret = new Array();
708
+ imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
709
+ const ret = new Map();
710
710
  return ret;
711
711
  };
712
712
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
797
797
  const ret = false;
798
798
  return ret;
799
799
  };
800
- imports.wbg.__wbindgen_closure_wrapper1986 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 572, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1603 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 491, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -2,23 +2,23 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const initLogLevel: (a: number, b: number) => [number, number];
5
- export const compressWitness: (a: any) => [number, number, number, number];
6
- export const decompressWitness: (a: number, b: number) => [number, number, number];
7
- export const compressWitnessStack: (a: any) => [number, number, number, number];
8
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
9
5
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
10
6
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
11
7
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
8
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
9
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
10
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
12
11
  export const and: (a: any, b: any) => any;
13
12
  export const xor: (a: any, b: any) => any;
14
13
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
14
  export const blake2s256: (a: number, b: number) => [number, number];
16
15
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
16
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
+ export const compressWitness: (a: any) => [number, number, number, number];
18
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
19
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
20
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
18
21
  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 closure571_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1165_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1169_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure490_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure996_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1000_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;