@noir-lang/acvm_js 0.48.0 → 0.49.0-712468a.nightly

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
5
- *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
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.
7
6
  */
8
- export function initLogLevel(filter: string): void;
7
+ export function buildInfo(): BuildInfo;
9
8
  /**
10
9
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
11
10
  *
@@ -40,34 +39,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
40
39
  */
41
40
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
42
41
  /**
43
- * Executes an ACIR circuit to generate the solved witness from the initial 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 {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
49
- */
50
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
51
- /**
52
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
53
- * This method also extracts the public return values from the solved witness into its own return witness.
54
- *
55
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
56
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
57
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
58
- * @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.
59
- */
60
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
61
- /**
62
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
63
- *
64
- * @param {Uint8Array} program - A serialized representation of an ACIR program
65
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
66
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
67
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
68
- */
69
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
70
- /**
71
42
  * Performs a bitwise AND operation between `lhs` and `rhs`
72
43
  * @param {string} lhs
73
44
  * @param {string} rhs
@@ -118,11 +89,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
118
89
  */
119
90
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
120
91
  /**
121
- * Returns the `BuildInfo` object containing information about how the installed package was built.
122
- * @returns {BuildInfo} - Information on how the installed package was built.
123
- */
124
- export function buildInfo(): BuildInfo;
125
- /**
126
92
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
127
93
  *
128
94
  * @param {WitnessMap} witness_map - A witness map.
@@ -151,14 +117,64 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
151
117
  * @returns {WitnessStack} The decompressed witness stack.
152
118
  */
153
119
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
120
+ /**
121
+ * Sets the package's logging level.
122
+ *
123
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
124
+ */
125
+ export function initLogLevel(filter: string): void;
126
+ /**
127
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
128
+ *
129
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
130
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
131
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
132
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
133
+ */
134
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
135
+ /**
136
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
137
+ * This method also extracts the public return values from the solved witness into its own return witness.
138
+ *
139
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
140
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
141
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
142
+ * @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.
143
+ */
144
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
145
+ /**
146
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
147
+ *
148
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
149
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
150
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
151
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
152
+ */
153
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
154
+
155
+ /**
156
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
157
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
158
+ * @property {string} version - The version of the package at the built git commit.
159
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
160
+ */
161
+ export type BuildInfo = {
162
+ gitHash: string;
163
+ version: string;
164
+ dirty: string;
165
+ }
166
+
167
+
154
168
 
155
169
  export type RawAssertionPayload = {
156
170
  selector: string;
157
171
  data: string[];
158
172
  };
173
+
159
174
  export type ExecutionError = Error & {
160
175
  callStack?: string[];
161
176
  rawAssertionPayload?: RawAssertionPayload;
177
+ brilligFunctionId?: number;
162
178
  };
163
179
 
164
180
 
@@ -172,16 +188,17 @@ export type WitnessStack = Array<StackItem>;
172
188
 
173
189
 
174
190
 
191
+ // Map from witness index to hex string value of witness.
192
+ export type WitnessMap = Map<number, string>;
193
+
175
194
  /**
176
- * @typedef {Object} BuildInfo - Information about how the installed package was built
177
- * @property {string} gitHash - The hash of the git commit from which the package was built.
178
- * @property {string} version - The version of the package at the built git commit.
179
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
195
+ * An execution result containing two witnesses.
196
+ * 1. The full solved witness of the execution.
197
+ * 2. The return witness which contains the given public return values within the full witness.
180
198
  */
