@aztec/noir-acvm_js 4.0.0-nightly.20260119 → 4.0.0-nightly.20260121

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,64 +1,38 @@
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;
27
- /**
28
- * Sets the package's logging level.
29
- *
30
- * @param {LogLevel} level - The maximum level of logging to be emitted.
31
- */
32
- export function initLogLevel(filter: string): void;
33
3
  /**
34
4
  * Returns the `BuildInfo` object containing information about how the installed package was built.
35
5
  * @returns {BuildInfo} - Information on how the installed package was built.
36
6
  */
37
7
  export function buildInfo(): BuildInfo;
38
8
  /**
39
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
9
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
40
10
  *
41
11
  * @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.
12
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
13
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
14
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
44
15
  */
45
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
16
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
46
17
  /**
47
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
18
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
19
+ * This method also extracts the public return values from the solved witness into its own return witness.
48
20
  *
49
21
  * @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.
22
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
23
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
24
+ * @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.
52
25
  */
53
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
26
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
54
27
  /**
55
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
28
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
56
29
  *
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.
30
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
31
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
32
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
33
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
60
34
  */
61
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
35
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
62
36
  /**
63
37
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
64
38
  *
@@ -89,33 +63,82 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
89
63
  */
90
64
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
91
65
  /**
92
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
66
+ * Performs a bitwise AND operation between `lhs` and `rhs`
67
+ */
68
+ export function and(lhs: string, rhs: string): string;
69
+ /**
70
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
71
+ */
72
+ export function xor(lhs: string, rhs: string): string;
73
+ /**
74
+ * Sha256 compression function
75
+ */
76
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
77
+ /**
78
+ * Calculates the Blake2s256 hash of the input bytes
79
+ */
80
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
81
+ /**
82
+ * Verifies a ECDSA signature over the secp256k1 curve.
83
+ */
84
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
85
+ /**
86
+ * Verifies a ECDSA signature over the secp256r1 curve.
87
+ */
88
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
89
+ /**
90
+ * Sets the package's logging level.
91
+ *
92
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
93
+ */
94
+ export function initLogLevel(filter: string): void;
95
+ /**
96
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
93
97
  *
94
98
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
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.
98
101
  */
99
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
102
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
100
103
  /**
101
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
- * This method also extracts the public return values from the solved witness into its own return witness.
104
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
103
105
  *
104
106
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
- * @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.
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.
108
109
  */
109
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
110
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
110
111
  /**
111
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
112
113
  *
113
- * @param {Uint8Array} program - A serialized representation of an ACIR program
114
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
114
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
117
  */
118
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
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
+
129
+ /**
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.
134
+ */
135
+ export type BuildInfo = {
136
+ gitHash: string;
137
+ version: string;
138
+ dirty: string;
139
+ }
140
+
141
+
119
142
 
