@aztec/noir-acvm_js 4.0.0-nightly.20260113 → 4.0.0-nightly.20260115

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,11 +1,64 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Performs a bitwise AND operation between `lhs` and `rhs`
5
+ */
6
+ export function and(lhs: string, rhs: string): string;
7
+ /**
8
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
9
+ */
10
+ export function xor(lhs: string, rhs: string): string;
11
+ /**
12
+ * Sha256 compression function
13
+ */
14
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
15
+ /**
16
+ * Calculates the Blake2s256 hash of the input bytes
17
+ */
18
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
19
+ /**
20
+ * Verifies a ECDSA signature over the secp256k1 curve.
21
+ */
22
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
23
+ /**
24
+ * Verifies a ECDSA signature over the secp256r1 curve.
25
+ */
26
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
3
27
  /**
4
28
  * Sets the package's logging level.
5
29
  *
6
30
  * @param {LogLevel} level - The maximum level of logging to be emitted.
7
31
  */
8
32
  export function initLogLevel(filter: string): void;
33
+ /**
34
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
35
+ * @returns {BuildInfo} - Information on how the installed package was built.
36
+ */
37
+ export function buildInfo(): BuildInfo;
38
+ /**
39
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
40
+ *
41
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
42
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
43
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
44
+ */
45
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
46
+ /**
47
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
48
+ *
49
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
50
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
51
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
52
+ */
53
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
54
+ /**
55
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
56
+ *
57
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
58
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
59
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
60
+ */
61
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
9
62
  /**
10
63
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
11
64
  *
@@ -63,68 +116,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
63
116
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
64
117
  */
65
118
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
66
- /**
67
- * Performs a bitwise AND operation between `lhs` and `rhs`
68
- */
69
- export function and(lhs: string, rhs: string): string;
70
- /**
71
- * Performs a bitwise XOR operation between `lhs` and `rhs`
72
- */
73
- export function xor(lhs: string, rhs: string): string;
74
- /**
75
- * Sha256 compression function
76
- */
77
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
78
- /**
79
- * Calculates the Blake2s256 hash of the input bytes
80
- */
81
- export function blake2s256(inputs: Uint8Array): Uint8Array;
82
- /**
83
- * Verifies a ECDSA signature over the secp256k1 curve.
84
- */
85
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
86
- /**
87
- * Verifies a ECDSA signature over the secp256r1 curve.
88
- */
89
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
- /**
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.
93
- */
94
- export function buildInfo(): BuildInfo;
95
- /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
- *
98
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
99
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
100
- * @returns {WitnessMap} A witness map containing the circuit's return values.
101
- */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
103
- /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
105
- *
106
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
107
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
108
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
109
- */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
111
- /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
113
- *
114
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
- */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
-
120
- export type StackItem = {
121
- index: number;
122
- witness: WitnessMap;
123
- }
124
-
125
- export type WitnessStack = Array<StackItem>;
126
-
127
-
128
119
 