181
- export type BuildInfo = {
182
- gitHash: string;
183
- version: string;
184
- dirty: string;
199
+ export type SolvedAndReturnWitness = {
200
+ solvedWitness: WitnessMap;
201
+ returnWitness: WitnessMap;
185
202
  }
186
203
 
187
204
 
@@ -199,18 +216,3 @@ export type ForeignCallOutput = string | string[]
199
216
  export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
200
217
 
201
218
 
202
-
203
- // Map from witness index to hex string value of witness.
204
- export type WitnessMap = Map<number, string>;
205
-
206
- /**
207
- * An execution result containing two witnesses.
208
- * 1. The full solved witness of the execution.
209
- * 2. The return witness which contains the given public return values within the full witness.
210
- */
211
- export type SolvedAndReturnWitness = {
212
- solvedWitness: WitnessMap;
213
- returnWitness: WitnessMap;
214
- }
215
-
216
-
package/nodejs/acvm_js.js CHANGED
@@ -23,28 +23,6 @@ function takeObject(idx) {
23
23
  return ret;
24
24
  }
25
25
 
26
- function isLikeNone(x) {
27
- return x === undefined || x === null;
28
- }
29
-
30
- let cachedFloat64Memory0 = null;
31
-
32
- function getFloat64Memory0() {
33
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
34
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
35
- }
36
- return cachedFloat64Memory0;
37
- }
38
-
39
- let cachedInt32Memory0 = null;
40
-
41
- function getInt32Memory0() {
42
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
43
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
44
- }
45
- return cachedInt32Memory0;
46
- }
47
-
48
26
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
49
27
 
50
28
  cachedTextDecoder.decode();
@@ -72,6 +50,28 @@ function addHeapObject(obj) {
72
50
  return idx;
73
51
  }
74
52
 
53
+ function isLikeNone(x) {
54
+ return x === undefined || x === null;
55
+ }
56
+
57
+ let cachedFloat64Memory0 = null;
58
+
59
+ function getFloat64Memory0() {
60
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
61
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
62
+ }
63
+ return cachedFloat64Memory0;
64
+ }
65
+
66
+ let cachedInt32Memory0 = null;
67
+
68
+ function getInt32Memory0() {
69
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
70
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
71
+ }
72
+ return cachedInt32Memory0;
73
+ }
74
+
75
75
  let WASM_VECTOR_LEN = 0;
76
76
 
77
77
  let cachedTextEncoder = new TextEncoder('utf-8');
@@ -221,24 +221,12 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
221
221
  }
222
222
 
223
223
  /**
224
- * Sets the package's logging level.
225
- *
226
- * @param {LogLevel} level - The maximum level of logging to be emitted.
224
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
225
+ * @returns {BuildInfo} - Information on how the installed package was built.
227
226
  */
228
- module.exports.initLogLevel = function(filter) {
229
- try {
230
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
231
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
232
- const len0 = WASM_VECTOR_LEN;
233
- wasm.initLogLevel(retptr, ptr0, len0);
234
- var r0 = getInt32Memory0()[retptr / 4 + 0];
235
- var r1 = getInt32Memory0()[retptr / 4 + 1];
236
- if (r1) {
237
- throw takeObject(r0);
238
- }
239
- } finally {
240
- wasm.__wbindgen_add_to_stack_pointer(16);
241
- }
227
+ module.exports.buildInfo = function() {
228
+ const ret = wasm.buildInfo();
229
+ return takeObject(ret);
242
230
  };
243
231
 
244
232
  function passArray8ToWasm0(arg, malloc) {
@@ -331,52 +319,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
331
319
  }
332
320
  };
333
321
 
