@aztec/noir-acvm_js 0.85.0 → 0.86.0

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,41 +5,6 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
- /**
9
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
10
- *
11
- * @param {WitnessMap} witness_map - A witness map.
12
- * @returns {Uint8Array} A compressed witness map
13
- */
14
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
15
- /**
16
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
17
- * This should be used to only fetch the witness map for the main function.
18
- *
19
- * @param {Uint8Array} compressed_witness - A compressed witness.
20
- * @returns {WitnessMap} The decompressed witness map.
21
- */
22
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
23
- /**
24
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
25
- *
26
- * @param {WitnessStack} witness_stack - A witness stack.
27
- * @returns {Uint8Array} A compressed witness stack
28
- */
29
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
30
- /**
31
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
32
- *
33
- * @param {Uint8Array} compressed_witness - A compressed witness.
34
- * @returns {WitnessStack} The decompressed witness stack.
35
- */
36
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
37
- /**
38
- * Sets the package's logging level.
39
- *
40
- * @param {LogLevel} level - The maximum level of logging to be emitted.
41
- */
42
- export function initLogLevel(filter: string): void;
43
8
  /**
44
9
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
45
10
  *
@@ -116,6 +81,41 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
116
81
  * Verifies a ECDSA signature over the secp256r1 curve.
117
82
  */
118
83
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
84
+ /**
85
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
86
+ *
87
+ * @param {WitnessMap} witness_map - A witness map.
88
+ * @returns {Uint8Array} A compressed witness map
89
+ */
90
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
91
+ /**
92
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
93
+ * This should be used to only fetch the witness map for the main function.
94
+ *
95
+ * @param {Uint8Array} compressed_witness - A compressed witness.
96
+ * @returns {WitnessMap} The decompressed witness map.
97
+ */
98
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
99
+ /**
100
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
101
+ *
102
+ * @param {WitnessStack} witness_stack - A witness stack.
103
+ * @returns {Uint8Array} A compressed witness stack
104
+ */
105
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
106
+ /**
107
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
108
+ *
109
+ * @param {Uint8Array} compressed_witness - A compressed witness.
110
+ * @returns {WitnessStack} The decompressed witness stack.
111
+ */
112
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
113
+ /**
114
+ * Sets the package's logging level.
115
+ *
116
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
117
+ */
118
+ export function initLogLevel(filter: string): void;
119
119
 