120
143
  export type RawAssertionPayload = {
121
144
  selector: string;
@@ -131,15 +154,6 @@ export type ExecutionError = Error & {
131
154
 
132
155
 
133
156
 
134
- export type StackItem = {
135
- index: number;
136
- witness: WitnessMap;
137
- }
138
-
139
- export type WitnessStack = Array<StackItem>;
140
-
141
-
142
-
143
157
  // Map from witness index to hex string value of witness.
144
158
  export type WitnessMap = Map<number, string>;
145
159
 
@@ -155,20 +169,6 @@ export type SolvedAndReturnWitness = {
155
169
 
156
170
 
157
171
 
158
- /**
159
- * @typedef {Object} BuildInfo - Information about how the installed package was built
160
- * @property {string} gitHash - The hash of the git commit from which the package was built.
161
- * @property {string} version - The version of the package at the built git commit.
162
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
163
- */
164
- export type BuildInfo = {
165
- gitHash: string;
166
- version: string;
167
- dirty: string;
168
- }
169
-
170
-
171
-
172
172
  export type ForeignCallInput = string[]
173
173
  export type ForeignCallOutput = string | string[]
174
174
 
package/nodejs/acvm_js.js CHANGED
@@ -201,6 +201,142 @@ 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
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
206
+ * @returns {BuildInfo} - Information on how the installed package was built.
207
+ */
208
+ module.exports.buildInfo = function() {
209
+ const ret = wasm.buildInfo();
210
+ return ret;
211
+ };
212
+
213
+ function passArray8ToWasm0(arg, malloc) {
214
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
215
+ getUint8ArrayMemory0().set(arg, ptr / 1);
216
+ WASM_VECTOR_LEN = arg.length;
217
+ return ptr;
218
+ }
219
+ /**
220
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
221
+ *
222
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
223
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
224
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
225
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
226
+ */
227
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
228
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
229
+ const len0 = WASM_VECTOR_LEN;
230
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
231
+ return ret;
232
+ };
233
+
234
+ /**
235
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
236
+ * This method also extracts the public return values from the solved witness into its own return witness.
237
+ *
238
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
239
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
240
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
241
+ * @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.
242
+ */
243
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
244
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
245
+ const len0 = WASM_VECTOR_LEN;
246
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
247
+ return ret;
248
+ };
249
+
250
+ /**
251
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
252
+ *
253
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
254
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
255
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
256
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
257
+ */
258
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
259
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
260
+ const len0 = WASM_VECTOR_LEN;
261
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
262
+ return ret;
263
+ };
264
+
265
+ function takeFromExternrefTable0(idx) {
266
+ const value = wasm.__wbindgen_export_2.get(idx);
267
+ wasm.__externref_table_dealloc(idx);
268
+ return value;
269
+ }
270
+
271
+ function getArrayU8FromWasm0(ptr, len) {
272
+ ptr = ptr >>> 0;
273
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
274
+ }
275
+ /**
276
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
277
+ *
278
+ * @param {WitnessMap} witness_map - A witness map.
279
+ * @returns {Uint8Array} A compressed witness map
280
+ */
281
+ module.exports.compressWitness = function(witness_map) {
282
+ const ret = wasm.compressWitness(witness_map);
283
+ if (ret[3]) {
284
+ throw takeFromExternrefTable0(ret[2]);
285
+ }
286
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
287
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
288
+ return v1;
289
+ };
290
+
291
+ /**
292
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
293
+ * This should be used to only fetch the witness map for the main function.
294
+ *
295
+ * @param {Uint8Array} compressed_witness - A compressed witness.
296
+ * @returns {WitnessMap} The decompressed witness map.
297
+ */
298
+ module.exports.decompressWitness = function(compressed_witness) {
299
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
300
+ const len0 = WASM_VECTOR_LEN;
301
+ const ret = wasm.decompressWitness(ptr0, len0);
302
+ if (ret[2]) {
303
+ throw takeFromExternrefTable0(ret[1]);
304
+ }
305
+ return takeFromExternrefTable0(ret[0]);
306
+ };
307
+
308
+ /**
309
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
310
+ *
311
+ * @param {WitnessStack} witness_stack - A witness stack.
312
+ * @returns {Uint8Array} A compressed witness stack
313
+ */
314
+ module.exports.compressWitnessStack = function(witness_stack) {
315
+ const ret = wasm.compressWitnessStack(witness_stack);
316
+ if (ret[3]) {
317
+ throw takeFromExternrefTable0(ret[2]);
318
+ }
319
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
320
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
321
+ return v1;
322
+ };
323
+
324
+ /**
325
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
326
+ *
327
+ * @param {Uint8Array} compressed_witness - A compressed witness.
328
+ * @returns {WitnessStack} The decompressed witness stack.
329
+ */
330
+ module.exports.decompressWitnessStack = function(compressed_witness) {
331
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
332
+ const len0 = WASM_VECTOR_LEN;
333
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
334
+ if (ret[2]) {
335
+ throw takeFromExternrefTable0(ret[1]);
336
+ }
337
+ return takeFromExternrefTable0(ret[0]);
338
+ };
339
+
204
340
  /**
205
341
  * Performs a bitwise AND operation between `lhs` and `rhs`
206
342
  * @param {string} lhs
@@ -260,17 +396,6 @@ module.exports.sha256_compression = function(inputs, state) {
260
396
  return v3;
261
397
  };
262
398
 
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
- }
274
399
  /**
275
400
  * Calculates the Blake2s256 hash of the input bytes
276
401
  * @param {Uint8Array} inputs
@@ -327,11 +452,6 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
327
452
  return ret !== 0;
328
453
  };
329
454
 
330
- function takeFromExternrefTable0(idx) {
331
- const value = wasm.__wbindgen_export_2.get(idx);
332
- wasm.__externref_table_dealloc(idx);
333
- return value;
334
- }
335
455
  /**
336
456
  * Sets the package's logging level.
337
457
  *
@@ -346,15 +466,6 @@ module.exports.initLogLevel = function(filter) {
346
466
  }
347
467
  };
348
468
 
349
- /**
350
- * Returns the `BuildInfo` object containing information about how the installed package was built.
351
- * @returns {BuildInfo} - Information on how the installed package was built.
352
- */
353
- module.exports.buildInfo = function() {
354
- const ret = wasm.buildInfo();
355
- return ret;
356
- };
357
-
358
469
  /**
359
470
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
360
471
  *
@@ -415,127 +526,16 @@ module.exports.getPublicWitness = function(program, solved_witness) {
415
526
  return takeFromExternrefTable0(ret[0]);
416
527
  };
417
528
 
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.closure441_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure447_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure925_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure929_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure936_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_wrapper1431 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 442, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -1,6 +1,14 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const buildInfo: () => any;
5
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
6
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
7
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
8
+ export const compressWitness: (a: any) => [number, number, number, number];
9
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
10
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
11
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
4
12
  export const and: (a: any, b: any) => any;
5
13
  export const xor: (a: any, b: any) => any;
6
14
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
@@ -8,17 +16,9 @@ export const blake2s256: (a: number, b: number) => [number, number];
8
16
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
9
17
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
18
  export const initLogLevel: (a: number, b: number) => [number, number];
11
- export const buildInfo: () => any;
12
19
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
13
20
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
14
21
  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 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;
30
+ export const closure447_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
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.20260119",
3
+ "version": "4.0.0-nightly.20260121",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,64 +1,38 @@
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;
27
- /**
28
- * Sets the package's logging level.
29
- *
30
- * @param {LogLevel} level - The maximum level of logging to be emitted.
31
- */
32
- export function initLogLevel(filter: string): void;
33
3
  /**
34
4
  * Returns the `BuildInfo` object containing information about how the installed package was built.
35
5
  * @returns {BuildInfo} - Information on how the installed package was built.
36
6
  */