334
- /**
335
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
336
- *
337
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
338
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
339
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
340
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
341
- */
342
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
343
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
344
- const len0 = WASM_VECTOR_LEN;
345
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
346
- return takeObject(ret);
347
- };
348
-
349
- /**
350
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
351
- * This method also extracts the public return values from the solved witness into its own return witness.
352
- *
353
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
354
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
355
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
356
- * @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.
357
- */
358
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
359
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
360
- const len0 = WASM_VECTOR_LEN;
361
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
362
- return takeObject(ret);
363
- };
364
-
365
- /**
366
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
367
- *
368
- * @param {Uint8Array} program - A serialized representation of an ACIR program
369
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
370
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
371
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
372
- */
373
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
374
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
375
- const len0 = WASM_VECTOR_LEN;
376
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
377
- return takeObject(ret);
378
- };
379
-
380
322
  /**
381
323
  * Performs a bitwise AND operation between `lhs` and `rhs`
382
324
  * @param {string} lhs
@@ -508,15 +450,6 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
508
450
  return ret !== 0;
509
451
  };
510
452
 
511
- /**
512
- * Returns the `BuildInfo` object containing information about how the installed package was built.
513
- * @returns {BuildInfo} - Information on how the installed package was built.
514
- */
515
- module.exports.buildInfo = function() {
516
- const ret = wasm.buildInfo();
517
- return takeObject(ret);
518
- };
519
-
520
453
  /**
521
454
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
522
455
  *
@@ -616,6 +549,73 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
616
549
  }
617
550
  };
618
551
 
552
+ /**
553
+ * Sets the package's logging level.
554
+ *
555
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
556
+ */
557
+ module.exports.initLogLevel = function(filter) {
558
+ try {
559
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
560
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
561
+ const len0 = WASM_VECTOR_LEN;
562
+ wasm.initLogLevel(retptr, ptr0, len0);
563
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
564
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
565
+ if (r1) {
566
+ throw takeObject(r0);
567
+ }
568
+ } finally {
569
+ wasm.__wbindgen_add_to_stack_pointer(16);
570
+ }
571
+ };
572
+
573
+ /**
574
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
575
+ *
576
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
577
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
578
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
579
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
580
+ */
581
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
582
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
583
+ const len0 = WASM_VECTOR_LEN;
584
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
585
+ return takeObject(ret);
586
+ };
587
+
588
+ /**
589
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
590
+ * This method also extracts the public return values from the solved witness into its own return witness.
591
+ *
592
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
593
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
594
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
595
+ * @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.
596
+ */
597
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
598
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
599
+ const len0 = WASM_VECTOR_LEN;
600
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
601
+ return takeObject(ret);
602
+ };
603
+
604
+ /**
605
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
606
+ *
607
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
608
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
609
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
610
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
611
+ */
612
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
613
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
614
+ const len0 = WASM_VECTOR_LEN;
615
+ const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
616
+ return takeObject(ret);
617
+ };
618
+
619
619
  function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
620
620
  wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
621
621
  }
@@ -631,6 +631,10 @@ function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
631
631
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
632
632
  }
633
633
 
