@aztec/noir-acvm_js 0.0.1-commit.b655e406 → 0.0.1-commit.d1f2d6c

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,10 @@
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;
3
8
  /**
4
9
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
10
  *
@@ -30,39 +35,29 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
30
35
  */
31
36
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
32
37
  /**
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.
38
+ * Performs a bitwise AND operation between `lhs` and `rhs`
39
39
  */
40
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
40
+ export function and(lhs: string, rhs: string): string;
41
41
  /**
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.
42
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
49
43
  */
50
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
44
+ export function xor(lhs: string, rhs: string): string;
51
45
  /**
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.
46
+ * Sha256 compression function
58
47
  */
59
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
48
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
60
49
  /**
61
- * Sets the package's logging level.
62
- *
63
- * @param {LogLevel} level - The maximum level of logging to be emitted.
50
+ * Calculates the Blake2s256 hash of the input bytes
64
51
  */
65
- export function initLogLevel(filter: string): void;
52
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
53
+ /**
54
+ * Verifies a ECDSA signature over the secp256k1 curve.
55
+ */
56
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
57
+ /**
58
+ * Verifies a ECDSA signature over the secp256r1 curve.
59
+ */
60
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
66
61
  /**
67
62
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
68
63
  *
@@ -88,34 +83,77 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
88
83
  */
89
84
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
90
85
  /**
91
- * Returns the `BuildInfo` object containing information about how the installed package was built.
92
- * @returns {BuildInfo} - Information on how the installed package was built.
93
- */
94
- export function buildInfo(): BuildInfo;
95
- /**
96
- * Performs a bitwise AND operation between `lhs` and `rhs`
86
+ * Sets the package's logging level.
87
+ *
88
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
97
89
  */
98
- export function and(lhs: string, rhs: string): string;
90
+ export function initLogLevel(filter: string): void;
99
91
  /**
100
- * Performs a bitwise XOR operation between `lhs` and `rhs`
92
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
+ *
94
+ * @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.
101
98
  */
102
- export function xor(lhs: string, rhs: string): string;
99
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
103
100
  /**
104
- * Sha256 compression function
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.
103
+ *
104
+ * @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.
105
108
  */
106
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
109
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
107
110
  /**
108
- * Calculates the Blake2s256 hash of the input bytes
111
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ *
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.
109
117
  */
110
- export function blake2s256(inputs: Uint8Array): Uint8Array;
118
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
+
120
+ export type StackItem = {
121
+ index: number;
122
+ witness: WitnessMap;
123
+ }
124
+
125
+ export type WitnessStack = Array<StackItem>;
126
+
127
+
128
+
111
129
  /**
112
- * Verifies a ECDSA signature over the secp256k1 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.
113
134
  */
114
- export function ecdsa_secp256k1_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
+
142
+
143
+ // Map from witness index to hex string value of witness.
144
+ export type WitnessMap = Map<number, string>;
145
+
115
146
  /**
116
- * Verifies a ECDSA signature over the secp256r1 curve.
147
+ * An execution result containing two witnesses.
148
+ * 1. The full solved witness of the execution.
149
+ * 2. The return witness which contains the given public return values within the full witness.
117
150
  */
118
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
151
+ export type SolvedAndReturnWitness = {
152
+ solvedWitness: WitnessMap;
153
+ returnWitness: WitnessMap;
154
+ }
155
+
156
+
119
157
 
120
158
  export type RawAssertionPayload = {
121
159
  selector: string;
@@ -144,41 +182,3 @@ export type ForeignCallOutput = string | string[]
144
182
  export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
145
183
 
146
184
 
147
-
148
- // Map from witness index to hex string value of witness.
149
- export type WitnessMap = Map<number, string>;
150
-
151
- /**
152
- * An execution result containing two witnesses.
153
- * 1. The full solved witness of the execution.
154
- * 2. The return witness which contains the given public return values within the full witness.
155
- */
156
- export type SolvedAndReturnWitness = {
157
- solvedWitness: WitnessMap;
158
- returnWitness: WitnessMap;
159
- }
160
-
161
-
162
-
163
- export type StackItem = {
164
- index: number;
165
- witness: WitnessMap;
166
- }
167
-
168
- export type WitnessStack = Array<StackItem>;
169
-
170
-
171
-
172
- /**
173
- * @typedef {Object} BuildInfo - Information about how the installed package was built
174
- * @property {string} gitHash - The hash of the git commit from which the package was built.
175
- * @property {string} version - The version of the package at the built git commit.
176
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
- */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
182
- }
183
-
184
-
package/nodejs/acvm_js.js CHANGED
@@ -201,6 +201,14 @@ 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
+ };
204
212
 
