@noir-lang/acvm_js 1.0.0-beta.2-582f56e.nightly → 1.0.0-beta.2-49a095d.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.
@@ -7,34 +7,6 @@
7
7
  */
8
8
  export function initLogLevel(filter: string): void;
9
9
  /**
10
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
11
- *
12
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
13
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
14
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
15
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
16
- */
17
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
18
- /**
19
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
20
- * This method also extracts the public return values from the solved witness into its own return witness.
21
- *
22
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
23
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
24
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
25
- * @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.
26
- */
27
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
28
- /**
29
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
30
- *
31
- * @param {Uint8Array} program - A serialized representation of an ACIR program
32
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
33
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
34
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
35
- */
36
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
37
- /**
38
10
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
39
11
  *
40
12
  * @param {WitnessMap} witness_map - A witness map.
@@ -64,6 +36,34 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
64
36
  */
65
37
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
66
38
  /**
39
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
40
+ *
41
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
42
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
43
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
44
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
45
+ */
46
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
47
+ /**
48
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
49
+ * This method also extracts the public return values from the solved witness into its own return witness.
50
+ *
51
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
52
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
53
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
54
+ * @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.
55
+ */
56
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
57
+ /**
58
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
59
+ *
60
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
61
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
62
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
63
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
64
+ */
65
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
66
+ /**
67
67
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
68
  * @param {string} lhs
69
69
  * @param {string} rhs
package/nodejs/acvm_js.js CHANGED
@@ -241,58 +241,6 @@ module.exports.initLogLevel = function(filter) {
241
241
  }
242
242
  };
243
243
 
244
- function passArray8ToWasm0(arg, malloc) {
245
- const ptr = malloc(arg.length * 1) >>> 0;
246
- getUint8Memory0().set(arg, ptr / 1);
247
- WASM_VECTOR_LEN = arg.length;
248
- return ptr;
249
- }
250
- /**
251
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
252
- *
253
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
254
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
255
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
256
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
257
- */
258
- module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
259
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
260
- const len0 = WASM_VECTOR_LEN;
261
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
262
- return takeObject(ret);
263
- };
264
-
265
- /**
266
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
267
- * This method also extracts the public return values from the solved witness into its own return witness.
268
- *
269
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
270
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
271
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
272
- * @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.
273
- */
274
- module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
275
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
276
- const len0 = WASM_VECTOR_LEN;
277
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
278
- return takeObject(ret);
279
- };
280
-
281
- /**
282
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
283
- *
284
- * @param {Uint8Array} program - A serialized representation of an ACIR program
285
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
286
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
287
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
288
- */
289
- module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
290
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
291
- const len0 = WASM_VECTOR_LEN;
292
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
293
- return takeObject(ret);
294
- };
295
-
296
244
  function getArrayU8FromWasm0(ptr, len) {
297
245
  ptr = ptr >>> 0;
298
246
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
@@ -322,6 +270,12 @@ module.exports.compressWitness = function(witness_map) {
322
270
  }
323
271
  };
324
272
 