37
7
  export function buildInfo(): BuildInfo;
38
8
  /**
39
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
9
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
40
10
  *
41
11
  * @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.
12
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
13
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
14
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
44
15
  */
45
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
16
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
46
17
  /**
47
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
18
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
19
+ * This method also extracts the public return values from the solved witness into its own return witness.
48
20
  *
49
21
  * @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.
22
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
23
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
24
+ * @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.
52
25
  */
53
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
26
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
54
27
  /**
55
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
28
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
56
29
  *
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.
30
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
31
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
32
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
33
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
60
34
  */
61
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
35
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
62
36
  /**
63
37
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
64
38
  *
@@ -89,33 +63,82 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
89
63
  */
90
64
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
91
65
  /**
92
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
66
+ * Performs a bitwise AND operation between `lhs` and `rhs`
67
+ */
68
+ export function and(lhs: string, rhs: string): string;
69
+ /**
70
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
71
+ */
72
+ export function xor(lhs: string, rhs: string): string;
73
+ /**
74
+ * Sha256 compression function
75
+ */
76
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
77
+ /**
78
+ * Calculates the Blake2s256 hash of the input bytes
79
+ */
80
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
81
+ /**
82
+ * Verifies a ECDSA signature over the secp256k1 curve.
83
+ */
84
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
85
+ /**
86
+ * Verifies a ECDSA signature over the secp256r1 curve.
87
+ */
88
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
89
+ /**
90
+ * Sets the package's logging level.
91
+ *
92
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
93
+ */
94
+ export function initLogLevel(filter: string): void;
95
+ /**
96
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
93
97
  *
94
98
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
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.
98
101
  */
99
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
102
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
100
103
  /**
101
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
- * This method also extracts the public return values from the solved witness into its own return witness.
104
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
103
105
  *
104
106
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
- * @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.
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.
108
109
  */