129
120
  export type RawAssertionPayload = {
130
121
  selector: string;
@@ -140,6 +131,15 @@ export type ExecutionError = Error & {
140
131
 
141
132
 
142
133
 
134
+ export type StackItem = {
135
+ index: number;
136
+ witness: WitnessMap;
137
+ }
138
+
139
+ export type WitnessStack = Array<StackItem>;
140
+
141
+
142
+
143
143
  // Map from witness index to hex string value of witness.
144
144
  export type WitnessMap = Map<number, string>;
145
145
 
@@ -155,20 +155,6 @@ export type SolvedAndReturnWitness = {
155
155
 
156
156
 
157
157
 
158
- export type ForeignCallInput = string[]
159
- export type ForeignCallOutput = string | string[]
160
-
161
- /**
162
- * A callback which performs an foreign call and returns the response.
163
- * @callback ForeignCallHandler
164
- * @param {string} name - The identifier for the type of foreign call being performed.
165
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
166
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
167
- */
168
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
169
-
170
-
171
-
172
158
  /**
173
159
  * @typedef {Object} BuildInfo - Information about how the installed package was built
174
160
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -182,3 +168,17 @@ export type BuildInfo = {
182
168
  }
183
169
 
184
170
 
171
+
172
+ export type ForeignCallInput = string[]
173
+ export type ForeignCallOutput = string | string[]
174
+
175
+ /**
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[]>;
183
+
184
+
package/nodejs/acvm_js.js CHANGED
@@ -201,147 +201,6 @@ function debugString(val) {
201
201
  // TODO we could test for more things here, like `Set`s and `Map`s.
202
202
  return className;
203
203
  }
204
-
205
- function takeFromExternrefTable0(idx) {
206
- const value = wasm.__wbindgen_export_2.get(idx);
207
- wasm.__externref_table_dealloc(idx);
208
- return value;
209
- }
210
- /**
211
- * Sets the package's logging level.
212
- *
213
- * @param {LogLevel} level - The maximum level of logging to be emitted.
214
- */
215
- module.exports.initLogLevel = function(filter) {
216
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
217
- const len0 = WASM_VECTOR_LEN;
218
- const ret = wasm.initLogLevel(ptr0, len0);
219
- if (ret[1]) {
220
- throw takeFromExternrefTable0(ret[0]);
221
- }
222
- };
223
-
224
- function 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
- function passArray8ToWasm0(arg, malloc) {
245
- const ptr = malloc(arg.length * 1, 1) >>> 0;
246
- getUint8ArrayMemory0().set(arg, ptr / 1);
247
- WASM_VECTOR_LEN = arg.length;
248
- return ptr;
249
- }
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
- /**
300
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
301
- *
302
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
303
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
304
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
305
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
306
- */
307
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
308
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
309
- const len0 = WASM_VECTOR_LEN;
310
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
311
- return ret;
312
- };
313
-
314
- /**
315
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
316
- * This method also extracts the public return values from the solved witness into its own return witness.
317
- *
318
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
319
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
320
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
321
- * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
322
- */
323
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
324
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
325
- const len0 = WASM_VECTOR_LEN;
326
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
327
- return ret;
328
- };
329
-
330
- /**
331
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
332
- *
333
- * @param {Uint8Array} program - A serialized representation of an ACIR program
334
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
335
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
336
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
337
- */
338
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
339
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
340
- const len0 = WASM_VECTOR_LEN;
341
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
342
- return ret;
343
- };
344
-
345
204
  /**
346
205
  * Performs a bitwise AND operation between `lhs` and `rhs`
347
206
  * @param {string} lhs
@@ -401,6 +260,17 @@ module.exports.sha256_compression = function(inputs, state) {
401
260
  return v3;
402
261
  };
403
262
 
263
+ function passArray8ToWasm0(arg, malloc) {
264
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
265
+ getUint8ArrayMemory0().set(arg, ptr / 1);
266
+ WASM_VECTOR_LEN = arg.length;
267
+ return ptr;
268
+ }
269
+
270
+ function getArrayU8FromWasm0(ptr, len) {
271
+ ptr = ptr >>> 0;
272
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
273
+ }
404
274
  /**
405
275
  * Calculates the Blake2s256 hash of the input bytes
406
276
  * @param {Uint8Array} inputs
@@ -457,6 +327,25 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
457
327
  return ret !== 0;
458
328
  };
459
329
 
330
+ function takeFromExternrefTable0(idx) {
331
+ const value = wasm.__wbindgen_export_2.get(idx);
332
+ wasm.__externref_table_dealloc(idx);
333
+ return value;
334
+ }
335
+ /**
336
+ * Sets the package's logging level.
337
+ *
338
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
339
+ */
340
+ module.exports.initLogLevel = function(filter) {
341
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
342
+ const len0 = WASM_VECTOR_LEN;
343
+ const ret = wasm.initLogLevel(ptr0, len0);
344
+ if (ret[1]) {
345
+ throw takeFromExternrefTable0(ret[0]);
346
+ }
347
+ };
348
+
460
349
  /**
461
350
  * Returns the `BuildInfo` object containing information about how the installed package was built.
462
351
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -526,16 +415,127 @@ module.exports.getPublicWitness = function(program, solved_witness) {
526
415
  return takeFromExternrefTable0(ret[0]);
527
416
  };
528
417
 
418
+ /**
419
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
420
+ *
421
+ * @param {WitnessMap} witness_map - A witness map.
422
+ * @returns {Uint8Array} A compressed witness map
423
+ */
424
+ module.exports.compressWitness = function(witness_map) {
425
+ const ret = wasm.compressWitness(witness_map);
426
+ if (ret[3]) {
427
+ throw takeFromExternrefTable0(ret[2]);
428
+ }
429
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
430
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
431
+ return v1;
432
+ };
433
+
434
+ /**
435
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
436
+ * This should be used to only fetch the witness map for the main function.
437
+ *
438
+ * @param {Uint8Array} compressed_witness - A compressed witness.
439
+ * @returns {WitnessMap} The decompressed witness map.
440
+ */
441
+ module.exports.decompressWitness = function(compressed_witness) {
442
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
443
+ const len0 = WASM_VECTOR_LEN;
444
+ const ret = wasm.decompressWitness(ptr0, len0);
445
+ if (ret[2]) {
446
+ throw takeFromExternrefTable0(ret[1]);
447
+ }
448
+ return takeFromExternrefTable0(ret[0]);
449
+ };
450
+
451
+ /**
452
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
453
+ *
454
+ * @param {WitnessStack} witness_stack - A witness stack.
455
+ * @returns {Uint8Array} A compressed witness stack
456
+ */
457
+ module.exports.compressWitnessStack = function(witness_stack) {
458
+ const ret = wasm.compressWitnessStack(witness_stack);
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;
465
+ };
466
+
467
+ /**
468
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
469
+ *
470
+ * @param {Uint8Array} compressed_witness - A compressed witness.
471
+ * @returns {WitnessStack} The decompressed witness stack.
472
+ */
473
+ module.exports.decompressWitnessStack = function(compressed_witness) {
474
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
475
+ const len0 = WASM_VECTOR_LEN;
476
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
477
+ if (ret[2]) {
478
+ throw takeFromExternrefTable0(ret[1]);
479
+ }
480
+ return takeFromExternrefTable0(ret[0]);
481
+ };
482
+
483
+ /**
484
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
485
+ *
486
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
487
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
488
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
489
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
490
+ */
491
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
492
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
493
+ const len0 = WASM_VECTOR_LEN;
494
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
495
+ return ret;
496
+ };
497
+
498
+ /**
499
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
500
+ * This method also extracts the public return values from the solved witness into its own return witness.
501
+ *
502
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
503
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
504
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
505
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
506
+ */
507
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
508
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
509
+ const len0 = WASM_VECTOR_LEN;
510
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
511
+ return ret;
512
+ };
513
+
514
+ /**
515
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
516
+ *
517
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
518
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
519
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
520
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
521
+ */
522
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
523
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
524
+ const len0 = WASM_VECTOR_LEN;
525
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
526
+ return ret;
527
+ };
528
+
529
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure444_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure441_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure928_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure925_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure929_externref_shim(arg0, arg1, arg2, arg3);
539
539
  }