273
+ function passArray8ToWasm0(arg, malloc) {
274
+ const ptr = malloc(arg.length * 1) >>> 0;
275
+ getUint8Memory0().set(arg, ptr / 1);
276
+ WASM_VECTOR_LEN = arg.length;
277
+ return ptr;
278
+ }
325
279
  /**
326
280
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
327
281
  * This should be used to only fetch the witness map for the main function.
@@ -396,6 +350,52 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
396
350
  }
397
351
  };
398
352
 
353
+ /**
354
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
355
+ *
356
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
357
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
358
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
359
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
360
+ */
361
+ module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
362
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
363
+ const len0 = WASM_VECTOR_LEN;
364
+ const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
365
+ return takeObject(ret);
366
+ };
367
+
368
+ /**
369
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
370
+ * This method also extracts the public return values from the solved witness into its own return witness.
371
+ *
372
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
373
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
374
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
375
+ * @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.
376
+ */
377
+ module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
378
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
379
+ const len0 = WASM_VECTOR_LEN;
380
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
381
+ return takeObject(ret);
382
+ };
383
+
384
+ /**
385
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
386
+ *
387
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
388
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
389
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
390
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
391
+ */
392
+ module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
393
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
394
+ const len0 = WASM_VECTOR_LEN;
395
+ const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
396
+ return takeObject(ret);
397
+ };
398
+
399
399
  /**
400
400
  * Performs a bitwise AND operation between `lhs` and `rhs`
401
401
  * @param {string} lhs
@@ -633,6 +633,11 @@ function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
633
633
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h7636f3796134b93b(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
634
634
  }
635
635
 
636
+ module.exports.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
637
+ const ret = new Error(takeObject(arg0));
638
+ return addHeapObject(ret);
639
+ };
640
+
636
641
  module.exports.__wbindgen_object_drop_ref = function(arg0) {
637
642
  takeObject(arg0);
638
643
  };
@@ -647,11 +652,6 @@ module.exports.__wbindgen_is_array = function(arg0) {
647
652
  return ret;
648
653
  };
649
654
 
650
- module.exports.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
651
- const ret = new Error(takeObject(arg0));
652
- return addHeapObject(ret);
653
- };
654
-
655
655
  module.exports.__wbg_new_35cd49f1520efef9 = function() {
656
656
  const ret = new Map();
657
657
  return addHeapObject(ret);
@@ -916,8 +916,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
916
916
  throw new Error(getStringFromWasm0(arg0, arg1));
917
917
  };
918
918
 
919
- module.exports.__wbindgen_closure_wrapper782 = function(arg0, arg1, arg2) {
920
- const ret = makeMutClosure(arg0, arg1, 300, __wbg_adapter_22);
919
+ module.exports.__wbindgen_closure_wrapper777 = function(arg0, arg1, arg2) {
920
+ const ret = makeMutClosure(arg0, arg1, 296, __wbg_adapter_22);
921
921
  return addHeapObject(ret);
922
922
  };
923
923
 
Binary file
@@ -2,13 +2,13 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function initLogLevel(a: number, b: number, c: number): void;
5
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
6
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
7
- export function executeProgram(a: number, b: number, c: number, d: number): number;
8
5
  export function compressWitness(a: number, b: number): void;
9
6
  export function decompressWitness(a: number, b: number, c: number): void;
10
7
  export function compressWitnessStack(a: number, b: number): void;
11
8
  export function decompressWitnessStack(a: number, b: number, c: number): void;
9
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
10
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
11
+ export function executeProgram(a: number, b: number, c: number, d: number): number;
12
12
  export function and(a: number, b: number): number;
13
13
  export function xor(a: number, b: number): number;
14
14
  export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "1.0.0-beta.2-582f56e.nightly",
3
+ "version": "1.0.0-beta.2-49a095d.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -7,34 +7,6 @@
7
7
  */
8
8
  export function initLogLevel(filter: string): void;
9
9
  /**
10
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
11
- *
12
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
13
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
14
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
15
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
16
- */
17
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
18
- /**
19
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
20
- * This method also extracts the public return values from the solved witness into its own return witness.
21
- *
22
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
23
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
24
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
25
- * @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.
26
- */
27
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
28
- /**
29
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
30
- *
31
- * @param {Uint8Array} program - A serialized representation of an ACIR program
32
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
33
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
34
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
35
- */
36
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
37
- /**
38
10
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
39
11
  *
40
12
  * @param {WitnessMap} witness_map - A witness map.
@@ -64,6 +36,34 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
64
36
  */
65
37
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
66
38
  /**
39
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
40
+ *
41
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
42
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
43
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
44
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
45
+ */
46
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
47
+ /**
48
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
49
+ * This method also extracts the public return values from the solved witness into its own return witness.
50
+ *
51
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
52
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
53
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
54
+ * @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.
55
+ */
56
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
57
+ /**
58
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
59
+ *
60
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
61
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
62
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
63
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
64
+ */
65
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
66
+ /**
67
67
  * Performs a bitwise AND operation between `lhs` and `rhs`
68
68
  * @param {string} lhs
69
69
  * @param {string} rhs
@@ -217,13 +217,13 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
217
217
  export interface InitOutput {
218
218
  readonly memory: WebAssembly.Memory;
219
219
  readonly initLogLevel: (a: number, b: number, c: number) => void;
220
- readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
221
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
222
- readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
223
220
  readonly compressWitness: (a: number, b: number) => void;
224
221
  readonly decompressWitness: (a: number, b: number, c: number) => void;
225
222
  readonly compressWitnessStack: (a: number, b: number) => void;
226
223
  readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
224
+ readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
225
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
226
+ readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
227
227
  readonly and: (a: number, b: number) => number;
228
228
  readonly xor: (a: number, b: number) => number;
229
229
  readonly sha256_compression: (a: number, b: number, c: number, d: number, e: number) => void;
package/web/acvm_js.js CHANGED
@@ -238,58 +238,6 @@ export function initLogLevel(filter) {
238
238
  }
239
239
  }
240
240
 
241
- function passArray8ToWasm0(arg, malloc) {
242
- const ptr = malloc(arg.length * 1) >>> 0;
243
- getUint8Memory0().set(arg, ptr / 1);
244
- WASM_VECTOR_LEN = arg.length;
245
- return ptr;
246
- }
247
- /**
248
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
249
- *
250
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
251
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
252
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
253
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
254
- */
255
- export function executeCircuit(program, initial_witness, foreign_call_handler) {
256
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
257
- const len0 = WASM_VECTOR_LEN;
258
- const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
259
- return takeObject(ret);
260
- }
261
-
262
- /**
263
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
264
- * This method also extracts the public return values from the solved witness into its own return witness.
265
- *
266
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
267
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
268
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
269
- * @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.
270
- */
271
- export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
272
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
273
- const len0 = WASM_VECTOR_LEN;
274
- const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
275
- return takeObject(ret);
276
- }
277
-
278
- /**
279
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
280
- *
281
- * @param {Uint8Array} program - A serialized representation of an ACIR program
282
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
283
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
284
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
285
- */
286
- export function executeProgram(program, initial_witness, foreign_call_handler) {
287
- const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
288
- const len0 = WASM_VECTOR_LEN;
289
- const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
290
- return takeObject(ret);
291
- }
292
-
293
241
  function getArrayU8FromWasm0(ptr, len) {
294
242
  ptr = ptr >>> 0;
295
243
  return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
@@ -319,6 +267,12 @@ export function compressWitness(witness_map) {
319
267
  }
320
268
  }