109
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
110
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
110
111
  /**
111
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
112
113
  *
113
- * @param {Uint8Array} program - A serialized representation of an ACIR program
114
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
114
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
115
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
116
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
117
  */
118
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
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
+
129
+ /**
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.
134
+ */
135
+ export type BuildInfo = {
136
+ gitHash: string;
137
+ version: string;
138
+ dirty: string;
139
+ }
140
+
141
+
119
142
 
120
143
  export type RawAssertionPayload = {
121
144
  selector: string;
@@ -131,15 +154,6 @@ export type ExecutionError = Error & {
131
154
 
132
155
 
133
156
 
134
- export type StackItem = {
135
- index: number;
136
- witness: WitnessMap;
137
- }
138
-
139
- export type WitnessStack = Array<StackItem>;
140
-
141
-
142
-
143
157
  // Map from witness index to hex string value of witness.
144
158
  export type WitnessMap = Map<number, string>;
145
159
 
@@ -155,20 +169,6 @@ export type SolvedAndReturnWitness = {
155
169
 
156
170
 
157
171
 
158
- /**
159
- * @typedef {Object} BuildInfo - Information about how the installed package was built
160
- * @property {string} gitHash - The hash of the git commit from which the package was built.
161
- * @property {string} version - The version of the package at the built git commit.
162
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
163
- */
164
- export type BuildInfo = {
165
- gitHash: string;
166
- version: string;
167
- dirty: string;
168
- }
169
-
170
-
171
-
172
172
  export type ForeignCallInput = string[]
173
173
  export type ForeignCallOutput = string | string[]
174
174
 
@@ -187,6 +187,14 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
+ readonly buildInfo: () => any;
191
+ readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
192
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
193
+ readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
194
+ readonly compressWitness: (a: any) => [number, number, number, number];
195
+ readonly decompressWitness: (a: number, b: number) => [number, number, number];
196
+ readonly compressWitnessStack: (a: any) => [number, number, number, number];
197
+ readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
190
198
  readonly and: (a: any, b: any) => any;
191
199
  readonly xor: (a: any, b: any) => any;
192
200
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
@@ -194,17 +202,9 @@ export interface InitOutput {
194
202
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
195
203
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
196
204
  readonly initLogLevel: (a: number, b: number) => [number, number];
197
- readonly buildInfo: () => any;
198
205
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
199
206
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
200
207
  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 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;
216
+ readonly closure447_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -197,6 +197,142 @@ 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
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
202
+ * @returns {BuildInfo} - Information on how the installed package was built.
203
+ */
204
+ export function buildInfo() {
205
+ const ret = wasm.buildInfo();
206
+ return ret;
207
+ }
208
+
209
+ function passArray8ToWasm0(arg, malloc) {
210
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
211
+ getUint8ArrayMemory0().set(arg, ptr / 1);
212
+ WASM_VECTOR_LEN = arg.length;
213
+ return ptr;
214
+ }
215
+ /**
216
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
217
+ *
218
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
219
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
220
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
221
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
222
+ */
223
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
224
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
225
+ const len0 = WASM_VECTOR_LEN;
226
+ const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
227
+ return ret;
228
+ }
229
+
230
+ /**
231
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
232
+ * This method also extracts the public return values from the solved witness into its own return witness.
233
+ *
234
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
235
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
236
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
237
+ * @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.
238
+ */
239
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
240
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
241
+ const len0 = WASM_VECTOR_LEN;
242
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
243
+ return ret;
244
+ }
245
+
246
+ /**
247
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
248
+ *
249
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
250
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
251
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
252
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
253
+ */
254
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
255
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
256
+ const len0 = WASM_VECTOR_LEN;
257
+ const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
258
+ return ret;
259
+ }
260
+
261
+ function takeFromExternrefTable0(idx) {
262
+ const value = wasm.__wbindgen_export_2.get(idx);
263
+ wasm.__externref_table_dealloc(idx);
264
+ return value;
265
+ }
266
+
267
+ function getArrayU8FromWasm0(ptr, len) {
268
+ ptr = ptr >>> 0;
269
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
270
+ }
271
+ /**
272
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
273
+ *
274
+ * @param {WitnessMap} witness_map - A witness map.
275
+ * @returns {Uint8Array} A compressed witness map
276
+ */
277
+ export function compressWitness(witness_map) {
278
+ const ret = wasm.compressWitness(witness_map);
279
+ if (ret[3]) {
280
+ throw takeFromExternrefTable0(ret[2]);
281
+ }
282
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
283
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
284
+ return v1;
285
+ }
286
+
287
+ /**
288
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
289
+ * This should be used to only fetch the witness map for the main function.
290
+ *
291
+ * @param {Uint8Array} compressed_witness - A compressed witness.
292
+ * @returns {WitnessMap} The decompressed witness map.
293
+ */
294
+ export function decompressWitness(compressed_witness) {
295
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
296
+ const len0 = WASM_VECTOR_LEN;
297
+ const ret = wasm.decompressWitness(ptr0, len0);
298
+ if (ret[2]) {
299
+ throw takeFromExternrefTable0(ret[1]);
300
+ }
301
+ return takeFromExternrefTable0(ret[0]);
302
+ }
303
+
304
+ /**
305
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
306
+ *
307
+ * @param {WitnessStack} witness_stack - A witness stack.
308
+ * @returns {Uint8Array} A compressed witness stack
309
+ */
310
+ export function compressWitnessStack(witness_stack) {
311
+ const ret = wasm.compressWitnessStack(witness_stack);
312
+ if (ret[3]) {
313
+ throw takeFromExternrefTable0(ret[2]);
314
+ }
315
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
316
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
317
+ return v1;
318
+ }
319
+
320
+ /**
321
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
322
+ *
323
+ * @param {Uint8Array} compressed_witness - A compressed witness.
324
+ * @returns {WitnessStack} The decompressed witness stack.
325
+ */
326
+ export function decompressWitnessStack(compressed_witness) {
327
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
328
+ const len0 = WASM_VECTOR_LEN;
329
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
330
+ if (ret[2]) {
331
+ throw takeFromExternrefTable0(ret[1]);
332
+ }
333
+ return takeFromExternrefTable0(ret[0]);
334
+ }
335
+
200
336
  /**
201
337
  * Performs a bitwise AND operation between `lhs` and `rhs`
202
338
  * @param {string} lhs
@@ -256,17 +392,6 @@ export function sha256_compression(inputs, state) {
256
392
  return v3;
257
393
  }
258
394
 
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
- }
270
395
  /**
271
396
  * Calculates the Blake2s256 hash of the input bytes
272
397
  * @param {Uint8Array} inputs
@@ -323,11 +448,6 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
323
448
  return ret !== 0;
324
449
  }
325
450
 
326
- function takeFromExternrefTable0(idx) {
327
- const value = wasm.__wbindgen_export_2.get(idx);
328
- wasm.__externref_table_dealloc(idx);
329
- return value;
330
- }
331
451
  /**
332
452
  * Sets the package's logging level.
333
453
  *
@@ -342,15 +462,6 @@ export function initLogLevel(filter) {
342
462
  }
343
463
  }
344
464
 
345
- /**
346
- * Returns the `BuildInfo` object containing information about how the installed package was built.
347
- * @returns {BuildInfo} - Information on how the installed package was built.
348
- */
349
- export function buildInfo() {
350
- const ret = wasm.buildInfo();
351
- return ret;
352
- }
353
-
354
465
  /**
355
466
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
356
467
  *
@@ -411,127 +522,16 @@ export function getPublicWitness(program, solved_witness) {
411
522
  return takeFromExternrefTable0(ret[0]);
412
523
  }
413
524
 
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.closure441_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure447_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure925_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure929_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure936_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_wrapper1431 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 442, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,6 +1,14 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const buildInfo: () => any;
5
+ export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
6
+ export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
7
+ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
8
+ export const compressWitness: (a: any) => [number, number, number, number];
9
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
10
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
11
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
4
12
  export const and: (a: any, b: any) => any;
5
13
  export const xor: (a: any, b: any) => any;
6
14
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
@@ -8,17 +16,9 @@ export const blake2s256: (a: number, b: number) => [number, number];
8
16
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
9
17
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
18
  export const initLogLevel: (a: number, b: number) => [number, number];
11
- export const buildInfo: () => any;
12
19
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
13
20
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
14
21
  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 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;
30
+ export const closure447_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;