634
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
635
+ takeObject(arg0);
636
+ };
637
+
634
638
  module.exports.__wbindgen_cb_drop = function(arg0) {
635
639
  const obj = takeObject(arg0).original;
636
640
  if (obj.cnt-- == 1) {
@@ -641,38 +645,17 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
641
645
  return ret;
642
646
  };
643
647
 
644
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
645
- takeObject(arg0);
646
- };
647
-
648
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
649
- const obj = getObject(arg1);
650
- const ret = typeof(obj) === 'number' ? obj : undefined;
651
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
652
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
653
- };
654
-
655
- module.exports.__wbg_constructor_a4e1fbe49b64399a = function(arg0) {
648
+ module.exports.__wbg_constructor_9e0f49809a0dd2f4 = function(arg0) {
656
649
  const ret = new Error(takeObject(arg0));
657
650
  return addHeapObject(ret);
658
651
  };
659
652
 
660
- module.exports.__wbindgen_is_array = function(arg0) {
661
- const ret = Array.isArray(getObject(arg0));
662
- return ret;
663
- };
664
-
665
- module.exports.__wbindgen_is_string = function(arg0) {
666
- const ret = typeof(getObject(arg0)) === 'string';
667
- return ret;
668
- };
669
-
670
653
  module.exports.__wbindgen_string_new = function(arg0, arg1) {
671
654
  const ret = getStringFromWasm0(arg0, arg1);
672
655
  return addHeapObject(ret);
673
656
  };
674
657
 
675
- module.exports.__wbg_new_99fb929611321a93 = function() {
658
+ module.exports.__wbg_new_baa0339c0c5c310a = function() {
676
659
  const ret = new Array();
677
660
  return addHeapObject(ret);
678
661
  };
@@ -682,7 +665,14 @@ module.exports.__wbindgen_number_new = function(arg0) {
682
665
  return addHeapObject(ret);
683
666
  };
684
667
 
685
- module.exports.__wbg_new_237eb36a3bda602b = function() {
668
+ module.exports.__wbindgen_number_get = function(arg0, arg1) {
669
+ const obj = getObject(arg1);
670
+ const ret = typeof(obj) === 'number' ? obj : undefined;
671
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
672
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
673
+ };
674
+
675
+ module.exports.__wbg_new_cd95aa9a75b6fbe6 = function() {
686
676
  const ret = new Map();
687
677
  return addHeapObject(ret);
688
678
  };
@@ -696,6 +686,16 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
696
686
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
697
687
  };
698
688
 
689
+ module.exports.__wbindgen_is_array = function(arg0) {
690
+ const ret = Array.isArray(getObject(arg0));
691
+ return ret;
692
+ };
693
+
694
+ module.exports.__wbindgen_is_string = function(arg0) {
695
+ const ret = typeof(getObject(arg0)) === 'string';
696
+ return ret;
697
+ };
698
+
699
699
  module.exports.__wbg_new_abda76e883ba8a5f = function() {
700
700
  const ret = new Error();
701
701
  return addHeapObject(ret);
@@ -914,8 +914,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
914
914
  throw new Error(getStringFromWasm0(arg0, arg1));
915
915
  };
916
916
 
917
- module.exports.__wbindgen_closure_wrapper759 = function(arg0, arg1, arg2) {
918
- const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
917
+ module.exports.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
918
+ const ret = makeMutClosure(arg0, arg1, 259, __wbg_adapter_22);
919
919
  return addHeapObject(ret);
920
920
  };
921
921
 
Binary file
@@ -1,13 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function initLogLevel(a: number, b: number, c: number): void;
4
+ export function buildInfo(): number;
5
5
  export function getReturnWitness(a: number, b: number, c: number, d: number): void;
6
6
  export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
7
7
  export function getPublicWitness(a: number, b: number, c: number, d: number): void;
8
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
9
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
10
- export function executeProgram(a: number, b: number, c: number, d: number): number;
11
8
  export function and(a: number, b: number): number;
12
9
  export function xor(a: number, b: number): number;
13
10
  export function sha256(a: number, b: number, c: number): void;
@@ -15,11 +12,14 @@ export function blake2s256(a: number, b: number, c: number): void;
15
12
  export function keccak256(a: number, b: number, c: number): void;
16
13
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
17
14
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
18
- export function buildInfo(): number;
19
15
  export function compressWitness(a: number, b: number): void;
20
16
  export function decompressWitness(a: number, b: number, c: number): void;
21
17
  export function compressWitnessStack(a: number, b: number): void;
22
18
  export function decompressWitnessStack(a: number, b: number, c: number): void;
19
+ export function initLogLevel(a: number, b: number, c: number): void;
20
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
21
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
22
+ export function executeProgram(a: number, b: number, c: number, d: number): number;
23
23
  export function __wbindgen_malloc(a: number): number;
24
24
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
25
25
  export const __wbindgen_export_2: WebAssembly.Table;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.48.0",
3
+ "version": "0.49.0-712468a.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
5
- *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
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.
7
6
  */
8
- export function initLogLevel(filter: string): void;
7
+ export function buildInfo(): BuildInfo;
9
8
  /**
10
9
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
11
10
  *
@@ -40,34 +39,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
40
39
  */
41
40
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
42
41
  /**
43
- * Executes an ACIR circuit to generate the solved witness from the initial 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 {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
49
- */
50
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
51
- /**
52
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
53
- * This method also extracts the public return values from the solved witness into its own return witness.
54
- *
55
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
56
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
57
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
58
- * @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.
59
- */
60
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
61
- /**
62
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
63
- *
64
- * @param {Uint8Array} program - A serialized representation of an ACIR program
65
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
66
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
67
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
68
- */
69
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
70
- /**
71
42
  * Performs a bitwise AND operation between `lhs` and `rhs`
72
43
  * @param {string} lhs
73
44
  * @param {string} rhs
@@ -118,11 +89,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
118
89
  */
119
90
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
120
91
  /**
121
- * Returns the `BuildInfo` object containing information about how the installed package was built.
122
- * @returns {BuildInfo} - Information on how the installed package was built.
123
- */
124
- export function buildInfo(): BuildInfo;
125
- /**
126
92
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
127
93
  *
128
94
  * @param {WitnessMap} witness_map - A witness map.
@@ -151,14 +117,64 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
151
117
  * @returns {WitnessStack} The decompressed witness stack.
152
118
  */
153
119
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
120
+ /**
121
+ * Sets the package's logging level.
122
+ *
123
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
124
+ */
125
+ export function initLogLevel(filter: string): void;
126
+ /**
127
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
128
+ *
129
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
130
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
131
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
132
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
133
+ */
134
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
135
+ /**
136
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
137
+ * This method also extracts the public return values from the solved witness into its own return witness.
138
+ *
139
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
140
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
141
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
142
+ * @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.
143
+ */
144
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
145
+ /**
146
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
147
+ *
148
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
149
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
150
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
151
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
152
+ */
153
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
154
+
155
+ /**
156
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
157
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
158
+ * @property {string} version - The version of the package at the built git commit.
159
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
160
+ */
161
+ export type BuildInfo = {
162
+ gitHash: string;
163
+ version: string;
164
+ dirty: string;
165
+ }
166
+
167
+
154
168
 
155
169
  export type RawAssertionPayload = {
156
170
  selector: string;
157
171
  data: string[];
158
172
  };
173
+
159
174
  export type ExecutionError = Error & {
160
175
  callStack?: string[];
161
176
  rawAssertionPayload?: RawAssertionPayload;
177
+ brilligFunctionId?: number;
162
178
  };
163
179
 
164
180
 
@@ -172,16 +188,17 @@ export type WitnessStack = Array<StackItem>;
172
188
 
173
189
 
174
190
 
191
+ // Map from witness index to hex string value of witness.
192
+ export type WitnessMap = Map<number, string>;
193
+
175
194
  /**
176
- * @typedef {Object} BuildInfo - Information about how the installed package was built
177
- * @property {string} gitHash - The hash of the git commit from which the package was built.
178
- * @property {string} version - The version of the package at the built git commit.
179
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
195
+ * An execution result containing two witnesses.
196
+ * 1. The full solved witness of the execution.
197
+ * 2. The return witness which contains the given public return values within the full witness.
180
198
  */
181
- export type BuildInfo = {
182
- gitHash: string;
183
- version: string;
184
- dirty: string;
199
+ export type SolvedAndReturnWitness = {
200
+ solvedWitness: WitnessMap;
201
+ returnWitness: WitnessMap;
185
202
  }
186
203
 
187
204
 
@@ -200,32 +217,14 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
200
217
 
201
218
 
202
219
 
203
- // Map from witness index to hex string value of witness.
204
- export type WitnessMap = Map<number, string>;
205
-
206
- /**
207
- * An execution result containing two witnesses.
208
- * 1. The full solved witness of the execution.
209
- * 2. The return witness which contains the given public return values within the full witness.
210
- */
211
- export type SolvedAndReturnWitness = {
212
- solvedWitness: WitnessMap;
213
- returnWitness: WitnessMap;
214
- }
215
-
216
-
217
-
218
220
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
219
221
 
220
222
  export interface InitOutput {
221
223
  readonly memory: WebAssembly.Memory;
222
- readonly initLogLevel: (a: number, b: number, c: number) => void;
224
+ readonly buildInfo: () => number;
223
225
  readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
224
226
  readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
225
227
  readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
226
- readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
227
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
228
- readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
229
228
  readonly and: (a: number, b: number) => number;
230
229
  readonly xor: (a: number, b: number) => number;
231
230
  readonly sha256: (a: number, b: number, c: number) => void;
@@ -233,11 +232,14 @@ export interface InitOutput {
233
232
  readonly keccak256: (a: number, b: number, c: number) => void;
234
233
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
235
234
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
236
- readonly buildInfo: () => number;
237
235
  readonly compressWitness: (a: number, b: number) => void;
238
236
  readonly decompressWitness: (a: number, b: number, c: number) => void;
239
237
  readonly compressWitnessStack: (a: number, b: number) => void;
240
238
  readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
239
+ readonly initLogLevel: (a: number, b: number, c: number) => void;
240
+ readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
241
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
242
+ readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
241
243
  readonly __wbindgen_malloc: (a: number) => number;
242
244
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
243
245
  readonly __wbindgen_export_2: WebAssembly.Table;
package/web/acvm_js.js CHANGED
@@ -20,28 +20,6 @@ function takeObject(idx) {
20
20
  return ret;
21
21
  }
22
22
 
23
- function isLikeNone(x) {
24
- return x === undefined || x === null;
25
- }
26
-
27
- let cachedFloat64Memory0 = null;
28
-
29
- function getFloat64Memory0() {
30
- if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
31
- cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
32
- }
33
- return cachedFloat64Memory0;
34
- }
35
-
36
- let cachedInt32Memory0 = null;
37
-
38
- function getInt32Memory0() {
39
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
40
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
41
- }
42
- return cachedInt32Memory0;
43
- }
44
-
45
23
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
46
24
 
47
25
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -69,6 +47,28 @@ function addHeapObject(obj) {
69
47
  return idx;
70
48
  }
71
49
 
50
+ function isLikeNone(x) {
51
+ return x === undefined || x === null;
52
+ }
53
+
54
+ let cachedFloat64Memory0 = null;
55
+
56
+ function getFloat64Memory0() {
57
+ if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
58
+ cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
59
+ }
60
+ return cachedFloat64Memory0;
61
+ }
62
+
63
+ let cachedInt32Memory0 = null;
64
+
65
+ function getInt32Memory0() {
66
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
67
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
68
+ }
69
+ return cachedInt32Memory0;
70
+ }
71
+
72
72
  let WASM_VECTOR_LEN = 0;
73
73
 
74
74
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
@@ -218,24 +218,12 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
218
218
  }
