@aztec/noir-acvm_js 0.0.1-commit.6d63667d → 0.0.1-commit.858058eac

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.
@@ -5,6 +5,36 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
+ /**
9
+ * Sets the package's logging level.
10
+ *
11
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
12
+ */
13
+ export function initLogLevel(filter: string): void;
14
+ /**
15
+ * Performs a bitwise AND operation between `lhs` and `rhs`
16
+ */
17
+ export function and(lhs: string, rhs: string): string;
18
+ /**
19
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
20
+ */
21
+ export function xor(lhs: string, rhs: string): string;
22
+ /**
23
+ * Sha256 compression function
24
+ */
25
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
26
+ /**
27
+ * Calculates the Blake2s256 hash of the input bytes
28
+ */
29
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
30
+ /**
31
+ * Verifies a ECDSA signature over the secp256k1 curve.
32
+ */
33
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
34
+ /**
35
+ * Verifies a ECDSA signature over the secp256r1 curve.
36
+ */
37
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
8
38
  /**
9
39
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
10
40
  *
@@ -34,30 +64,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
34
64
  * @returns {WitnessStack} The decompressed witness stack.
35
65
  */
36
66
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
37
- /**
38
- * Performs a bitwise AND operation between `lhs` and `rhs`
39
- */
40
- export function and(lhs: string, rhs: string): string;
41
- /**
42
- * Performs a bitwise XOR operation between `lhs` and `rhs`
43
- */
44
- export function xor(lhs: string, rhs: string): string;
45
- /**
46
- * Sha256 compression function
47
- */
48
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
49
- /**
50
- * Calculates the Blake2s256 hash of the input bytes
51
- */
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;
61
67
  /**
62
68
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
63
69
  *
@@ -86,12 +92,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
86
92
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
87
93
  */
88
94
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
89
- /**
90
- * Sets the package's logging level.
91
- *
92
- * @param {LogLevel} level - The maximum level of logging to be emitted.
93
- */
94
- export function initLogLevel(filter: string): void;
95
95
  /**
96
96
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
97
  *
@@ -117,12 +117,17 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
117
117
  */
118
118
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
119
 
120
- export type StackItem = {
121
- index: number;
122
- witness: WitnessMap;
123
- }
120
+ export type ForeignCallInput = string[]
121
+ export type ForeignCallOutput = string | string[]
124
122
 
125
- export type WitnessStack = Array<StackItem>;
123
+ /**
124
+ * A callback which performs an foreign call and returns the response.
125
+ * @callback ForeignCallHandler
126
+ * @param {string} name - The identifier for the type of foreign call being performed.
127
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
128
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
129
+ */
130
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
126
131
 
127
132
 
128
133
 