540
540
 
541
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
813
  return ret;
814
814
  };
815
815
 
816
- module.exports.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 445, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1431 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 442, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const 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
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
10
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
11
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
12
4
  export const and: (a: any, b: any) => any;
13
5
  export const xor: (a: any, b: any) => any;
14
6
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
7
  export const blake2s256: (a: number, b: number) => [number, number];
16
8
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
9
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
+ export const initLogLevel: (a: number, b: number) => [number, number];
18
11
  export const buildInfo: () => any;
19
12
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
13
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
14
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
15
+ export const compressWitness: (a: any) => [number, number, number, number];
16
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
17
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
18
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
19
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
20
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
21
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure444_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure928_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure932_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure441_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure925_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure929_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.20260113",
3
+ "version": "4.0.0-nightly.20260115",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,11 +1,64 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Performs a bitwise AND operation between `lhs` and `rhs`
5
+ */
6
+ export function and(lhs: string, rhs: string): string;
7
+ /**
8
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
9
+ */
10
+ export function xor(lhs: string, rhs: string): string;
11
+ /**
12
+ * Sha256 compression function
13
+ */
14
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
15
+ /**
16
+ * Calculates the Blake2s256 hash of the input bytes
17
+ */
18
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
19
+ /**
20
+ * Verifies a ECDSA signature over the secp256k1 curve.
21
+ */
22
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
23
+ /**
24
+ * Verifies a ECDSA signature over the secp256r1 curve.
25
+ */
26
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
3
27
  /**
4
28
  * Sets the package's logging level.
5
29
  *
6
30
  * @param {LogLevel} level - The maximum level of logging to be emitted.
7
31
  */