219
219
 
220
220
  /**
221
- * Sets the package's logging level.
222
- *
223
- * @param {LogLevel} level - The maximum level of logging to be emitted.
221
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
222
+ * @returns {BuildInfo} - Information on how the installed package was built.
224
223
  */
225
- export function initLogLevel(filter) {
226
- try {
227
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
228
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
229
- const len0 = WASM_VECTOR_LEN;
230
- wasm.initLogLevel(retptr, ptr0, len0);
231
- var r0 = getInt32Memory0()[retptr / 4 + 0];
232
- var r1 = getInt32Memory0()[retptr / 4 + 1];
233
- if (r1) {
234
- throw takeObject(r0);
235
- }
236
- } finally {
237
- wasm.__wbindgen_add_to_stack_pointer(16);
238
- }
224
+ export function buildInfo() {
225
+ const ret = wasm.buildInfo();
226
+ return takeObject(ret);
239
227
  }
240
228
 
241
229
  function passArray8ToWasm0(arg, malloc) {
@@ -328,52 +316,6 @@ export function getPublicWitness(program, solved_witness) {
328
316
  }
329
317
  }
330
318
 
331
- /**
332
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
333
- *
334
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
335
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
336
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
337
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
338
- */
339
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
340
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
341
- const len0 = WASM_VECTOR_LEN;
342
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
343
- return takeObject(ret);
344
- }
345
-
346
- /**
347
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
348
- * This method also extracts the public return values from the solved witness into its own return witness.
349
- *
350
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
351
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
352
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
353
- * @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.
354
- */
355
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
356
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
357
- const len0 = WASM_VECTOR_LEN;
358
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
359
- return takeObject(ret);
360
- }
361
-
362
- /**
363
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
364
- *
365
- * @param {Uint8Array} program - A serialized representation of an ACIR program
366
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
367
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
368
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
369
- */
370
- export function executeProgram(program, initial_witness, foreign_call_handler) {
371
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
372
- const len0 = WASM_VECTOR_LEN;
373
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
374
- return takeObject(ret);
375
- }
376
-
377
319
  /**
378
320
  * Performs a bitwise AND operation between `lhs` and `rhs`
379
321
  * @param {string} lhs
@@ -505,15 +447,6 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
505
447
  return ret !== 0;
506
448
  }
507
449
 
508
- /**
509
- * Returns the `BuildInfo` object containing information about how the installed package was built.
510
- * @returns {BuildInfo} - Information on how the installed package was built.
511
- */
512
- export function buildInfo() {
513
- const ret = wasm.buildInfo();
514
- return takeObject(ret);
515
- }
516
-
517
450
  /**
518
451
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
519
452
  *
@@ -613,6 +546,73 @@ export function decompressWitnessStack(compressed_witness) {
613
546
  }
614
547
  }
615
548
 
549
+ /**
550
+ * Sets the package's logging level.
551
+ *
552
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
553
+ */
554
+ export function initLogLevel(filter) {
555
+ try {
556
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
557
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
558
+ const len0 = WASM_VECTOR_LEN;
559
+ wasm.initLogLevel(retptr, ptr0, len0);
560
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
561
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
562
+ if (r1) {
563
+ throw takeObject(r0);
564
+ }
565
+ } finally {
566
+ wasm.__wbindgen_add_to_stack_pointer(16);
567
+ }
568
+ }
569
+
570
+ /**
571
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
572
+ *
573
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
574
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
575
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
576
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
577
+ */
578
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
579
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
580
+ const len0 = WASM_VECTOR_LEN;
581
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
582
+ return takeObject(ret);
583
+ }
584
+
585
+ /**
586
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
587
+ * This method also extracts the public return values from the solved witness into its own return witness.
588
+ *
589
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
590
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
591
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
592
+ * @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.
593
+ */
594
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
595
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
596
+ const len0 = WASM_VECTOR_LEN;
597
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
598
+ return takeObject(ret);
599
+ }
600
+
601
+ /**
602
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
603
+ *
604
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
605
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
606
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
607
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
608
+ */
609
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
610
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
611
+ const len0 = WASM_VECTOR_LEN;
612
+ const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
613
+ return takeObject(ret);
614
+ }
615
+
616
616
  function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