@@ -140,17 +145,27 @@ export type BuildInfo = {
140
145
 
141
146
 
142
147
 
143
- export type ForeignCallInput = string[]
144
- export type ForeignCallOutput = string | string[]
148
+ // Map from witness index to hex string value of witness.
149
+ export type WitnessMap = Map<number, string>;
145
150
 
146
151
  /**
147
- * A callback which performs an foreign call and returns the response.
148
- * @callback ForeignCallHandler
149
- * @param {string} name - The identifier for the type of foreign call being performed.
150
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
151
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
152
- */
153
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
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>;
154
169
 
155
170
 
156
171
 
@@ -167,18 +182,3 @@ export type ExecutionError = Error & {
167
182
  };
168
183
 
169
184
 
170
-
171
- // Map from witness index to hex string value of witness.
172
- export type WitnessMap = Map<number, string>;
173
-
174
- /**
175
- * An execution result containing two witnesses.
176
- * 1. The full solved witness of the execution.
177
- * 2. The return witness which contains the given public return values within the full witness.
178
- */
179
- export type SolvedAndReturnWitness = {
180
- solvedWitness: WitnessMap;
181
- returnWitness: WitnessMap;
182
- }
183
-
184
-
package/nodejs/acvm_js.js CHANGED
@@ -215,80 +215,18 @@ function takeFromExternrefTable0(idx) {
215
215
  wasm.__externref_table_dealloc(idx);
216
216
  return value;
217
217
  }
218
-
219
- function getArrayU8FromWasm0(ptr, len) {
220
- ptr = ptr >>> 0;
221
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
222
- }
223
- /**
224
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
225
- *
226
- * @param {WitnessMap} witness_map - A witness map.
227
- * @returns {Uint8Array} A compressed witness map
228
- */
229
- module.exports.compressWitness = function(witness_map) {
230
- const ret = wasm.compressWitness(witness_map);
231
- if (ret[3]) {
232
- throw takeFromExternrefTable0(ret[2]);
233
- }
234
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
235
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
236
- return v1;
237
- };
238
-
239
- function passArray8ToWasm0(arg, malloc) {
240
- const ptr = malloc(arg.length * 1, 1) >>> 0;
241
- getUint8ArrayMemory0().set(arg, ptr / 1);
242
- WASM_VECTOR_LEN = arg.length;
243
- return ptr;
244
- }
245
218
  /**
246
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
247
- * This should be used to only fetch the witness map for the main function.
248
- *
249
- * @param {Uint8Array} compressed_witness - A compressed witness.
250
- * @returns {WitnessMap} The decompressed witness map.
251
- */
252
- module.exports.decompressWitness = function(compressed_witness) {
253
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ret = wasm.decompressWitness(ptr0, len0);
256
- if (ret[2]) {
257
- throw takeFromExternrefTable0(ret[1]);
258
- }
259
- return takeFromExternrefTable0(ret[0]);
260
- };
261
-
262
- /**
263
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
264
- *
265
- * @param {WitnessStack} witness_stack - A witness stack.
266
- * @returns {Uint8Array} A compressed witness stack
267
- */
268
- module.exports.compressWitnessStack = function(witness_stack) {
269
- const ret = wasm.compressWitnessStack(witness_stack);
270
- if (ret[3]) {
271
- throw takeFromExternrefTable0(ret[2]);
272
- }
273
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
274
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
275
- return v1;
276
- };
277
-
278
- /**
279
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
219
+ * Sets the package's logging level.
280
220
  *
281
- * @param {Uint8Array} compressed_witness - A compressed witness.
282
- * @returns {WitnessStack} The decompressed witness stack.
221
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
283
222
  */
284
- module.exports.decompressWitnessStack = function(compressed_witness) {
285
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
223
+ module.exports.initLogLevel = function(filter) {
224
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
286
225
  const len0 = WASM_VECTOR_LEN;
287
- const ret = wasm.decompressWitnessStack(ptr0, len0);
288
- if (ret[2]) {
289
- throw takeFromExternrefTable0(ret[1]);
226
+ const ret = wasm.initLogLevel(ptr0, len0);
227
+ if (ret[1]) {
228
+ throw takeFromExternrefTable0(ret[0]);
290
229
  }
291
- return takeFromExternrefTable0(ret[0]);
292
230
  };
293
231
 
294
232
  /**
@@ -350,6 +288,17 @@ module.exports.sha256_compression = function(inputs, state) {
350
288
  return v3;
351
289
  };
352
290
 
291
+ function passArray8ToWasm0(arg, malloc) {
292
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
293
+ getUint8ArrayMemory0().set(arg, ptr / 1);
294
+ WASM_VECTOR_LEN = arg.length;
295
+ return ptr;
296
+ }
297
+
298
+ function getArrayU8FromWasm0(ptr, len) {
299
+ ptr = ptr >>> 0;
300
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
301
+ }
353
302
  /**
354
303
  * Calculates the Blake2s256 hash of the input bytes
355
304
  * @param {Uint8Array} inputs
@@ -406,6 +355,71 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
406
355
  return ret !== 0;
407
356
  };
408
357
 
358
+ /**
359
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
360
+ *
361
+ * @param {WitnessMap} witness_map - A witness map.
362
+ * @returns {Uint8Array} A compressed witness map
363
+ */
364
+ module.exports.compressWitness = function(witness_map) {
365
+ const ret = wasm.compressWitness(witness_map);
366
+ if (ret[3]) {
367
+ throw takeFromExternrefTable0(ret[2]);
368
+ }
369
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
370
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
371
+ return v1;
372
+ };
373
+
374
+ /**
375
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
376
+ * This should be used to only fetch the witness map for the main function.
377
+ *
378
+ * @param {Uint8Array} compressed_witness - A compressed witness.
379
+ * @returns {WitnessMap} The decompressed witness map.
380
+ */
381
+ module.exports.decompressWitness = function(compressed_witness) {
382
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
383
+ const len0 = WASM_VECTOR_LEN;
384
+ const ret = wasm.decompressWitness(ptr0, len0);
385
+ if (ret[2]) {
386
+ throw takeFromExternrefTable0(ret[1]);
387
+ }
388
+ return takeFromExternrefTable0(ret[0]);
389
+ };
390
+
391
+ /**
392
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
393
+ *
394
+ * @param {WitnessStack} witness_stack - A witness stack.
395
+ * @returns {Uint8Array} A compressed witness stack
396
+ */
397
+ module.exports.compressWitnessStack = function(witness_stack) {
398
+ const ret = wasm.compressWitnessStack(witness_stack);
399
+ if (ret[3]) {
400
+ throw takeFromExternrefTable0(ret[2]);
401
+ }
402
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
403
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
404
+ return v1;
405
+ };
406
+
407
+ /**
408
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
409
+ *
410
+ * @param {Uint8Array} compressed_witness - A compressed witness.
411
+ * @returns {WitnessStack} The decompressed witness stack.
412
+ */
413
+ module.exports.decompressWitnessStack = function(compressed_witness) {
414
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
415
+ const len0 = WASM_VECTOR_LEN;
416
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
417
+ if (ret[2]) {
418
+ throw takeFromExternrefTable0(ret[1]);
419
+ }
420
+ return takeFromExternrefTable0(ret[0]);
421
+ };
422
+
409
423
  /**
410
424
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
411
425
  *
@@ -452,20 +466,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
452
466
  return ret;
453
467
  };
454
468
 
455
- /**
456
- * Sets the package's logging level.
457
- *
458
- * @param {LogLevel} level - The maximum level of logging to be emitted.
459
- */
460
- module.exports.initLogLevel = function(filter) {
461
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
462
- const len0 = WASM_VECTOR_LEN;
463
- const ret = wasm.initLogLevel(ptr0, len0);
464
- if (ret[1]) {
465
- throw takeFromExternrefTable0(ret[0]);
466
- }
467
- };
468
-
469
469
  /**
470
470
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
471
471
  *
@@ -527,15 +527,15 @@ module.exports.getPublicWitness = function(program, solved_witness) {
527
527
  };
528
528
 
529
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure448_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure445_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure921_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure925_externref_shim(arg0, arg1, arg2, arg3);
539
539
  }
540
540
 
541
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
813
  return ret;
814
814
  };
815
815
 
816
- module.exports.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1365 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -2,20 +2,20 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
- export const compressWitness: (a: any) => [number, number, number, number];
6
- export const decompressWitness: (a: number, b: number) => [number, number, number];
7
- export const compressWitnessStack: (a: any) => [number, number, number, number];
8
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
5
+ export const initLogLevel: (a: number, b: number) => [number, number];
9
6
  export const and: (a: any, b: any) => any;
10
7
  export const xor: (a: any, b: any) => any;
11
8
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
12
9
  export const blake2s256: (a: number, b: number) => [number, number];
13
10
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
14
11
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
12
+ export const compressWitness: (a: any) => [number, number, number, number];
13
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
14
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
15
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
15
16
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
16
17
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
17
18
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
18
- export const initLogLevel: (a: number, b: number) => [number, number];
19
19
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
20
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
21
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
@@ -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 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;
30
+ export const closure445_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure925_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.6d63667d",
3
+ "version": "0.0.1-commit.858058eac",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -5,6 +5,36 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
+ /**
9
+ * Sets the package's logging level.
10
+ *
11
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
12
+ */
13
+ export function initLogLevel(filter: string): void;
14
+ /**
15
+ * Performs a bitwise AND operation between `lhs` and `rhs`
16
+ */
17
+ export function and(lhs: string, rhs: string): string;
18
+ /**
19
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
20
+ */
21
+ export function xor(lhs: string, rhs: string): string;
22
+ /**
23
+ * Sha256 compression function
24
+ */
25
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
26
+ /**
27
+ * Calculates the Blake2s256 hash of the input bytes
28
+ */
29
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
30
+ /**
31
+ * Verifies a ECDSA signature over the secp256k1 curve.
32
+ */
33
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
34
+ /**
35
+ * Verifies a ECDSA signature over the secp256r1 curve.
36
+ */
37
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
8
38
  /**
9
39
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
10
40
  *
@@ -34,30 +64,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
34
64
  * @returns {WitnessStack} The decompressed witness stack.
35
65
  */
36
66
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
37
- /**
38
- * Performs a bitwise AND operation between `lhs` and `rhs`
39
- */
40
- export function and(lhs: string, rhs: string): string;
41
- /**
42
- * Performs a bitwise XOR operation between `lhs` and `rhs`
43
- */
44
- export function xor(lhs: string, rhs: string): string;
45
- /**
46
- * Sha256 compression function
47
- */
48
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
49
- /**
50
- * Calculates the Blake2s256 hash of the input bytes
51
- */
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;
61
67
  /**
62
68
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
63
69
  *
@@ -86,12 +92,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
86
92
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
87
93
  */
88
94
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
89
- /**
90
- * Sets the package's logging level.
91
- *
92
- * @param {LogLevel} level - The maximum level of logging to be emitted.
93
- */
94
- export function initLogLevel(filter: string): void;
95
95
  /**
96
96
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
97
97
  *
@@ -117,12 +117,17 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
117
117
  */
118
118
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
119
 
120
- export type StackItem = {
121
- index: number;
122
- witness: WitnessMap;
123
- }
120
+ export type ForeignCallInput = string[]
121
+ export type ForeignCallOutput = string | string[]
124
122
 
125
- export type WitnessStack = Array<StackItem>;
123
+ /**
124
+ * A callback which performs an foreign call and returns the response.
125
+ * @callback ForeignCallHandler
126
+ * @param {string} name - The identifier for the type of foreign call being performed.
127
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
128
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
129
+ */
130
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
126
131
 
127
132
 
128
133
 
@@ -140,17 +145,27 @@ export type BuildInfo = {
140
145
 
141
146
 
142
147
 
143
- export type ForeignCallInput = string[]
144
- export type ForeignCallOutput = string | string[]
148
+ // Map from witness index to hex string value of witness.
149
+ export type WitnessMap = Map<number, string>;
145
150
 
146
151
  /**
147
- * A callback which performs an foreign call and returns the response.
148
- * @callback ForeignCallHandler
149
- * @param {string} name - The identifier for the type of foreign call being performed.
150
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
151
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
152
- */
153
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
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>;
154
169
 
155
170
 
156
171
 
@@ -168,40 +183,25 @@ export type ExecutionError = Error & {
168
183
 
169
184
 
170
185
 
171
- // Map from witness index to hex string value of witness.
172
- export type WitnessMap = Map<number, string>;
173
-
174
- /**
175
- * An execution result containing two witnesses.
176
- * 1. The full solved witness of the execution.
177
- * 2. The return witness which contains the given public return values within the full witness.
178
- */
179
- export type SolvedAndReturnWitness = {
180
- solvedWitness: WitnessMap;
181
- returnWitness: WitnessMap;
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
190
  readonly buildInfo: () => any;
191
- readonly compressWitness: (a: any) => [number, number, number, number];
192
- readonly decompressWitness: (a: number, b: number) => [number, number, number];
193
- readonly compressWitnessStack: (a: any) => [number, number, number, number];
194
- readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
191
+ readonly initLogLevel: (a: number, b: number) => [number, number];
195
192
  readonly and: (a: any, b: any) => any;
196
193
  readonly xor: (a: any, b: any) => any;
197
194
  readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
198
195
  readonly blake2s256: (a: number, b: number) => [number, number];
199
196
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
200
197
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
198
+ readonly compressWitness: (a: any) => [number, number, number, number];
199
+ readonly decompressWitness: (a: number, b: number) => [number, number, number];
200
+ readonly compressWitnessStack: (a: any) => [number, number, number, number];
201
+ readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
201
202
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
202
203
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
203
204
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
204
- readonly initLogLevel: (a: number, b: number) => [number, number];
205
205
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
206
206
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
207
207
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
@@ -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 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;
216
+ readonly closure445_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure925_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
@@ -211,80 +211,18 @@ function takeFromExternrefTable0(idx) {
211
211
  wasm.__externref_table_dealloc(idx);
212
212
  return value;
213
213
  }
214
-
215
- function getArrayU8FromWasm0(ptr, len) {
216
- ptr = ptr >>> 0;
217
- return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
218
- }
219
- /**
220
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
221
- *
222
- * @param {WitnessMap} witness_map - A witness map.
223
- * @returns {Uint8Array} A compressed witness map
224
- */
225
- export function compressWitness(witness_map) {
226
- const ret = wasm.compressWitness(witness_map);
227
- if (ret[3]) {
228
- throw takeFromExternrefTable0(ret[2]);
229
- }
230
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
231
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
232
- return v1;
233
- }
234
-
235
- function passArray8ToWasm0(arg, malloc) {
236
- const ptr = malloc(arg.length * 1, 1) >>> 0;
237
- getUint8ArrayMemory0().set(arg, ptr / 1);
238
- WASM_VECTOR_LEN = arg.length;
239
- return ptr;
240
- }
241
214
  /**
242
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
243
- * This should be used to only fetch the witness map for the main function.
244
- *
245
- * @param {Uint8Array} compressed_witness - A compressed witness.
246
- * @returns {WitnessMap} The decompressed witness map.
247
- */
248
- export function decompressWitness(compressed_witness) {
249
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
250
- const len0 = WASM_VECTOR_LEN;
251
- const ret = wasm.decompressWitness(ptr0, len0);
252
- if (ret[2]) {
253
- throw takeFromExternrefTable0(ret[1]);
254
- }
255
- return takeFromExternrefTable0(ret[0]);
256
- }
257
-
258
- /**
259
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
260
- *
261
- * @param {WitnessStack} witness_stack - A witness stack.
262
- * @returns {Uint8Array} A compressed witness stack
263
- */
264
- export function compressWitnessStack(witness_stack) {
265
- const ret = wasm.compressWitnessStack(witness_stack);
266
- if (ret[3]) {
267
- throw takeFromExternrefTable0(ret[2]);
268
- }
269
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
270
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
271
- return v1;
272
- }
273
-
274
- /**
275
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
215
+ * Sets the package's logging level.
276
216
  *
277
- * @param {Uint8Array} compressed_witness - A compressed witness.
278
- * @returns {WitnessStack} The decompressed witness stack.
217
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
279
218
  */
280
- export function decompressWitnessStack(compressed_witness) {
281
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
219
+ export function initLogLevel(filter) {
220
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
282
221
  const len0 = WASM_VECTOR_LEN;
283
- const ret = wasm.decompressWitnessStack(ptr0, len0);
284
- if (ret[2]) {
285
- throw takeFromExternrefTable0(ret[1]);
222
+ const ret = wasm.initLogLevel(ptr0, len0);
223
+ if (ret[1]) {
224
+ throw takeFromExternrefTable0(ret[0]);
286
225
  }
287
- return takeFromExternrefTable0(ret[0]);
288
226
  }
289
227
 
290
228
  /**
@@ -346,6 +284,17 @@ export function sha256_compression(inputs, state) {
346
284
  return v3;
347
285
  }
348
286
 
287
+ function passArray8ToWasm0(arg, malloc) {
288
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
289
+ getUint8ArrayMemory0().set(arg, ptr / 1);
290
+ WASM_VECTOR_LEN = arg.length;
291
+ return ptr;
292
+ }
293
+
294
+ function getArrayU8FromWasm0(ptr, len) {
295
+ ptr = ptr >>> 0;
296
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
297
+ }
349
298
  /**
350
299
  * Calculates the Blake2s256 hash of the input bytes
351
300
  * @param {Uint8Array} inputs
@@ -402,6 +351,71 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
402
351
  return ret !== 0;
403
352
  }
404
353
 
354
+ /**
355
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
356
+ *
357
+ * @param {WitnessMap} witness_map - A witness map.
358
+ * @returns {Uint8Array} A compressed witness map
359
+ */
360
+ export function compressWitness(witness_map) {
361
+ const ret = wasm.compressWitness(witness_map);
362
+ if (ret[3]) {
363
+ throw takeFromExternrefTable0(ret[2]);
364
+ }
365
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
366
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
367
+ return v1;
368
+ }
369
+
370
+ /**
371
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
372
+ * This should be used to only fetch the witness map for the main function.
373
+ *
374
+ * @param {Uint8Array} compressed_witness - A compressed witness.
375
+ * @returns {WitnessMap} The decompressed witness map.
376
+ */
377
+ export function decompressWitness(compressed_witness) {
378
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
379
+ const len0 = WASM_VECTOR_LEN;
380
+ const ret = wasm.decompressWitness(ptr0, len0);
381
+ if (ret[2]) {
382
+ throw takeFromExternrefTable0(ret[1]);
383
+ }
384
+ return takeFromExternrefTable0(ret[0]);
385
+ }
386
+
387
+ /**
388
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
389
+ *
390
+ * @param {WitnessStack} witness_stack - A witness stack.
391
+ * @returns {Uint8Array} A compressed witness stack
392
+ */
393
+ export function compressWitnessStack(witness_stack) {
394
+ const ret = wasm.compressWitnessStack(witness_stack);
395
+ if (ret[3]) {
396
+ throw takeFromExternrefTable0(ret[2]);
397
+ }
398
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
399
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
400
+ return v1;
401
+ }
402
+
403
+ /**
404
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
405
+ *
406
+ * @param {Uint8Array} compressed_witness - A compressed witness.
407
+ * @returns {WitnessStack} The decompressed witness stack.
408
+ */
409
+ export function decompressWitnessStack(compressed_witness) {
410
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
411
+ const len0 = WASM_VECTOR_LEN;
412
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
413
+ if (ret[2]) {
414
+ throw takeFromExternrefTable0(ret[1]);
415
+ }
416
+ return takeFromExternrefTable0(ret[0]);
417
+ }
418
+
405
419
  /**
406
420
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
407
421
  *
@@ -448,20 +462,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
448
462
  return ret;
449
463
  }
450
464
 
451
- /**
452
- * Sets the package's logging level.
453
- *
454
- * @param {LogLevel} level - The maximum level of logging to be emitted.
455
- */
456
- export function initLogLevel(filter) {
457
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
458
- const len0 = WASM_VECTOR_LEN;
459
- const ret = wasm.initLogLevel(ptr0, len0);
460
- if (ret[1]) {
461
- throw takeFromExternrefTable0(ret[0]);
462
- }
463
- }
464
-
465
465
  /**
466
466
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
467
467
  *
@@ -523,15 +523,15 @@ export function getPublicWitness(program, solved_witness) {
523
523
  }
524
524
 
525
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure448_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure445_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure921_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure925_externref_shim(arg0, arg1, arg2, arg3);
535
535
  }
536
536
 
537
537
  async function __wbg_load(module, imports) {
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
797
797
  const ret = false;
798
798
  return ret;
799
799
  };
800
- imports.wbg.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1365 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -2,20 +2,20 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
- export const compressWitness: (a: any) => [number, number, number, number];
6
- export const decompressWitness: (a: number, b: number) => [number, number, number];
7
- export const compressWitnessStack: (a: any) => [number, number, number, number];
8
- export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
5
+ export const initLogLevel: (a: number, b: number) => [number, number];
9
6
  export const and: (a: any, b: any) => any;
10
7
  export const xor: (a: any, b: any) => any;
11
8
  export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
12
9
  export const blake2s256: (a: number, b: number) => [number, number];
13
10
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
14
11
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
12
+ export const compressWitness: (a: any) => [number, number, number, number];
13
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
14
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
15
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
15
16
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
16
17
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
17
18
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
18
- export const initLogLevel: (a: number, b: number) => [number, number];
19
19
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
20
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
21
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
@@ -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 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;
30
+ export const closure445_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure925_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;