321
269
 
270
+ function passArray8ToWasm0(arg, malloc) {
271
+ const ptr = malloc(arg.length * 1) >>> 0;
272
+ getUint8Memory0().set(arg, ptr / 1);
273
+ WASM_VECTOR_LEN = arg.length;
274
+ return ptr;
275
+ }
322
276
  /**
323
277
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
324
278
  * This should be used to only fetch the witness map for the main function.
@@ -393,6 +347,52 @@ export function decompressWitnessStack(compressed_witness) {
393
347
  }
394
348
  }
395
349
 
350
+ /**
351
+ * Executes an ACIR circuit to generate the solved witness from the initial 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 {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
357
+ */
358
+ export function executeCircuit(program, initial_witness, foreign_call_handler) {
359
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
360
+ const len0 = WASM_VECTOR_LEN;
361
+ const ret = wasm.executeCircuit(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
+ * This method also extracts the public return values from the solved witness into its own return witness.
368
+ *
369
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
370
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
371
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
372
+ * @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.
373
+ */
374
+ export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
375
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
376
+ const len0 = WASM_VECTOR_LEN;
377
+ const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
378
+ return takeObject(ret);
379
+ }
380
+
381
+ /**
382
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
383
+ *
384
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
385
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
386
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
387
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
388
+ */
389
+ export function executeProgram(program, initial_witness, foreign_call_handler) {
390
+ const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
391
+ const len0 = WASM_VECTOR_LEN;
392
+ const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
393
+ return takeObject(ret);
394
+ }
395
+
396
396
  /**
397
397
  * Performs a bitwise AND operation between `lhs` and `rhs`
398
398
  * @param {string} lhs
@@ -664,6 +664,10 @@ async function __wbg_load(module, imports) {
664
664
  function __wbg_get_imports() {
665
665
  const imports = {};
666
666
  imports.wbg = {};
667
+ imports.wbg.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
668
+ const ret = new Error(takeObject(arg0));
669
+ return addHeapObject(ret);
670
+ };
667
671
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
668
672
  takeObject(arg0);
669
673
  };
@@ -675,10 +679,6 @@ function __wbg_get_imports() {
675
679
  const ret = Array.isArray(getObject(arg0));
676
680
  return ret;
677
681
  };
678
- imports.wbg.__wbg_constructor_7d42f5e2b3ae2f5e = function(arg0) {
679
- const ret = new Error(takeObject(arg0));
680
- return addHeapObject(ret);
681
- };
682
682
  imports.wbg.__wbg_new_35cd49f1520efef9 = function() {
683
683
  const ret = new Map();
684
684
  return addHeapObject(ret);
@@ -901,8 +901,8 @@ function __wbg_get_imports() {
901
901
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
902
902
  throw new Error(getStringFromWasm0(arg0, arg1));
903
903
  };
904
- imports.wbg.__wbindgen_closure_wrapper782 = function(arg0, arg1, arg2) {
905
- const ret = makeMutClosure(arg0, arg1, 300, __wbg_adapter_22);
904
+ imports.wbg.__wbindgen_closure_wrapper777 = function(arg0, arg1, arg2) {
905
+ const ret = makeMutClosure(arg0, arg1, 296, __wbg_adapter_22);
906
906
  return addHeapObject(ret);
907
907
  };
908
908
 
Binary file
@@ -2,13 +2,13 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function initLogLevel(a: number, b: number, c: number): void;
5
- export function executeCircuit(a: number, b: number, c: number, d: number): number;
6
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
7
- export function executeProgram(a: number, b: number, c: number, d: number): number;
8
5
  export function compressWitness(a: number, b: number): void;
9
6
  export function decompressWitness(a: number, b: number, c: number): void;
10
7
  export function compressWitnessStack(a: number, b: number): void;
11
8
  export function decompressWitnessStack(a: number, b: number, c: number): void;
9
+ export function executeCircuit(a: number, b: number, c: number, d: number): number;
10
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
11
+ export function executeProgram(a: number, b: number, c: number, d: number): number;
12
12
  export function and(a: number, b: number): number;
13
13
  export function xor(a: number, b: number): number;
14
14
  export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;