@aztec/noir-acvm_js 0.0.1-commit.24de95ac → 0.0.1-commit.3469e52

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