120
120
  /**
121
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -131,21 +131,6 @@ export type BuildInfo = {
131
131
 
132
132
 
133
133
 
134
- // Map from witness index to hex string value of witness.
135
- export type WitnessMap = Map<number, string>;
136
-
137
- /**
138
- * An execution result containing two witnesses.
139
- * 1. The full solved witness of the execution.
140
- * 2. The return witness which contains the given public return values within the full witness.
141
- */
142
- export type SolvedAndReturnWitness = {
143
- solvedWitness: WitnessMap;
144
- returnWitness: WitnessMap;
145
- }
146
-
147
-
148
-
149
134
  export type RawAssertionPayload = {
150
135
  selector: string;
151
136
  data: string[];
@@ -154,6 +139,7 @@ export type RawAssertionPayload = {
154
139
  export type ExecutionError = Error & {
155
140
  callStack?: string[];
156
141
  rawAssertionPayload?: RawAssertionPayload;
142
+ acirFunctionId?: number;
157
143
  brilligFunctionId?: number;
158
144
  };
159
145
 
@@ -181,3 +167,18 @@ export type StackItem = {
181
167
  export type WitnessStack = Array<StackItem>;
182
168
 
183
169
 
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
@@ -210,101 +210,12 @@ module.exports.buildInfo = function() {
210
210
  return ret;
211
211
  };
212
212
 
213
- function takeFromExternrefTable0(idx) {
214
- const value = wasm.__wbindgen_export_2.get(idx);
215
- wasm.__externref_table_dealloc(idx);
216
- return value;
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
213
  function passArray8ToWasm0(arg, malloc) {
240
214
  const ptr = malloc(arg.length * 1, 1) >>> 0;
241
215
  getUint8ArrayMemory0().set(arg, ptr / 1);
242
216
  WASM_VECTOR_LEN = arg.length;
243
217
  return ptr;
244
218
  }
245
- /**
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`.
280
- *
281
- * @param {Uint8Array} compressed_witness - A compressed witness.
282
- * @returns {WitnessStack} The decompressed witness stack.
283
- */
284
- module.exports.decompressWitnessStack = function(compressed_witness) {
285
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
286
- const len0 = WASM_VECTOR_LEN;
287
- const ret = wasm.decompressWitnessStack(ptr0, len0);
288
- if (ret[2]) {
289
- throw takeFromExternrefTable0(ret[1]);
290
- }
291
- return takeFromExternrefTable0(ret[0]);
292
- };
293
-
294
- /**
295
- * Sets the package's logging level.
296
- *
297
- * @param {LogLevel} level - The maximum level of logging to be emitted.
298
- */
299
- module.exports.initLogLevel = function(filter) {
300
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
301
- const len0 = WASM_VECTOR_LEN;
302
- const ret = wasm.initLogLevel(ptr0, len0);
303
- if (ret[1]) {
304
- throw takeFromExternrefTable0(ret[0]);
305
- }
306
- };
307
-
308
219
  /**
309
220
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
310
221
  *
@@ -351,6 +262,11 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
351
262
  return ret;
352
263
  };
353
264
 
265
+ function takeFromExternrefTable0(idx) {
266
+ const value = wasm.__wbindgen_export_2.get(idx);
267
+ wasm.__externref_table_dealloc(idx);
268
+ return value;
269
+ }
354
270
  /**
355
271
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
356
272
  *
@@ -470,6 +386,10 @@ module.exports.sha256_compression = function(inputs, state) {
470
386
  return v3;
471
387
  };
472
388
 
389
+ function getArrayU8FromWasm0(ptr, len) {
390
+ ptr = ptr >>> 0;
391
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
392
+ }
473
393
  /**
474
394
  * Calculates the Blake2s256 hash of the input bytes
475
395
  * @param {Uint8Array} inputs
@@ -526,6 +446,85 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
526
446
  return ret !== 0;
527
447
  };
528
448
 
449
+ /**
450
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
451
+ *
452
+ * @param {WitnessMap} witness_map - A witness map.
453
+ * @returns {Uint8Array} A compressed witness map
454
+ */
455
+ module.exports.compressWitness = function(witness_map) {
456
+ const ret = wasm.compressWitness(witness_map);
457
+ if (ret[3]) {
458
+ throw takeFromExternrefTable0(ret[2]);
459
+ }
460
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
461
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
462
+ return v1;
463
+ };
464
+
465
+ /**
466
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
467
+ * This should be used to only fetch the witness map for the main function.
468
+ *
469
+ * @param {Uint8Array} compressed_witness - A compressed witness.
470
+ * @returns {WitnessMap} The decompressed witness map.
471
+ */
472
+ module.exports.decompressWitness = function(compressed_witness) {
473
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
474
+ const len0 = WASM_VECTOR_LEN;
475
+ const ret = wasm.decompressWitness(ptr0, len0);
476
+ if (ret[2]) {
477
+ throw takeFromExternrefTable0(ret[1]);
478
+ }
479
+ return takeFromExternrefTable0(ret[0]);
480
+ };
481
+
482
+ /**
483
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
484
+ *
485
+ * @param {WitnessStack} witness_stack - A witness stack.
486
+ * @returns {Uint8Array} A compressed witness stack
487
+ */
488
+ module.exports.compressWitnessStack = function(witness_stack) {
489
+ const ret = wasm.compressWitnessStack(witness_stack);
490
+ if (ret[3]) {
491
+ throw takeFromExternrefTable0(ret[2]);
492
+ }
493
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
494
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
495
+ return v1;
496
+ };
497
+
498
+ /**
499
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
500
+ *
501
+ * @param {Uint8Array} compressed_witness - A compressed witness.
502
+ * @returns {WitnessStack} The decompressed witness stack.
503
+ */
504
+ module.exports.decompressWitnessStack = function(compressed_witness) {
505
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
506
+ const len0 = WASM_VECTOR_LEN;
507
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
508
+ if (ret[2]) {
509
+ throw takeFromExternrefTable0(ret[1]);
510
+ }
511
+ return takeFromExternrefTable0(ret[0]);
512
+ };
513
+
514
+ /**
515
+ * Sets the package's logging level.
516
+ *
517
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
518
+ */
519
+ module.exports.initLogLevel = function(filter) {
520
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
521
+ const len0 = WASM_VECTOR_LEN;
522
+ const ret = wasm.initLogLevel(ptr0, len0);
523
+ if (ret[1]) {
524
+ throw takeFromExternrefTable0(ret[0]);
525
+ }
526
+ };
527
+
529
528
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
529
  wasm.closure255_externref_shim(arg0, arg1, arg2);
531
530
  }
@@ -813,7 +812,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
812
  return ret;
814
813
  };
815
814
 
816
- module.exports.__wbindgen_closure_wrapper736 = function(arg0, arg1, arg2) {
815
+ module.exports.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
817
816
  const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_30);
818
817
  return ret;
819
818
  };
Binary file
@@ -2,11 +2,6 @@
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];
9
- export const initLogLevel: (a: number, b: number) => [number, number];
10
5
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
11
6
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
12
7
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
@@ -19,6 +14,11 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
19
14
  export const blake2s256: (a: number, b: number) => [number, number];