8
32
  export function initLogLevel(filter: string): void;
33
+ /**
34
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
35
+ * @returns {BuildInfo} - Information on how the installed package was built.
36
+ */
37
+ export function buildInfo(): BuildInfo;
38
+ /**
39
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
40
+ *
41
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
42
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
43
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
44
+ */
45
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
46
+ /**
47
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
48
+ *
49
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
50
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
51
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
52
+ */
53
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
54
+ /**
55
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
56
+ *
57
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
58
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
59
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
60
+ */
61
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
9
62
  /**
10
63
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
11
64
  *
@@ -63,68 +116,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
63
116
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
64
117
  */
65
118
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
66
- /**
67
- * Performs a bitwise AND operation between `lhs` and `rhs`
68
- */
69
- export function and(lhs: string, rhs: string): string;
70
- /**
71
- * Performs a bitwise XOR operation between `lhs` and `rhs`
72
- */
73
- export function xor(lhs: string, rhs: string): string;
74
- /**
75
- * Sha256 compression function
76
- */
77
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
78
- /**
79
- * Calculates the Blake2s256 hash of the input bytes
80
- */
81
- export function blake2s256(inputs: Uint8Array): Uint8Array;
82
- /**
83
- * Verifies a ECDSA signature over the secp256k1 curve.
84
- */
85
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
86
- /**
87
- * Verifies a ECDSA signature over the secp256r1 curve.
88
- */
89
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
90
- /**
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.
93
- */
94
- export function buildInfo(): BuildInfo;
95
- /**
96
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
- *
98
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
99
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
100
- * @returns {WitnessMap} A witness map containing the circuit's return values.
101
- */
102
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
103
- /**
104
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
105
- *
106
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
107
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
108
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
109
- */
110
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
111
- /**
112
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
113
- *
114
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
- */
118
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
-
120
- export type StackItem = {
121
- index: number;
122
- witness: WitnessMap;
123
- }
124
-
125
- export type WitnessStack = Array<StackItem>;
126
-
127
-
128
119
 