205
213
  function takeFromExternrefTable0(idx) {
206
214
  const value = wasm.__wbindgen_export_2.get(idx);
@@ -283,135 +291,6 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
283
291
  return takeFromExternrefTable0(ret[0]);
284
292
  };
285
293
 
286
- /**
287
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
288
- *
289
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
290
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
291
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
292
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
293
- */
294
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
295
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
296
- const len0 = WASM_VECTOR_LEN;
297
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
298
- return ret;
299
- };
300
-
301
- /**
302
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
303
- * This method also extracts the public return values from the solved witness into its own return witness.
304
- *
305
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
306
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
307
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
308
- * @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.
309
- */
310
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
311
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
312
- const len0 = WASM_VECTOR_LEN;
313
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
314
- return ret;
315
- };
316
-
317
- /**
318
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
319
- *
320
- * @param {Uint8Array} program - A serialized representation of an ACIR program
321
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
322
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
323
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
324
- */
325
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
326
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
327
- const len0 = WASM_VECTOR_LEN;
328
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
329
- return ret;
330
- };
331
-
332
- /**
333
- * Sets the package's logging level.
334
- *
335
- * @param {LogLevel} level - The maximum level of logging to be emitted.
336
- */
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]);
343
- }
344
- };
345
-
346
- /**
347
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
348
- *
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}
355
- */
356
- module.exports.getReturnWitness = function(program, witness_map) {
357
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
358
- const len0 = WASM_VECTOR_LEN;
359
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
360
- if (ret[2]) {
361
- throw takeFromExternrefTable0(ret[1]);
362
- }
363
- return takeFromExternrefTable0(ret[0]);
364
- };
365
-
366
- /**
367
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
368
- *
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}
375
- */
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]);
382
- }
383
- return takeFromExternrefTable0(ret[0]);
384
- };
385
-
386
- /**
387
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
388
- *
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}
395
- */
396
- module.exports.getPublicWitness = function(program, solved_witness) {
397
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
398
- const len0 = WASM_VECTOR_LEN;
399
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
400
- if (ret[2]) {
401
- throw takeFromExternrefTable0(ret[1]);
402
- }
403
- return takeFromExternrefTable0(ret[0]);
404
- };
405
-
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
294
  /**
416
295
  * Performs a bitwise AND operation between `lhs` and `rhs`
417
296
  * @param {string} lhs
@@ -527,16 +406,136 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
527
406
  return ret !== 0;
528
407
  };
529
408
 
409
+ /**
410
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
411
+ *
412
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
413
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
414
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
415
+ * @param {Uint8Array} program
416
+ * @param {WitnessMap} witness_map
417
+ * @returns {WitnessMap}
418
+ */
419
+ module.exports.getReturnWitness = function(program, witness_map) {
420
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
423
+ if (ret[2]) {
424
+ throw takeFromExternrefTable0(ret[1]);
425
+ }
426
+ return takeFromExternrefTable0(ret[0]);
427
+ };
428
+
429
+ /**
430
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
431
+ *
432
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
433
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
434
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
435
+ * @param {Uint8Array} program
436
+ * @param {WitnessMap} solved_witness
437
+ * @returns {WitnessMap}
438
+ */
439
+ module.exports.getPublicParametersWitness = function(program, solved_witness) {
440
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
441
+ const len0 = WASM_VECTOR_LEN;
442
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
443
+ if (ret[2]) {
444
+ throw takeFromExternrefTable0(ret[1]);
445
+ }
446
+ return takeFromExternrefTable0(ret[0]);
447
+ };
448
+
449
+ /**
450
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
451
+ *
452
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
453
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
454
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
455
+ * @param {Uint8Array} program
456
+ * @param {WitnessMap} solved_witness
457
+ * @returns {WitnessMap}
458
+ */
459
+ module.exports.getPublicWitness = function(program, solved_witness) {
460
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
461
+ const len0 = WASM_VECTOR_LEN;
462
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
463
+ if (ret[2]) {
464
+ throw takeFromExternrefTable0(ret[1]);
465
+ }
466
+ return takeFromExternrefTable0(ret[0]);
467
+ };
468
+
469
+ /**
470
+ * Sets the package's logging level.
471
+ *
472
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
473
+ */
474
+ module.exports.initLogLevel = function(filter) {
475
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
476
+ const len0 = WASM_VECTOR_LEN;
477
+ const ret = wasm.initLogLevel(ptr0, len0);
478
+ if (ret[1]) {
479
+ throw takeFromExternrefTable0(ret[0]);
480
+ }
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
+
530
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
531
- wasm.closure584_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure448_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.closure933_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.closure937_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_wrapper1446 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 449, __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;
4
5
  export const compressWitness: (a: any) => [number, number, number, number];
5
6
  export const decompressWitness: (a: number, b: number) => [number, number, number];
6
7
  export const compressWitnessStack: (a: any) => [number, number, number, number];
7
8
  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
9
  export const and: (a: any, b: any) => any;
17
10
  export const xor: (a: any, b: any) => any;
18
11
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
19
12
  export const blake2s256: (a: number, b: number) => [number, number];
20
13
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
21
14
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
15
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
16
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
17
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
18
+ export const initLogLevel: (a: number, b: 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 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 closure448_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure937_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.b655e406",
3
+ "version": "0.0.1-commit.d1f2d6c",
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.5",
47
+ "mocha": "^11.7.5",
48
+ "prettier": "3.8.0",
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,10 @@
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;
3
8
  /**
4
9
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
10
  *
@@ -30,39 +35,29 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
30
35
  */
31
36
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
32
37
  /**
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.
38
+ * Performs a bitwise AND operation between `lhs` and `rhs`
39
39
  */
40
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
40
+ export function and(lhs: string, rhs: string): string;
41
41
  /**
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.
42
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
49
43
  */
50
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
44
+ export function xor(lhs: string, rhs: string): string;
51
45
  /**
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.
46
+ * Sha256 compression function
58
47
  */
59
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
48
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
60
49
  /**
61
- * Sets the package's logging level.
62
- *
63
- * @param {LogLevel} level - The maximum level of logging to be emitted.
50
+ * Calculates the Blake2s256 hash of the input bytes
64
51
  */
65
- export function initLogLevel(filter: string): void;
52
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
53
+ /**
54
+ * Verifies a ECDSA signature over the secp256k1 curve.
55
+ */
56
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
57
+ /**
58
+ * Verifies a ECDSA signature over the secp256r1 curve.
59
+ */
60
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
66
61
  /**
67
62
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
68
63
  *
@@ -88,34 +83,77 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
88
83
  */
89
84
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
90
85
  /**
91
- * Returns the `BuildInfo` object containing information about how the installed package was built.
92
- * @returns {BuildInfo} - Information on how the installed package was built.
93
- */
94
- export function buildInfo(): BuildInfo;
95
- /**
96
- * Performs a bitwise AND operation between `lhs` and `rhs`
86
+ * Sets the package's logging level.
87
+ *
88
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
97
89
  */
98
- export function and(lhs: string, rhs: string): string;
90
+ export function initLogLevel(filter: string): void;
99
91
  /**
100
- * Performs a bitwise XOR operation between `lhs` and `rhs`
92
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
+ *
94
+ * @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.
101
98
  */
102
- export function xor(lhs: string, rhs: string): string;
99
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
103
100
  /**
104
- * Sha256 compression function
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.
103
+ *
104
+ * @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.
105
108
  */
106
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
109
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
107
110
  /**
108
- * Calculates the Blake2s256 hash of the input bytes
111
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
112
+ *
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.
109
117
  */
110
- export function blake2s256(inputs: Uint8Array): Uint8Array;
118
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
+
120
+ export type StackItem = {
121
+ index: number;
122
+ witness: WitnessMap;
123
+ }
124
+
125
+ export type WitnessStack = Array<StackItem>;
126
+
127
+
128
+
111
129
  /**
112
- * Verifies a ECDSA signature over the secp256k1 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.
113
134
  */
114
- export function ecdsa_secp256k1_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
+
142
+
143
+ // Map from witness index to hex string value of witness.
144
+ export type WitnessMap = Map<number, string>;
145
+
115
146
  /**
116
- * Verifies a ECDSA signature over the secp256r1 curve.
147
+ * An execution result containing two witnesses.
148
+ * 1. The full solved witness of the execution.
149
+ * 2. The return witness which contains the given public return values within the full witness.
117
150
  */
118
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
151
+ export type SolvedAndReturnWitness = {
152
+ solvedWitness: WitnessMap;
153
+ returnWitness: WitnessMap;
154
+ }
155
+
156
+
119
157
 
120
158
  export type RawAssertionPayload = {
121
159
  selector: string;
@@ -145,66 +183,28 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
145
183
 
146
184
 
147
185
 
148
- // Map from witness index to hex string value of witness.
149
- export type WitnessMap = Map<number, string>;
150
-
151
- /**
152
- * An execution result containing two witnesses.
153
- * 1. The full solved witness of the execution.
154
- * 2. The return witness which contains the given public return values within the full witness.
155
- */
156
- export type SolvedAndReturnWitness = {
157
- solvedWitness: WitnessMap;
158
- returnWitness: WitnessMap;
159
- }
160
-
161
-
162
-
163
- export type StackItem = {
164
- index: number;
165
- witness: WitnessMap;
166
- }
167
-
168
- export type WitnessStack = Array<StackItem>;
169
-
170
-
171
-
172
- /**
173
- * @typedef {Object} BuildInfo - Information about how the installed package was built
174
- * @property {string} gitHash - The hash of the git commit from which the package was built.
175
- * @property {string} version - The version of the package at the built git commit.
176
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
- */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
182
- }
183
-
184
-
185
-
186
186
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
+ readonly buildInfo: () => any;
190
191
  readonly compressWitness: (a: any) => [number, number, number, number];
191
192
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
192
193
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
193
194
  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
195
  readonly and: (a: any, b: any) => any;
203
196
  readonly xor: (a: any, b: any) => any;
204
197
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
205
198
  readonly blake2s256: (a: number, b: number) => [number, number];
206
199
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
207
200
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
201
+ readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
202
+ readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
203
+ readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
204
+ readonly initLogLevel: (a: number, b: 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 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 closure448_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure937_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,14 @@ 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
+ }
200
208
 
201
209
  function takeFromExternrefTable0(idx) {
202
210
  const value = wasm.__wbindgen_export_2.get(idx);
@@ -279,135 +287,6 @@ export function decompressWitnessStack(compressed_witness) {
279
287
  return takeFromExternrefTable0(ret[0]);
280
288
  }
281
289
 
282
- /**
283
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
284
- *
285
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
286
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
287
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
288
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
289
- */
290
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
291
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
292
- const len0 = WASM_VECTOR_LEN;
293
- const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
294
- return ret;
295
- }
296
-
297
- /**
298
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
299
- * This method also extracts the public return values from the solved witness into its own return witness.
300
- *
301
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
302
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
303
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
304
- * @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.
305
- */
306
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
307
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
308
- const len0 = WASM_VECTOR_LEN;
309
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
310
- return ret;
311
- }
312
-
313
- /**
314
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
315
- *
316
- * @param {Uint8Array} program - A serialized representation of an ACIR program
317
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
318
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
319
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
320
- */
321
- export function executeProgram(program, initial_witness, foreign_call_handler) {
322
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
323
- const len0 = WASM_VECTOR_LEN;
324
- const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
325
- return ret;
326
- }
327
-
328
- /**
329
- * Sets the package's logging level.
330
- *
331
- * @param {LogLevel} level - The maximum level of logging to be emitted.
332
- */
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]);
339
- }
340
- }
341
-
342
- /**
343
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
344
- *
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}
351
- */
352
- export function getReturnWitness(program, witness_map) {
353
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
354
- const len0 = WASM_VECTOR_LEN;
355
- const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
356
- if (ret[2]) {
357
- throw takeFromExternrefTable0(ret[1]);
358
- }
359
- return takeFromExternrefTable0(ret[0]);
360
- }
361
-
362
- /**
363
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
364
- *
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}
371
- */
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]);
378
- }
379
- return takeFromExternrefTable0(ret[0]);
380
- }
381
-
382
- /**
383
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
384
- *
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}
391
- */
392
- export function getPublicWitness(program, solved_witness) {
393
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
394
- const len0 = WASM_VECTOR_LEN;
395
- const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
396
- if (ret[2]) {
397
- throw takeFromExternrefTable0(ret[1]);
398
- }
399
- return takeFromExternrefTable0(ret[0]);
400
- }
401
-
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
290
  /**
412
291
  * Performs a bitwise AND operation between `lhs` and `rhs`
413
292
  * @param {string} lhs
@@ -523,16 +402,136 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
523
402
  return ret !== 0;
524
403
  }
525
404
 
405
+ /**
406
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
407
+ *
408
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
409
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
410
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
411
+ * @param {Uint8Array} program
412
+ * @param {WitnessMap} witness_map
413
+ * @returns {WitnessMap}
414
+ */
415
+ export function getReturnWitness(program, witness_map) {
416
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
417
+ const len0 = WASM_VECTOR_LEN;
418
+ const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
419
+ if (ret[2]) {
420
+ throw takeFromExternrefTable0(ret[1]);
421
+ }
422
+ return takeFromExternrefTable0(ret[0]);
423
+ }
424
+
425
+ /**
426
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
427
+ *
428
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
429
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
430
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
431
+ * @param {Uint8Array} program
432
+ * @param {WitnessMap} solved_witness
433
+ * @returns {WitnessMap}
434
+ */
435
+ export function getPublicParametersWitness(program, solved_witness) {
436
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
437
+ const len0 = WASM_VECTOR_LEN;
438
+ const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
439
+ if (ret[2]) {
440
+ throw takeFromExternrefTable0(ret[1]);
441
+ }
442
+ return takeFromExternrefTable0(ret[0]);
443
+ }
444
+
445
+ /**
446
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
447
+ *
448
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
449
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
450
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
451
+ * @param {Uint8Array} program
452
+ * @param {WitnessMap} solved_witness
453
+ * @returns {WitnessMap}
454
+ */
455
+ export function getPublicWitness(program, solved_witness) {
456
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
457
+ const len0 = WASM_VECTOR_LEN;
458
+ const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
459
+ if (ret[2]) {
460
+ throw takeFromExternrefTable0(ret[1]);
461
+ }
462
+ return takeFromExternrefTable0(ret[0]);
463
+ }
464
+
465
+ /**
466
+ * Sets the package's logging level.
467
+ *
468
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
469
+ */
470
+ export function initLogLevel(filter) {
471
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
472
+ const len0 = WASM_VECTOR_LEN;
473
+ const ret = wasm.initLogLevel(ptr0, len0);
474
+ if (ret[1]) {
475
+ throw takeFromExternrefTable0(ret[0]);
476
+ }
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
+
526
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
527
- wasm.closure584_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure448_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.closure933_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.closure937_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_wrapper1446 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 449, __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;
4
5
  export const compressWitness: (a: any) => [number, number, number, number];
5
6
  export const decompressWitness: (a: number, b: number) => [number, number, number];
6
7
  export const compressWitnessStack: (a: any) => [number, number, number, number];
7
8
  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
9
  export const and: (a: any, b: any) => any;
17
10
  export const xor: (a: any, b: any) => any;
18
11
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
19
12
  export const blake2s256: (a: number, b: number) => [number, number];
20
13
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
21
14
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
15
+ export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
16
+ export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
17
+ export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
18
+ export const initLogLevel: (a: number, b: 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 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 closure448_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure937_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;