20
15
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
21
16
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
+ export const compressWitness: (a: any) => [number, number, number, number];
18
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
19
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
20
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
21
+ export const initLogLevel: (a: number, b: number) => [number, number];
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/noir-acvm_js",
3
- "version": "0.85.0",
3
+ "version": "0.86.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -5,41 +5,6 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
- /**
9
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
10
- *
11
- * @param {WitnessMap} witness_map - A witness map.
12
- * @returns {Uint8Array} A compressed witness map
13
- */
14
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
15
- /**
16
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
17
- * This should be used to only fetch the witness map for the main function.
18
- *
19
- * @param {Uint8Array} compressed_witness - A compressed witness.
20
- * @returns {WitnessMap} The decompressed witness map.
21
- */
22
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
23
- /**
24
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
25
- *
26
- * @param {WitnessStack} witness_stack - A witness stack.
27
- * @returns {Uint8Array} A compressed witness stack
28
- */
29
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
30
- /**
31
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
32
- *
33
- * @param {Uint8Array} compressed_witness - A compressed witness.
34
- * @returns {WitnessStack} The decompressed witness stack.
35
- */
36
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
37
- /**
38
- * Sets the package's logging level.
39
- *
40
- * @param {LogLevel} level - The maximum level of logging to be emitted.
41
- */
42
- export function initLogLevel(filter: string): void;
43
8
  /**
44
9
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
45
10
  *
@@ -116,6 +81,41 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
116
81
  * Verifies a ECDSA signature over the secp256r1 curve.
117
82
  */
118
83
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
84
+ /**
85
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
86
+ *
87
+ * @param {WitnessMap} witness_map - A witness map.
88
+ * @returns {Uint8Array} A compressed witness map
89
+ */
90
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
91
+ /**
92
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
93
+ * This should be used to only fetch the witness map for the main function.
94
+ *
95
+ * @param {Uint8Array} compressed_witness - A compressed witness.
96
+ * @returns {WitnessMap} The decompressed witness map.
97
+ */
98
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
99
+ /**
100
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
101
+ *
102
+ * @param {WitnessStack} witness_stack - A witness stack.
103
+ * @returns {Uint8Array} A compressed witness stack
104
+ */
105
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
106
+ /**
107
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
108
+ *
109
+ * @param {Uint8Array} compressed_witness - A compressed witness.
110
+ * @returns {WitnessStack} The decompressed witness stack.
111
+ */
112
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
113
+ /**
114
+ * Sets the package's logging level.
115
+ *
116
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
117
+ */
118
+ export function initLogLevel(filter: string): void;
119
119
 