617
617
  wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
618
618
  }
@@ -662,6 +662,9 @@ async function __wbg_load(module, imports) {
662
662
  function __wbg_get_imports() {
663
663
  const imports = {};
664
664
  imports.wbg = {};
665
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
666
+ takeObject(arg0);
667
+ };
665
668
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
666
669
  const obj = takeObject(arg0).original;
667
670
  if (obj.cnt-- == 1) {
@@ -671,32 +674,15 @@ function __wbg_get_imports() {
671
674
  const ret = false;
672
675
  return ret;
673
676
  };
674
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
675
- takeObject(arg0);
676
- };
677
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
678
- const obj = getObject(arg1);
679
- const ret = typeof(obj) === 'number' ? obj : undefined;
680
- getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
681
- getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
682
- };
683
- imports.wbg.__wbg_constructor_a4e1fbe49b64399a = function(arg0) {
677
+ imports.wbg.__wbg_constructor_9e0f49809a0dd2f4 = function(arg0) {
684
678
  const ret = new Error(takeObject(arg0));
685
679
  return addHeapObject(ret);
686
680
  };
687
- imports.wbg.__wbindgen_is_array = function(arg0) {
688
- const ret = Array.isArray(getObject(arg0));
689
- return ret;
690
- };
691
- imports.wbg.__wbindgen_is_string = function(arg0) {
692
- const ret = typeof(getObject(arg0)) === 'string';
693
- return ret;
694
- };
695
681
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
696
682
  const ret = getStringFromWasm0(arg0, arg1);
697
683
  return addHeapObject(ret);
698
684
  };
