@aztec/noir-acvm_js 0.0.1-commit.f295ac2 → 0.0.1-commit.fc805bf
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.
- package/nodejs/acvm_js.d.ts +65 -65
- package/nodejs/acvm_js.js +129 -128
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +8 -8
- package/package.json +3 -3
- package/web/acvm_js.d.ts +73 -73
- package/web/acvm_js.js +129 -128
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +8 -8
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -6,11 +6,58 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function buildInfo(): BuildInfo;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
12
|
+
* @returns {Uint8Array} A compressed witness map
|
|
12
13
|
*/
|
|
13
|
-
export function
|
|
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
|
+
* 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;
|
|
14
61
|
/**
|
|
15
62
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
16
63
|
*
|
|
@@ -39,6 +86,12 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
39
86
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
40
87
|
*/
|
|
41
88
|
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;
|
|
42
95
|
/**
|
|
43
96
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
44
97
|
*
|
|
@@ -63,59 +116,15 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
63
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
64
117
|
*/
|
|
65
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
* This should be used to only fetch the witness map for the main function.
|
|
76
|
-
*
|
|
77
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
78
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
79
|
-
*/
|
|
80
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
81
|
-
/**
|
|
82
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
83
|
-
*
|
|
84
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
85
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
86
|
-
*/
|
|
87
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
88
|
-
/**
|
|
89
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
90
|
-
*
|
|
91
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
92
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
93
|
-
*/
|
|
94
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
95
|
-
/**
|
|
96
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
97
|
-
*/
|
|
98
|
-
export function and(lhs: string, rhs: string): string;
|
|
99
|
-
/**
|
|
100
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
101
|
-
*/
|
|
102
|
-
export function xor(lhs: string, rhs: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Sha256 compression function
|
|
105
|
-
*/
|
|
106
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
-
*/
|
|
110
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
-
*/
|
|
114
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
117
|
-
*/
|
|
118
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
|
+
|
|
120
|
+
export type StackItem = {
|
|
121
|
+
index: number;
|
|
122
|
+
witness: WitnessMap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type WitnessStack = Array<StackItem>;
|
|
126
|
+
|
|
127
|
+
|
|
119
128
|
|
|
120
129
|
/**
|
|
121
130
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -173,12 +182,3 @@ export type ForeignCallOutput = string | string[]
|
|
|
173
182
|
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
174
183
|
|
|
175
184
|
|
|
176
|
-
|
|
177
|
-
export type StackItem = {
|
|
178
|
-
index: number;
|
|
179
|
-
witness: WitnessMap;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export type WitnessStack = Array<StackItem>;
|
|
183
|
-
|
|
184
|
-
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -215,131 +215,6 @@ function takeFromExternrefTable0(idx) {
|
|
|
215
215
|
wasm.__externref_table_dealloc(idx);
|
|
216
216
|
return value;
|
|
217
217
|
}
|
|
218
|
-
/**
|
|
219
|
-
* Sets the package's logging level.
|
|
220
|
-
*
|
|
221
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
222
|
-
*/
|
|
223
|
-
module.exports.initLogLevel = function(filter) {
|
|
224
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
225
|
-
const len0 = WASM_VECTOR_LEN;
|
|
226
|
-
const ret = wasm.initLogLevel(ptr0, len0);
|
|
227
|
-
if (ret[1]) {
|
|
228
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
233
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
234
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
235
|
-
WASM_VECTOR_LEN = arg.length;
|
|
236
|
-
return ptr;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
240
|
-
*
|
|
241
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
242
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
243
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
244
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
245
|
-
*/
|
|
246
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
247
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
248
|
-
const len0 = WASM_VECTOR_LEN;
|
|
249
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
250
|
-
return ret;
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
255
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
256
|
-
*
|
|
257
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
258
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
259
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
260
|
-
* @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.
|
|
261
|
-
*/
|
|
262
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
263
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
264
|
-
const len0 = WASM_VECTOR_LEN;
|
|
265
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
266
|
-
return ret;
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
271
|
-
*
|
|
272
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
273
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
274
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
275
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
276
|
-
*/
|
|
277
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
278
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
279
|
-
const len0 = WASM_VECTOR_LEN;
|
|
280
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
281
|
-
return ret;
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
286
|
-
*
|
|
287
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
288
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
289
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
290
|
-
* @param {Uint8Array} program
|
|
291
|
-
* @param {WitnessMap} witness_map
|
|
292
|
-
* @returns {WitnessMap}
|
|
293
|
-
*/
|
|
294
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
295
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
296
|
-
const len0 = WASM_VECTOR_LEN;
|
|
297
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
298
|
-
if (ret[2]) {
|
|
299
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
300
|
-
}
|
|
301
|
-
return takeFromExternrefTable0(ret[0]);
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
306
|
-
*
|
|
307
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
308
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
309
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
310
|
-
* @param {Uint8Array} program
|
|
311
|
-
* @param {WitnessMap} solved_witness
|
|
312
|
-
* @returns {WitnessMap}
|
|
313
|
-
*/
|
|
314
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
315
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
316
|
-
const len0 = WASM_VECTOR_LEN;
|
|
317
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
318
|
-
if (ret[2]) {
|
|
319
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
320
|
-
}
|
|
321
|
-
return takeFromExternrefTable0(ret[0]);
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
326
|
-
*
|
|
327
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
328
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
329
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
330
|
-
* @param {Uint8Array} program
|
|
331
|
-
* @param {WitnessMap} solved_witness
|
|
332
|
-
* @returns {WitnessMap}
|
|
333
|
-
*/
|
|
334
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
335
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
336
|
-
const len0 = WASM_VECTOR_LEN;
|
|
337
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
338
|
-
if (ret[2]) {
|
|
339
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
340
|
-
}
|
|
341
|
-
return takeFromExternrefTable0(ret[0]);
|
|
342
|
-
};
|
|
343
218
|
|
|
344
219
|
function getArrayU8FromWasm0(ptr, len) {
|
|
345
220
|
ptr = ptr >>> 0;
|
|
@@ -361,6 +236,12 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
361
236
|
return v1;
|
|
362
237
|
};
|
|
363
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
|
+
}
|
|
364
245
|
/**
|
|
365
246
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
366
247
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -525,8 +406,128 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
525
406
|
return ret !== 0;
|
|
526
407
|
};
|
|
527
408
|
|
|
409
|
+
/**
|
|
410
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
411
|
+
*
|
|
412
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
413
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
414
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
415
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
416
|
+
*/
|
|
417
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
418
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
419
|
+
const len0 = WASM_VECTOR_LEN;
|
|
420
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
421
|
+
return ret;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
426
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
427
|
+
*
|
|
428
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
429
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
430
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
431
|
+
* @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.
|
|
432
|
+
*/
|
|
433
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
434
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
435
|
+
const len0 = WASM_VECTOR_LEN;
|
|
436
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
437
|
+
return ret;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
442
|
+
*
|
|
443
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
444
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
445
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
446
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
447
|
+
*/
|
|
448
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
449
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
450
|
+
const len0 = WASM_VECTOR_LEN;
|
|
451
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
452
|
+
return ret;
|
|
453
|
+
};
|
|
454
|
+
|
|
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
|
+
/**
|
|
470
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
471
|
+
*
|
|
472
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
473
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
474
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
475
|
+
* @param {Uint8Array} program
|
|
476
|
+
* @param {WitnessMap} witness_map
|
|
477
|
+
* @returns {WitnessMap}
|
|
478
|
+
*/
|
|
479
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
480
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
481
|
+
const len0 = WASM_VECTOR_LEN;
|
|
482
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
483
|
+
if (ret[2]) {
|
|
484
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
485
|
+
}
|
|
486
|
+
return takeFromExternrefTable0(ret[0]);
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
491
|
+
*
|
|
492
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
493
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
494
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
495
|
+
* @param {Uint8Array} program
|
|
496
|
+
* @param {WitnessMap} solved_witness
|
|
497
|
+
* @returns {WitnessMap}
|
|
498
|
+
*/
|
|
499
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
500
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
501
|
+
const len0 = WASM_VECTOR_LEN;
|
|
502
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
503
|
+
if (ret[2]) {
|
|
504
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
505
|
+
}
|
|
506
|
+
return takeFromExternrefTable0(ret[0]);
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
511
|
+
*
|
|
512
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
513
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
514
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
515
|
+
* @param {Uint8Array} program
|
|
516
|
+
* @param {WitnessMap} solved_witness
|
|
517
|
+
* @returns {WitnessMap}
|
|
518
|
+
*/
|
|
519
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
520
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
521
|
+
const len0 = WASM_VECTOR_LEN;
|
|
522
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
523
|
+
if (ret[2]) {
|
|
524
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
525
|
+
}
|
|
526
|
+
return takeFromExternrefTable0(ret[0]);
|
|
527
|
+
};
|
|
528
|
+
|
|
528
529
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
529
|
-
wasm.
|
|
530
|
+
wasm.closure448_externref_shim(arg0, arg1, arg2);
|
|
530
531
|
}
|
|
531
532
|
|
|
532
533
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
@@ -812,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
812
813
|
return ret;
|
|
813
814
|
};
|
|
814
815
|
|
|
815
|
-
module.exports.
|
|
816
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
816
|
+
module.exports.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
|
|
817
|
+
const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
|
|
817
818
|
return ret;
|
|
818
819
|
};
|
|
819
820
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const buildInfo: () => any;
|
|
5
|
-
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
6
|
-
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
7
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
9
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
12
5
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
13
6
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
14
7
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -19,6 +12,13 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
|
|
|
19
12
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
20
13
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
14
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
15
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
16
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
17
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
18
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
19
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [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;
|
|
@@ -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
|
|
30
|
+
export const closure448_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
31
|
export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
32
|
export const closure936_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.
|
|
3
|
+
"version": "0.0.1-commit.fc805bf",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@web/test-runner-playwright": "^0.11.1",
|
|
44
44
|
"chai": "^6.2.2",
|
|
45
45
|
"eslint": "^9.39.2",
|
|
46
|
-
"eslint-plugin-prettier": "^5.5.
|
|
46
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
47
47
|
"mocha": "^11.7.5",
|
|
48
|
-
"prettier": "3.
|
|
48
|
+
"prettier": "3.8.1",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
50
|
"typescript": "^5.8.3"
|
|
51
51
|
}
|
package/web/acvm_js.d.ts
CHANGED
|
@@ -6,11 +6,58 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function buildInfo(): BuildInfo;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
10
10
|
*
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
12
|
+
* @returns {Uint8Array} A compressed witness map
|
|
12
13
|
*/
|
|
13
|
-
export function
|
|
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
|
+
* 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;
|
|
14
61
|
/**
|
|
15
62
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
16
63
|
*
|
|
@@ -39,6 +86,12 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
39
86
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
40
87
|
*/
|
|
41
88
|
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;
|
|
42
95
|
/**
|
|
43
96
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
44
97
|
*
|
|
@@ -63,59 +116,15 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
63
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
64
117
|
*/
|
|
65
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
* This should be used to only fetch the witness map for the main function.
|
|
76
|
-
*
|
|
77
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
78
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
79
|
-
*/
|
|
80
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
81
|
-
/**
|
|
82
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
83
|
-
*
|
|
84
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
85
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
86
|
-
*/
|
|
87
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
88
|
-
/**
|
|
89
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
90
|
-
*
|
|
91
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
92
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
93
|
-
*/
|
|
94
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
95
|
-
/**
|
|
96
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
97
|
-
*/
|
|
98
|
-
export function and(lhs: string, rhs: string): string;
|
|
99
|
-
/**
|
|
100
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
101
|
-
*/
|
|
102
|
-
export function xor(lhs: string, rhs: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Sha256 compression function
|
|
105
|
-
*/
|
|
106
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
-
*/
|
|
110
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
-
*/
|
|
114
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
117
|
-
*/
|
|
118
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
|
+
|
|
120
|
+
export type StackItem = {
|
|
121
|
+
index: number;
|
|
122
|
+
witness: WitnessMap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type WitnessStack = Array<StackItem>;
|
|
126
|
+
|
|
127
|
+
|
|
119
128
|
|
|
120
129
|
/**
|
|
121
130
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -174,27 +183,11 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
174
183
|
|
|
175
184
|
|
|
176
185
|
|
|
177
|
-
export type StackItem = {
|
|
178
|
-
index: number;
|
|
179
|
-
witness: WitnessMap;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export type WitnessStack = Array<StackItem>;
|
|
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 initLogLevel: (a: number, b: number) => [number, number];
|
|
192
|
-
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
193
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
194
|
-
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
195
|
-
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
196
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
197
|
-
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
198
191
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
199
192
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
200
193
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -205,6 +198,13 @@ export interface InitOutput {
|
|
|
205
198
|
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
206
199
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
207
200
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
201
|
+
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
202
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
203
|
+
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
204
|
+
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
205
|
+
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
206
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
207
|
+
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
208
208
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
209
209
|
readonly __externref_table_alloc: () => number;
|
|
210
210
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -213,7 +213,7 @@ 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
|
|
216
|
+
readonly closure448_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
217
|
readonly closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
218
|
readonly closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
219
219
|
readonly __wbindgen_start: () => void;
|
package/web/acvm_js.js
CHANGED
|
@@ -211,131 +211,6 @@ function takeFromExternrefTable0(idx) {
|
|
|
211
211
|
wasm.__externref_table_dealloc(idx);
|
|
212
212
|
return value;
|
|
213
213
|
}
|
|
214
|
-
/**
|
|
215
|
-
* Sets the package's logging level.
|
|
216
|
-
*
|
|
217
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
218
|
-
*/
|
|
219
|
-
export function initLogLevel(filter) {
|
|
220
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
221
|
-
const len0 = WASM_VECTOR_LEN;
|
|
222
|
-
const ret = wasm.initLogLevel(ptr0, len0);
|
|
223
|
-
if (ret[1]) {
|
|
224
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
229
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
230
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
231
|
-
WASM_VECTOR_LEN = arg.length;
|
|
232
|
-
return ptr;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
236
|
-
*
|
|
237
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
238
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
239
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
240
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
241
|
-
*/
|
|
242
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
243
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
244
|
-
const len0 = WASM_VECTOR_LEN;
|
|
245
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
246
|
-
return ret;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
251
|
-
* This method also extracts the public return values from the solved witness into its own return 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 {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.
|
|
257
|
-
*/
|
|
258
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
259
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
260
|
-
const len0 = WASM_VECTOR_LEN;
|
|
261
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
262
|
-
return ret;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
267
|
-
*
|
|
268
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
269
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
270
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
271
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
272
|
-
*/
|
|
273
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
274
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
275
|
-
const len0 = WASM_VECTOR_LEN;
|
|
276
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
277
|
-
return ret;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
282
|
-
*
|
|
283
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
284
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
285
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
286
|
-
* @param {Uint8Array} program
|
|
287
|
-
* @param {WitnessMap} witness_map
|
|
288
|
-
* @returns {WitnessMap}
|
|
289
|
-
*/
|
|
290
|
-
export function getReturnWitness(program, witness_map) {
|
|
291
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
292
|
-
const len0 = WASM_VECTOR_LEN;
|
|
293
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
294
|
-
if (ret[2]) {
|
|
295
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
296
|
-
}
|
|
297
|
-
return takeFromExternrefTable0(ret[0]);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
302
|
-
*
|
|
303
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
304
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
305
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
306
|
-
* @param {Uint8Array} program
|
|
307
|
-
* @param {WitnessMap} solved_witness
|
|
308
|
-
* @returns {WitnessMap}
|
|
309
|
-
*/
|
|
310
|
-
export function getPublicParametersWitness(program, solved_witness) {
|
|
311
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
312
|
-
const len0 = WASM_VECTOR_LEN;
|
|
313
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
314
|
-
if (ret[2]) {
|
|
315
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
316
|
-
}
|
|
317
|
-
return takeFromExternrefTable0(ret[0]);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
322
|
-
*
|
|
323
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
324
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
325
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
326
|
-
* @param {Uint8Array} program
|
|
327
|
-
* @param {WitnessMap} solved_witness
|
|
328
|
-
* @returns {WitnessMap}
|
|
329
|
-
*/
|
|
330
|
-
export function getPublicWitness(program, solved_witness) {
|
|
331
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
332
|
-
const len0 = WASM_VECTOR_LEN;
|
|
333
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
334
|
-
if (ret[2]) {
|
|
335
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
336
|
-
}
|
|
337
|
-
return takeFromExternrefTable0(ret[0]);
|
|
338
|
-
}
|
|
339
214
|
|
|
340
215
|
function getArrayU8FromWasm0(ptr, len) {
|
|
341
216
|
ptr = ptr >>> 0;
|
|
@@ -357,6 +232,12 @@ export function compressWitness(witness_map) {
|
|
|
357
232
|
return v1;
|
|
358
233
|
}
|
|
359
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
|
+
}
|
|
360
241
|
/**
|
|
361
242
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
362
243
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -521,8 +402,128 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
521
402
|
return ret !== 0;
|
|
522
403
|
}
|
|
523
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
407
|
+
*
|
|
408
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
409
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
410
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
411
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
412
|
+
*/
|
|
413
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
414
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
415
|
+
const len0 = WASM_VECTOR_LEN;
|
|
416
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
417
|
+
return ret;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
422
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
423
|
+
*
|
|
424
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
425
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
426
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
427
|
+
* @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.
|
|
428
|
+
*/
|
|
429
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
430
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
431
|
+
const len0 = WASM_VECTOR_LEN;
|
|
432
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
433
|
+
return ret;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
438
|
+
*
|
|
439
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
440
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
441
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
442
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
443
|
+
*/
|
|
444
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
445
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
446
|
+
const len0 = WASM_VECTOR_LEN;
|
|
447
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
448
|
+
return ret;
|
|
449
|
+
}
|
|
450
|
+
|
|
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
|
+
/**
|
|
466
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
467
|
+
*
|
|
468
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
469
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
470
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
471
|
+
* @param {Uint8Array} program
|
|
472
|
+
* @param {WitnessMap} witness_map
|
|
473
|
+
* @returns {WitnessMap}
|
|
474
|
+
*/
|
|
475
|
+
export function getReturnWitness(program, witness_map) {
|
|
476
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
477
|
+
const len0 = WASM_VECTOR_LEN;
|
|
478
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
479
|
+
if (ret[2]) {
|
|
480
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
481
|
+
}
|
|
482
|
+
return takeFromExternrefTable0(ret[0]);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
487
|
+
*
|
|
488
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
489
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
490
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
491
|
+
* @param {Uint8Array} program
|
|
492
|
+
* @param {WitnessMap} solved_witness
|
|
493
|
+
* @returns {WitnessMap}
|
|
494
|
+
*/
|
|
495
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
496
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
497
|
+
const len0 = WASM_VECTOR_LEN;
|
|
498
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
499
|
+
if (ret[2]) {
|
|
500
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
501
|
+
}
|
|
502
|
+
return takeFromExternrefTable0(ret[0]);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
507
|
+
*
|
|
508
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
509
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
510
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
511
|
+
* @param {Uint8Array} program
|
|
512
|
+
* @param {WitnessMap} solved_witness
|
|
513
|
+
* @returns {WitnessMap}
|
|
514
|
+
*/
|
|
515
|
+
export function getPublicWitness(program, solved_witness) {
|
|
516
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
517
|
+
const len0 = WASM_VECTOR_LEN;
|
|
518
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
519
|
+
if (ret[2]) {
|
|
520
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
521
|
+
}
|
|
522
|
+
return takeFromExternrefTable0(ret[0]);
|
|
523
|
+
}
|
|
524
|
+
|
|
524
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
525
|
-
wasm.
|
|
526
|
+
wasm.closure448_externref_shim(arg0, arg1, arg2);
|
|
526
527
|
}
|
|
527
528
|
|
|
528
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
@@ -796,8 +797,8 @@ function __wbg_get_imports() {
|
|
|
796
797
|
const ret = false;
|
|
797
798
|
return ret;
|
|
798
799
|
};
|
|
799
|
-
imports.wbg.
|
|
800
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
800
|
+
imports.wbg.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
|
|
801
|
+
const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
|
|
801
802
|
return ret;
|
|
802
803
|
};
|
|
803
804
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const buildInfo: () => any;
|
|
5
|
-
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
6
|
-
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
7
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
9
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
12
5
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
13
6
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
14
7
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -19,6 +12,13 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
|
|
|
19
12
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
20
13
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
14
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
15
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
16
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
17
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
18
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
19
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [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;
|
|
@@ -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
|
|
30
|
+
export const closure448_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
31
|
export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
32
|
export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|