129
120
  export type RawAssertionPayload = {
130
121
  selector: string;
@@ -140,6 +131,15 @@ export type ExecutionError = Error & {
140
131
 
141
132
 
142
133
 
134
+ export type StackItem = {
135
+ index: number;
136
+ witness: WitnessMap;
137
+ }
138
+
139
+ export type WitnessStack = Array<StackItem>;
140
+
141
+
142
+
143
143
  // Map from witness index to hex string value of witness.
144
144
  export type WitnessMap = Map<number, string>;
145
145
 
@@ -155,20 +155,6 @@ export type SolvedAndReturnWitness = {
155
155
 
156
156
 
157
157
 
158
- export type ForeignCallInput = string[]
159
- export type ForeignCallOutput = string | string[]
160
-
161
- /**
162
- * A callback which performs an foreign call and returns the response.
163
- * @callback ForeignCallHandler
164
- * @param {string} name - The identifier for the type of foreign call being performed.
165
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
166
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
167
- */
168
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
169
-
170
-
171
-
172
158
  /**
173
159
  * @typedef {Object} BuildInfo - Information about how the installed package was built
174
160
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -183,28 +169,42 @@ export type BuildInfo = {
183
169
 
184
170
 
185
171
 
172
+ export type ForeignCallInput = string[]
173
+ export type ForeignCallOutput = string | string[]
174
+
175
+ /**
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[]>;
183
+
184
+
185
+
186
186
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
- readonly 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
- readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
196
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
197
- readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
198
190
  readonly and: (a: any, b: any) => any;
199
191
  readonly xor: (a: any, b: any) => any;
200
192
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
201
193
  readonly blake2s256: (a: number, b: number) => [number, number];
202
194
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
195
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
196
+ readonly initLogLevel: (a: number, b: number) => [number, number];
204
197
  readonly buildInfo: () => any;
205
198
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
206
199
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
207
200
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
201
+ readonly compressWitness: (a: any) => [number, number, number, number];
202
+ readonly decompressWitness: (a: number, b: number) => [number, number, number];
203
+ readonly compressWitnessStack: (a: any) => [number, number, number, number];
204
+ readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
205
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
206
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
207
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
208
208
  readonly __wbindgen_exn_store: (a: number) => void;
209
209
  readonly __externref_table_alloc: () => number;
210
210
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -213,9 +213,9 @@ export interface InitOutput {
213
213
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
214
214
  readonly __wbindgen_export_6: WebAssembly.Table;
215
215
  readonly __externref_table_dealloc: (a: number) => void;
216
- readonly closure444_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure928_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure932_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure441_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure925_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure929_externref_shim: (a: number, b: number, c: any, d: any) => void;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -197,147 +197,6 @@ function debugString(val) {
197
197
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
198
  return className;
199
199
  }
200
-
201
- function takeFromExternrefTable0(idx) {
202
- const value = wasm.__wbindgen_export_2.get(idx);
203
- wasm.__externref_table_dealloc(idx);
204
- return value;
205
- }
206
- /**
207
- * Sets the package's logging level.
208
- *
209
- * @param {LogLevel} level - The maximum level of logging to be emitted.
210
- */
211
- export function initLogLevel(filter) {
212
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
213
- const len0 = WASM_VECTOR_LEN;
214
- const ret = wasm.initLogLevel(ptr0, len0);
215
- if (ret[1]) {
216
- throw takeFromExternrefTable0(ret[0]);
217
- }
218
- }
219
-
220
- function 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
- function passArray8ToWasm0(arg, malloc) {
241
- const ptr = malloc(arg.length * 1, 1) >>> 0;
242
- getUint8ArrayMemory0().set(arg, ptr / 1);
243
- WASM_VECTOR_LEN = arg.length;
244
- return ptr;
245
- }
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
- /**
296
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
297
- *
298
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
299
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
300
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
301
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
302
- */
303
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
304
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
305
- const len0 = WASM_VECTOR_LEN;
306
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
307
- return ret;
308
- }
309
-
310
- /**
311
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
312
- * This method also extracts the public return values from the solved witness into its own return witness.
313
- *
314
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
315
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
316
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
317
- * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
318
- */
319
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
320
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
321
- const len0 = WASM_VECTOR_LEN;
322
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
323
- return ret;
324
- }
325
-
326
- /**
327
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
328
- *
329
- * @param {Uint8Array} program - A serialized representation of an ACIR program
330
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
331
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
332
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
333
- */
334
- export function executeProgram(program, initial_witness, foreign_call_handler) {
335
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
336
- const len0 = WASM_VECTOR_LEN;
337
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
338
- return ret;
339
- }
340
-
341
200
  /**
342
201
  * Performs a bitwise AND operation between `lhs` and `rhs`
343
202
  * @param {string} lhs
@@ -397,6 +256,17 @@ export function sha256_compression(inputs, state) {
397
256
  return v3;
398
257
  }
399
258
 
259
+ function passArray8ToWasm0(arg, malloc) {
260
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
261
+ getUint8ArrayMemory0().set(arg, ptr / 1);
262
+ WASM_VECTOR_LEN = arg.length;
263
+ return ptr;
264
+ }
265
+
266
+ function getArrayU8FromWasm0(ptr, len) {
267
+ ptr = ptr >>> 0;
268
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
269
+ }
400
270
  /**
401
271
  * Calculates the Blake2s256 hash of the input bytes
402
272
  * @param {Uint8Array} inputs
@@ -453,6 +323,25 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
453
323
  return ret !== 0;
454
324
  }
455
325
 
326
+ function takeFromExternrefTable0(idx) {
327
+ const value = wasm.__wbindgen_export_2.get(idx);
328
+ wasm.__externref_table_dealloc(idx);
329
+ return value;
330
+ }
331
+ /**
332
+ * Sets the package's logging level.
333
+ *
334
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
335
+ */
336
+ export function initLogLevel(filter) {
337
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
338
+ const len0 = WASM_VECTOR_LEN;
339
+ const ret = wasm.initLogLevel(ptr0, len0);
340
+ if (ret[1]) {
341
+ throw takeFromExternrefTable0(ret[0]);
342
+ }
343
+ }
344
+
456
345
  /**
457
346
  * Returns the `BuildInfo` object containing information about how the installed package was built.
458
347
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -522,16 +411,127 @@ export function getPublicWitness(program, solved_witness) {
522
411
  return takeFromExternrefTable0(ret[0]);
523
412
  }
524
413
 
414
+ /**
415
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
416
+ *
417
+ * @param {WitnessMap} witness_map - A witness map.
418
+ * @returns {Uint8Array} A compressed witness map
419
+ */
420
+ export function compressWitness(witness_map) {
421
+ const ret = wasm.compressWitness(witness_map);
422
+ if (ret[3]) {
423
+ throw takeFromExternrefTable0(ret[2]);
424
+ }
425
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
426
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
427
+ return v1;
428
+ }
429
+
430
+ /**
431
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
432
+ * This should be used to only fetch the witness map for the main function.
433
+ *
434
+ * @param {Uint8Array} compressed_witness - A compressed witness.
435
+ * @returns {WitnessMap} The decompressed witness map.
436
+ */
437
+ export function decompressWitness(compressed_witness) {
438
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
439
+ const len0 = WASM_VECTOR_LEN;
440
+ const ret = wasm.decompressWitness(ptr0, len0);
441
+ if (ret[2]) {
442
+ throw takeFromExternrefTable0(ret[1]);
443
+ }
444
+ return takeFromExternrefTable0(ret[0]);
445
+ }
446
+
447
+ /**
448
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
449
+ *
450
+ * @param {WitnessStack} witness_stack - A witness stack.
451
+ * @returns {Uint8Array} A compressed witness stack
452
+ */
453
+ export function compressWitnessStack(witness_stack) {
454
+ const ret = wasm.compressWitnessStack(witness_stack);
455
+ if (ret[3]) {
456
+ throw takeFromExternrefTable0(ret[2]);
457
+ }
458
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
459
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
460
+ return v1;
461
+ }
462
+
463
+ /**
464
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
465
+ *
466
+ * @param {Uint8Array} compressed_witness - A compressed witness.
467
+ * @returns {WitnessStack} The decompressed witness stack.
468
+ */
469
+ export function decompressWitnessStack(compressed_witness) {
470
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
471
+ const len0 = WASM_VECTOR_LEN;
472
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
473
+ if (ret[2]) {
474
+ throw takeFromExternrefTable0(ret[1]);
475
+ }
476
+ return takeFromExternrefTable0(ret[0]);
477
+ }
478
+
479
+ /**
480
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
481
+ *
482
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
483
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
484
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
485
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
486
+ */
487
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
488
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
489
+ const len0 = WASM_VECTOR_LEN;
490
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
491
+ return ret;
492
+ }
493
+
494
+ /**
495
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
496
+ * This method also extracts the public return values from the solved witness into its own return witness.
497
+ *
498
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
499
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
500
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
501
+ * @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
502
+ */
503
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
504
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
505
+ const len0 = WASM_VECTOR_LEN;
506
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
507
+ return ret;
508
+ }
509
+
510
+ /**
511
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
512
+ *
513
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
514
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
515
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
516
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
517
+ */
518
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
519
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
520
+ const len0 = WASM_VECTOR_LEN;
521
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
522
+ return ret;
523
+ }
524
+
525
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure444_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure441_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure928_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure925_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure932_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure929_externref_shim(arg0, arg1, arg2, arg3);
535
535
  }
536
536
 
537
537
  async function __wbg_load(module, imports) {
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
797
797
  const ret = false;
798
798
  return ret;
799
799
  };
800
- imports.wbg.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 445, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1431 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 442, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,24 +1,24 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const 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
- export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
10
- export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
11
- export const executeProgram: (a: number, b: number, c: any, d: any) => any;
12
4
  export const and: (a: any, b: any) => any;
13
5
  export const xor: (a: any, b: any) => any;
14
6
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
15
7
  export const blake2s256: (a: number, b: number) => [number, number];
16
8
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
9
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
+ export const initLogLevel: (a: number, b: number) => [number, number];
18
11
  export const buildInfo: () => any;
19
12
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
13
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
14
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
15
+ export const compressWitness: (a: any) => [number, number, number, number];
16
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
17
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
18
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
19
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
20
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
21
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure444_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure928_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure932_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure441_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure925_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure929_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;