699
- imports.wbg.__wbg_new_99fb929611321a93 = function() {
685
+ imports.wbg.__wbg_new_baa0339c0c5c310a = function() {
700
686
  const ret = new Array();
701
687
  return addHeapObject(ret);
702
688
  };
@@ -704,7 +690,13 @@ function __wbg_get_imports() {
704
690
  const ret = arg0;
705
691
  return addHeapObject(ret);
706
692
  };
707
- imports.wbg.__wbg_new_237eb36a3bda602b = function() {
693
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
694
+ const obj = getObject(arg1);
695
+ const ret = typeof(obj) === 'number' ? obj : undefined;
696
+ getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
697
+ getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
698
+ };
699
+ imports.wbg.__wbg_new_cd95aa9a75b6fbe6 = function() {
708
700
  const ret = new Map();
709
701
  return addHeapObject(ret);
710
702
  };
@@ -716,6 +708,14 @@ function __wbg_get_imports() {
716
708
  getInt32Memory0()[arg0 / 4 + 1] = len1;
717
709
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
718
710
  };
711
+ imports.wbg.__wbindgen_is_array = function(arg0) {
712
+ const ret = Array.isArray(getObject(arg0));
713
+ return ret;
714
+ };
715
+ imports.wbg.__wbindgen_is_string = function(arg0) {
716
+ const ret = typeof(getObject(arg0)) === 'string';
717
+ return ret;
718
+ };
719
719
  imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
720
720
  const ret = new Error();
721
721
  return addHeapObject(ret);
@@ -899,8 +899,8 @@ function __wbg_get_imports() {
899
899
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
900
900
  throw new Error(getStringFromWasm0(arg0, arg1));
901
901
  };
902
- imports.wbg.__wbindgen_closure_wrapper759 = function(arg0, arg1, arg2) {
903
- const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
902
+ imports.wbg.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
903
+ const ret = makeMutClosure(arg0, arg1, 259, __wbg_adapter_22);
904
904
  return addHeapObject(ret);
905
905
  };
906
906
 
Binary file
@@ -1,13 +1,10 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function initLogLevel(a: number, b: number, c: number): void;
4
+ export function buildInfo(): number;
5
5
  export function getReturnWitness(a: number, b: number, c: number, d: number): void;
6
6
  export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
7
7
  export function getPublicWitness(a: number, b: number, c: number, d: number): void;
8
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
9
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
10
- export function executeProgram(a: number, b: number, c: number, d: number): number;
11
8
  export function and(a: number, b: number): number;
12
9
  export function xor(a: number, b: number): number;
13
10
  export function sha256(a: number, b: number, c: number): void;
@@ -15,11 +12,14 @@ export function blake2s256(a: number, b: number, c: number): void;
15
12
  export function keccak256(a: number, b: number, c: number): void;
16
13
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
17
14
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
18
- export function buildInfo(): number;
19
15
  export function compressWitness(a: number, b: number): void;
20
16
  export function decompressWitness(a: number, b: number, c: number): void;
21
17
  export function compressWitnessStack(a: number, b: number): void;
22
18
  export function decompressWitnessStack(a: number, b: number, c: number): void;
19
+ export function initLogLevel(a: number, b: number, c: number): void;
20
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
21
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
22
+ export function executeProgram(a: number, b: number, c: number, d: number): number;
23
23
  export function __wbindgen_malloc(a: number): number;
24
24
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
25
25
  export const __wbindgen_export_2: WebAssembly.Table;