120
120
  /**
121
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -131,21 +131,6 @@ export type BuildInfo = {
131
131
 
132
132
 
133
133
 
134
- // Map from witness index to hex string value of witness.
135
- export type WitnessMap = Map<number, string>;
136
-
137
- /**
138
- * An execution result containing two witnesses.
139
- * 1. The full solved witness of the execution.
140
- * 2. The return witness which contains the given public return values within the full witness.
141
- */
142
- export type SolvedAndReturnWitness = {
143
- solvedWitness: WitnessMap;
144
- returnWitness: WitnessMap;
145
- }
146
-
147
-
148
-
149
134
  export type RawAssertionPayload = {
150
135
  selector: string;
151
136
  data: string[];
@@ -154,6 +139,7 @@ export type RawAssertionPayload = {
154
139
  export type ExecutionError = Error & {
155
140
  callStack?: string[];
156
141
  rawAssertionPayload?: RawAssertionPayload;
142
+ acirFunctionId?: number;
157
143
  brilligFunctionId?: number;
158
144
  };
159
145
 
@@ -182,16 +168,26 @@ export type WitnessStack = Array<StackItem>;
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
+
185
+
185
186
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
186
187
 
187
188
  export interface InitOutput {
188
189
  readonly memory: WebAssembly.Memory;
189
190
  readonly buildInfo: () => any;
190
- readonly compressWitness: (a: any) => [number, number, number, number];
191
- readonly decompressWitness: (a: number, b: number) => [number, number, number];
192
- readonly compressWitnessStack: (a: any) => [number, number, number, number];
193
- readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
194
- readonly initLogLevel: (a: number, b: number) => [number, number];
195
191
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
196
192
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
197
193
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
@@ -204,6 +200,11 @@ export interface InitOutput {
204
200
  readonly blake2s256: (a: number, b: number) => [number, number];
205
201
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
206
202
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
+ readonly compressWitness: (a: any) => [number, number, number, number];
204
+ readonly decompressWitness: (a: number, b: number) => [number, number, number];
205
+ readonly compressWitnessStack: (a: any) => [number, number, number, number];
206
+ readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
207
+ readonly initLogLevel: (a: number, b: number) => [number, number];
207
208
  readonly __wbindgen_exn_store: (a: number) => void;
208
209
  readonly __externref_table_alloc: () => number;
209
210
  readonly __wbindgen_export_2: WebAssembly.Table;
package/web/acvm_js.js CHANGED
@@ -206,101 +206,12 @@ export function buildInfo() {
206
206
  return ret;
207
207
  }
208
208
 
209
- function takeFromExternrefTable0(idx) {
210
- const value = wasm.__wbindgen_export_2.get(idx);
211
- wasm.__externref_table_dealloc(idx);
212
- return value;
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
209
  function passArray8ToWasm0(arg, malloc) {
236
210
  const ptr = malloc(arg.length * 1, 1) >>> 0;
237
211
  getUint8ArrayMemory0().set(arg, ptr / 1);
238
212
  WASM_VECTOR_LEN = arg.length;
239
213
  return ptr;
240
214
  }
241
- /**
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`.
276
- *
277
- * @param {Uint8Array} compressed_witness - A compressed witness.
278
- * @returns {WitnessStack} The decompressed witness stack.
279
- */
280
- export function decompressWitnessStack(compressed_witness) {
281
- const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
282
- const len0 = WASM_VECTOR_LEN;
283
- const ret = wasm.decompressWitnessStack(ptr0, len0);
284
- if (ret[2]) {
285
- throw takeFromExternrefTable0(ret[1]);
286
- }
287
- return takeFromExternrefTable0(ret[0]);
288
- }
289
-
290
- /**
291
- * Sets the package's logging level.
292
- *
293
- * @param {LogLevel} level - The maximum level of logging to be emitted.
294
- */
295
- export function initLogLevel(filter) {
296
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
297
- const len0 = WASM_VECTOR_LEN;
298
- const ret = wasm.initLogLevel(ptr0, len0);
299
- if (ret[1]) {
300
- throw takeFromExternrefTable0(ret[0]);
301
- }
302
- }
303
-
304
215
  /**
305
216
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
306
217
  *
@@ -347,6 +258,11 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
347
258
  return ret;
348
259
  }
349
260
 
261
+ function takeFromExternrefTable0(idx) {
262
+ const value = wasm.__wbindgen_export_2.get(idx);
263
+ wasm.__externref_table_dealloc(idx);
264
+ return value;
265
+ }
350
266
  /**
351
267
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
352
268
  *
@@ -466,6 +382,10 @@ export function sha256_compression(inputs, state) {
466
382
  return v3;
467
383
  }
468
384
 
385
+ function getArrayU8FromWasm0(ptr, len) {
386
+ ptr = ptr >>> 0;
387
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
388
+ }
469
389
  /**
470
390
  * Calculates the Blake2s256 hash of the input bytes
471
391
  * @param {Uint8Array} inputs
@@ -522,6 +442,85 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
522
442
  return ret !== 0;
523
443
  }
524
444
 
445
+ /**
446
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
447
+ *
448
+ * @param {WitnessMap} witness_map - A witness map.
449
+ * @returns {Uint8Array} A compressed witness map
450
+ */
451
+ export function compressWitness(witness_map) {
452
+ const ret = wasm.compressWitness(witness_map);
453
+ if (ret[3]) {
454
+ throw takeFromExternrefTable0(ret[2]);
455
+ }
456
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
457
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
458
+ return v1;
459
+ }
460
+
461
+ /**
462
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
463
+ * This should be used to only fetch the witness map for the main function.
464
+ *
465
+ * @param {Uint8Array} compressed_witness - A compressed witness.
466
+ * @returns {WitnessMap} The decompressed witness map.
467
+ */
468
+ export function decompressWitness(compressed_witness) {
469
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
470
+ const len0 = WASM_VECTOR_LEN;
471
+ const ret = wasm.decompressWitness(ptr0, len0);
472
+ if (ret[2]) {
473
+ throw takeFromExternrefTable0(ret[1]);
474
+ }
475
+ return takeFromExternrefTable0(ret[0]);
476
+ }
477
+
478
+ /**
479
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
480
+ *
481
+ * @param {WitnessStack} witness_stack - A witness stack.
482
+ * @returns {Uint8Array} A compressed witness stack
483
+ */
484
+ export function compressWitnessStack(witness_stack) {
485
+ const ret = wasm.compressWitnessStack(witness_stack);
486
+ if (ret[3]) {
487
+ throw takeFromExternrefTable0(ret[2]);
488
+ }
489
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
490
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
491
+ return v1;
492
+ }
493
+
494
+ /**
495
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
496
+ *
497
+ * @param {Uint8Array} compressed_witness - A compressed witness.
498
+ * @returns {WitnessStack} The decompressed witness stack.
499
+ */
500
+ export function decompressWitnessStack(compressed_witness) {
501
+ const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
502
+ const len0 = WASM_VECTOR_LEN;
503
+ const ret = wasm.decompressWitnessStack(ptr0, len0);
504
+ if (ret[2]) {
505
+ throw takeFromExternrefTable0(ret[1]);
506
+ }
507
+ return takeFromExternrefTable0(ret[0]);
508
+ }
509
+
510
+ /**
511
+ * Sets the package's logging level.
512
+ *
513
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
514
+ */
515
+ export function initLogLevel(filter) {
516
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
517
+ const len0 = WASM_VECTOR_LEN;
518
+ const ret = wasm.initLogLevel(ptr0, len0);
519
+ if (ret[1]) {
520
+ throw takeFromExternrefTable0(ret[0]);
521
+ }
522
+ }
523
+
525
524
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
525
  wasm.closure255_externref_shim(arg0, arg1, arg2);
527
526
  }
@@ -797,7 +796,7 @@ function __wbg_get_imports() {
797
796
  const ret = false;
798
797
  return ret;
799
798
  };
800
- imports.wbg.__wbindgen_closure_wrapper736 = function(arg0, arg1, arg2) {
799
+ imports.wbg.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
801
800
  const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_30);
802
801
  return ret;
803
802
  };
Binary file
@@ -2,11 +2,6 @@
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];
9
- export const initLogLevel: (a: number, b: number) => [number, number];
10
5
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
11
6
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
12
7
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
@@ -19,6 +14,11 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
19
14
  export const blake2s256: (a: number, b: number) => [number, number];
20
15
  export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
21
16
  export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
+ export const compressWitness: (a: any) => [number, number, number, number];
18
+ export const decompressWitness: (a: number, b: number) => [number, number, number];
19
+ export const compressWitnessStack: (a: any) => [number, number, number, number];
20
+ export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
21
+ export const initLogLevel: (a: number, b: number) => [number, number];
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;