@aztec/noir-acvm_js 4.0.0-nightly.20260111 → 4.0.0-nightly.20260113
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 +56 -56
- package/nodejs/acvm_js.js +113 -113
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +10 -10
- package/package.json +1 -1
- package/web/acvm_js.d.ts +66 -66
- package/web/acvm_js.js +113 -113
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +10 -10
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -6,6 +6,35 @@
|
|
|
6
6
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
7
7
|
*/
|
|
8
8
|
export function initLogLevel(filter: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
11
|
+
*
|
|
12
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
13
|
+
* @returns {Uint8Array} A compressed witness map
|
|
14
|
+
*/
|
|
15
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
18
|
+
* This should be used to only fetch the witness map for the main function.
|
|
19
|
+
*
|
|
20
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
21
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
22
|
+
*/
|
|
23
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
24
|
+
/**
|
|
25
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
26
|
+
*
|
|
27
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
28
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
29
|
+
*/
|
|
30
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
31
|
+
/**
|
|
32
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
33
|
+
*
|
|
34
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
35
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
36
|
+
*/
|
|
37
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
9
38
|
/**
|
|
10
39
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
40
|
*
|
|
@@ -34,30 +63,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
34
63
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
35
64
|
*/
|
|
36
65
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
37
|
-
/**
|
|
38
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
39
|
-
*
|
|
40
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
41
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
42
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
43
|
-
*/
|
|
44
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
45
|
-
/**
|
|
46
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
47
|
-
*
|
|
48
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
49
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
50
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
51
|
-
*/
|
|
52
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
53
|
-
/**
|
|
54
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
55
|
-
*
|
|
56
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
57
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
58
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
59
|
-
*/
|
|
60
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
61
66
|
/**
|
|
62
67
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
63
68
|
*/
|
|
@@ -83,39 +88,43 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
83
88
|
*/
|
|
84
89
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
85
90
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
89
|
-
* @returns {Uint8Array} A compressed witness map
|
|
91
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
92
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
90
93
|
*/
|
|
91
|
-
export function
|
|
94
|
+
export function buildInfo(): BuildInfo;
|
|
92
95
|
/**
|
|
93
|
-
*
|
|
94
|
-
* This should be used to only fetch the witness map for the main function.
|
|
96
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
95
97
|
*
|
|
96
|
-
* @param {Uint8Array}
|
|
97
|
-
* @
|
|
98
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
99
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
100
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
98
101
|
*/
|
|
99
|
-
export function
|
|
102
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
100
103
|
/**
|
|
101
|
-
*
|
|
104
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
102
105
|
*
|
|
103
|
-
* @param {
|
|
104
|
-
* @
|
|
106
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
107
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
108
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
105
109
|
*/
|
|
106
|
-
export function
|
|
110
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
107
111
|
/**
|
|
108
|
-
*
|
|
112
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
109
113
|
*
|
|
110
|
-
* @param {Uint8Array}
|
|
111
|
-
* @
|
|
112
|
-
|
|
113
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
114
|
-
/**
|
|
115
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
116
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
114
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
115
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
116
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
118
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
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
|
export type RawAssertionPayload = {
|
|
121
130
|
selector: string;
|
|
@@ -160,15 +169,6 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
160
169
|
|
|
161
170
|
|
|
162
171
|
|
|
163
|
-
export type StackItem = {
|
|
164
|
-
index: number;
|
|
165
|
-
witness: WitnessMap;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export type WitnessStack = Array<StackItem>;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
172
|
/**
|
|
173
173
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
174
174
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -221,12 +221,81 @@ module.exports.initLogLevel = function(filter) {
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
225
|
+
ptr = ptr >>> 0;
|
|
226
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
230
|
+
*
|
|
231
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
232
|
+
* @returns {Uint8Array} A compressed witness map
|
|
233
|
+
*/
|
|
234
|
+
module.exports.compressWitness = function(witness_map) {
|
|
235
|
+
const ret = wasm.compressWitness(witness_map);
|
|
236
|
+
if (ret[3]) {
|
|
237
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
238
|
+
}
|
|
239
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
240
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
241
|
+
return v1;
|
|
242
|
+
};
|
|
243
|
+
|
|
224
244
|
function passArray8ToWasm0(arg, malloc) {
|
|
225
245
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
226
246
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
227
247
|
WASM_VECTOR_LEN = arg.length;
|
|
228
248
|
return ptr;
|
|
229
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
252
|
+
* This should be used to only fetch the witness map for the main function.
|
|
253
|
+
*
|
|
254
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
255
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
256
|
+
*/
|
|
257
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
258
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
259
|
+
const len0 = WASM_VECTOR_LEN;
|
|
260
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
261
|
+
if (ret[2]) {
|
|
262
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
263
|
+
}
|
|
264
|
+
return takeFromExternrefTable0(ret[0]);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
269
|
+
*
|
|
270
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
271
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
272
|
+
*/
|
|
273
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
274
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
275
|
+
if (ret[3]) {
|
|
276
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
277
|
+
}
|
|
278
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
279
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
280
|
+
return v1;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
285
|
+
*
|
|
286
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
287
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
288
|
+
*/
|
|
289
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
290
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
291
|
+
const len0 = WASM_VECTOR_LEN;
|
|
292
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
293
|
+
if (ret[2]) {
|
|
294
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
295
|
+
}
|
|
296
|
+
return takeFromExternrefTable0(ret[0]);
|
|
297
|
+
};
|
|
298
|
+
|
|
230
299
|
/**
|
|
231
300
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
232
301
|
*
|
|
@@ -273,66 +342,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
273
342
|
return ret;
|
|
274
343
|
};
|
|
275
344
|
|
|
276
|
-
/**
|
|
277
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
278
|
-
*
|
|
279
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
280
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
281
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
282
|
-
* @param {Uint8Array} program
|
|
283
|
-
* @param {WitnessMap} witness_map
|
|
284
|
-
* @returns {WitnessMap}
|
|
285
|
-
*/
|
|
286
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
287
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
288
|
-
const len0 = WASM_VECTOR_LEN;
|
|
289
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
290
|
-
if (ret[2]) {
|
|
291
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
292
|
-
}
|
|
293
|
-
return takeFromExternrefTable0(ret[0]);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
298
|
-
*
|
|
299
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
300
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
301
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
302
|
-
* @param {Uint8Array} program
|
|
303
|
-
* @param {WitnessMap} solved_witness
|
|
304
|
-
* @returns {WitnessMap}
|
|
305
|
-
*/
|
|
306
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
307
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
308
|
-
const len0 = WASM_VECTOR_LEN;
|
|
309
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
310
|
-
if (ret[2]) {
|
|
311
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
312
|
-
}
|
|
313
|
-
return takeFromExternrefTable0(ret[0]);
|
|
314
|
-
};
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
318
|
-
*
|
|
319
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
320
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
321
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
322
|
-
* @param {Uint8Array} program
|
|
323
|
-
* @param {WitnessMap} solved_witness
|
|
324
|
-
* @returns {WitnessMap}
|
|
325
|
-
*/
|
|
326
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
327
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
328
|
-
const len0 = WASM_VECTOR_LEN;
|
|
329
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
330
|
-
if (ret[2]) {
|
|
331
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
332
|
-
}
|
|
333
|
-
return takeFromExternrefTable0(ret[0]);
|
|
334
|
-
};
|
|
335
|
-
|
|
336
345
|
/**
|
|
337
346
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
338
347
|
* @param {string} lhs
|
|
@@ -392,10 +401,6 @@ module.exports.sha256_compression = function(inputs, state) {
|
|
|
392
401
|
return v3;
|
|
393
402
|
};
|
|
394
403
|
|
|
395
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
396
|
-
ptr = ptr >>> 0;
|
|
397
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
398
|
-
}
|
|
399
404
|
/**
|
|
400
405
|
* Calculates the Blake2s256 hash of the input bytes
|
|
401
406
|
* @param {Uint8Array} inputs
|
|
@@ -453,32 +458,28 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
453
458
|
};
|
|
454
459
|
|
|
455
460
|
/**
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
459
|
-
* @returns {Uint8Array} A compressed witness map
|
|
461
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
462
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
460
463
|
*/
|
|
461
|
-
module.exports.
|
|
462
|
-
const ret = wasm.
|
|
463
|
-
|
|
464
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
465
|
-
}
|
|
466
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
467
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
468
|
-
return v1;
|
|
464
|
+
module.exports.buildInfo = function() {
|
|
465
|
+
const ret = wasm.buildInfo();
|
|
466
|
+
return ret;
|
|
469
467
|
};
|
|
470
468
|
|
|
471
469
|
/**
|
|
472
|
-
*
|
|
473
|
-
* This should be used to only fetch the witness map for the main function.
|
|
470
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
474
471
|
*
|
|
475
|
-
* @param {Uint8Array}
|
|
476
|
-
* @
|
|
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}
|
|
477
478
|
*/
|
|
478
|
-
module.exports.
|
|
479
|
-
const ptr0 = passArray8ToWasm0(
|
|
479
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
480
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
480
481
|
const len0 = WASM_VECTOR_LEN;
|
|
481
|
-
const ret = wasm.
|
|
482
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
482
483
|
if (ret[2]) {
|
|
483
484
|
throw takeFromExternrefTable0(ret[1]);
|
|
484
485
|
}
|
|
@@ -486,56 +487,55 @@ module.exports.decompressWitness = function(compressed_witness) {
|
|
|
486
487
|
};
|
|
487
488
|
|
|
488
489
|
/**
|
|
489
|
-
*
|
|
490
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
490
491
|
*
|
|
491
|
-
* @param {
|
|
492
|
-
* @
|
|
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}
|
|
493
498
|
*/
|
|
494
|
-
module.exports.
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
|
|
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]);
|
|
498
505
|
}
|
|
499
|
-
|
|
500
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
501
|
-
return v1;
|
|
506
|
+
return takeFromExternrefTable0(ret[0]);
|
|
502
507
|
};
|
|
503
508
|
|
|
504
509
|
/**
|
|
505
|
-
*
|
|
510
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
506
511
|
*
|
|
507
|
-
* @param {Uint8Array}
|
|
508
|
-
* @
|
|
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}
|
|
509
518
|
*/
|
|
510
|
-
module.exports.
|
|
511
|
-
const ptr0 = passArray8ToWasm0(
|
|
519
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
520
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
512
521
|
const len0 = WASM_VECTOR_LEN;
|
|
513
|
-
const ret = wasm.
|
|
522
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
514
523
|
if (ret[2]) {
|
|
515
524
|
throw takeFromExternrefTable0(ret[1]);
|
|
516
525
|
}
|
|
517
526
|
return takeFromExternrefTable0(ret[0]);
|
|
518
527
|
};
|
|
519
528
|
|
|
520
|
-
/**
|
|
521
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
522
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
523
|
-
*/
|
|
524
|
-
module.exports.buildInfo = function() {
|
|
525
|
-
const ret = wasm.buildInfo();
|
|
526
|
-
return ret;
|
|
527
|
-
};
|
|
528
|
-
|
|
529
529
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure444_externref_shim(arg0, arg1, arg2);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure928_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
538
|
-
wasm.
|
|
538
|
+
wasm.closure932_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.
|
|
817
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
816
|
+
module.exports.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
|
|
817
|
+
const ret = makeMutClosure(arg0, arg1, 445, __wbg_adapter_30);
|
|
818
818
|
return ret;
|
|
819
819
|
};
|
|
820
820
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
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
9
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
10
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
11
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
12
|
export const and: (a: any, b: any) => any;
|
|
12
13
|
export const xor: (a: any, b: any) => any;
|
|
13
14
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
14
15
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
15
16
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
16
17
|
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
18
|
export const buildInfo: () => any;
|
|
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
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure444_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure928_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure932_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -6,6 +6,35 @@
|
|
|
6
6
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
7
7
|
*/
|
|
8
8
|
export function initLogLevel(filter: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
11
|
+
*
|
|
12
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
13
|
+
* @returns {Uint8Array} A compressed witness map
|
|
14
|
+
*/
|
|
15
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
18
|
+
* This should be used to only fetch the witness map for the main function.
|
|
19
|
+
*
|
|
20
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
21
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
22
|
+
*/
|
|
23
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
24
|
+
/**
|
|
25
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
26
|
+
*
|
|
27
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
28
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
29
|
+
*/
|
|
30
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
31
|
+
/**
|
|
32
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
33
|
+
*
|
|
34
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
35
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
36
|
+
*/
|
|
37
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
9
38
|
/**
|
|
10
39
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
40
|
*
|
|
@@ -34,30 +63,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
34
63
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
35
64
|
*/
|
|
36
65
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
37
|
-
/**
|
|
38
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
39
|
-
*
|
|
40
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
41
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
42
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
43
|
-
*/
|
|
44
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
45
|
-
/**
|
|
46
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
47
|
-
*
|
|
48
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
49
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
50
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
51
|
-
*/
|
|
52
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
53
|
-
/**
|
|
54
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
55
|
-
*
|
|
56
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
57
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
58
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
59
|
-
*/
|
|
60
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
61
66
|
/**
|
|
62
67
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
63
68
|
*/
|
|
@@ -83,39 +88,43 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
83
88
|
*/
|
|
84
89
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
85
90
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
89
|
-
* @returns {Uint8Array} A compressed witness map
|
|
91
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
92
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
90
93
|
*/
|
|
91
|
-
export function
|
|
94
|
+
export function buildInfo(): BuildInfo;
|
|
92
95
|
/**
|
|
93
|
-
*
|
|
94
|
-
* This should be used to only fetch the witness map for the main function.
|
|
96
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
95
97
|
*
|
|
96
|
-
* @param {Uint8Array}
|
|
97
|
-
* @
|
|
98
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
99
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
100
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
98
101
|
*/
|
|
99
|
-
export function
|
|
102
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
100
103
|
/**
|
|
101
|
-
*
|
|
104
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
102
105
|
*
|
|
103
|
-
* @param {
|
|
104
|
-
* @
|
|
106
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
107
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
108
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
105
109
|
*/
|
|
106
|
-
export function
|
|
110
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
107
111
|
/**
|
|
108
|
-
*
|
|
112
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
109
113
|
*
|
|
110
|
-
* @param {Uint8Array}
|
|
111
|
-
* @
|
|
112
|
-
|
|
113
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
114
|
-
/**
|
|
115
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
116
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
114
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
115
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
116
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
118
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
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
|
export type RawAssertionPayload = {
|
|
121
130
|
selector: string;
|
|
@@ -160,15 +169,6 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
160
169
|
|
|
161
170
|
|
|
162
171
|
|
|
163
|
-
export type StackItem = {
|
|
164
|
-
index: number;
|
|
165
|
-
witness: WitnessMap;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export type WitnessStack = Array<StackItem>;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
172
|
/**
|
|
173
173
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
174
174
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
@@ -188,23 +188,23 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
190
|
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
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
195
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
192
196
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
193
197
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
194
|
-
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
195
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
196
|
-
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
197
198
|
readonly and: (a: any, b: any) => any;
|
|
198
199
|
readonly xor: (a: any, b: any) => any;
|
|
199
200
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
200
201
|
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
201
202
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
202
203
|
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
204
|
readonly buildInfo: () => any;
|
|
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,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
|
|
217
|
-
readonly
|
|
218
|
-
readonly
|
|
216
|
+
readonly closure444_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure928_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure932_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
|
@@ -217,12 +217,81 @@ export function initLogLevel(filter) {
|
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
221
|
+
ptr = ptr >>> 0;
|
|
222
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
226
|
+
*
|
|
227
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
228
|
+
* @returns {Uint8Array} A compressed witness map
|
|
229
|
+
*/
|
|
230
|
+
export function compressWitness(witness_map) {
|
|
231
|
+
const ret = wasm.compressWitness(witness_map);
|
|
232
|
+
if (ret[3]) {
|
|
233
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
234
|
+
}
|
|
235
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
236
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
237
|
+
return v1;
|
|
238
|
+
}
|
|
239
|
+
|
|
220
240
|
function passArray8ToWasm0(arg, malloc) {
|
|
221
241
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
222
242
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
223
243
|
WASM_VECTOR_LEN = arg.length;
|
|
224
244
|
return ptr;
|
|
225
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
248
|
+
* This should be used to only fetch the witness map for the main function.
|
|
249
|
+
*
|
|
250
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
251
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
252
|
+
*/
|
|
253
|
+
export function decompressWitness(compressed_witness) {
|
|
254
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
255
|
+
const len0 = WASM_VECTOR_LEN;
|
|
256
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
257
|
+
if (ret[2]) {
|
|
258
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
259
|
+
}
|
|
260
|
+
return takeFromExternrefTable0(ret[0]);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
265
|
+
*
|
|
266
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
267
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
268
|
+
*/
|
|
269
|
+
export function compressWitnessStack(witness_stack) {
|
|
270
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
271
|
+
if (ret[3]) {
|
|
272
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
273
|
+
}
|
|
274
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
275
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
276
|
+
return v1;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
281
|
+
*
|
|
282
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
283
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
284
|
+
*/
|
|
285
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
286
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
287
|
+
const len0 = WASM_VECTOR_LEN;
|
|
288
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
289
|
+
if (ret[2]) {
|
|
290
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
291
|
+
}
|
|
292
|
+
return takeFromExternrefTable0(ret[0]);
|
|
293
|
+
}
|
|
294
|
+
|
|
226
295
|
/**
|
|
227
296
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
228
297
|
*
|
|
@@ -269,66 +338,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
|
269
338
|
return ret;
|
|
270
339
|
}
|
|
271
340
|
|
|
272
|
-
/**
|
|
273
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
274
|
-
*
|
|
275
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
276
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
277
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
278
|
-
* @param {Uint8Array} program
|
|
279
|
-
* @param {WitnessMap} witness_map
|
|
280
|
-
* @returns {WitnessMap}
|
|
281
|
-
*/
|
|
282
|
-
export function getReturnWitness(program, witness_map) {
|
|
283
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
284
|
-
const len0 = WASM_VECTOR_LEN;
|
|
285
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
286
|
-
if (ret[2]) {
|
|
287
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
288
|
-
}
|
|
289
|
-
return takeFromExternrefTable0(ret[0]);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
294
|
-
*
|
|
295
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
296
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
297
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
298
|
-
* @param {Uint8Array} program
|
|
299
|
-
* @param {WitnessMap} solved_witness
|
|
300
|
-
* @returns {WitnessMap}
|
|
301
|
-
*/
|
|
302
|
-
export function getPublicParametersWitness(program, solved_witness) {
|
|
303
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
304
|
-
const len0 = WASM_VECTOR_LEN;
|
|
305
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
306
|
-
if (ret[2]) {
|
|
307
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
308
|
-
}
|
|
309
|
-
return takeFromExternrefTable0(ret[0]);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
314
|
-
*
|
|
315
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
316
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
317
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
318
|
-
* @param {Uint8Array} program
|
|
319
|
-
* @param {WitnessMap} solved_witness
|
|
320
|
-
* @returns {WitnessMap}
|
|
321
|
-
*/
|
|
322
|
-
export function getPublicWitness(program, solved_witness) {
|
|
323
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
324
|
-
const len0 = WASM_VECTOR_LEN;
|
|
325
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
326
|
-
if (ret[2]) {
|
|
327
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
328
|
-
}
|
|
329
|
-
return takeFromExternrefTable0(ret[0]);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
341
|
/**
|
|
333
342
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
334
343
|
* @param {string} lhs
|
|
@@ -388,10 +397,6 @@ export function sha256_compression(inputs, state) {
|
|
|
388
397
|
return v3;
|
|
389
398
|
}
|
|
390
399
|
|
|
391
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
392
|
-
ptr = ptr >>> 0;
|
|
393
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
394
|
-
}
|
|
395
400
|
/**
|
|
396
401
|
* Calculates the Blake2s256 hash of the input bytes
|
|
397
402
|
* @param {Uint8Array} inputs
|
|
@@ -449,32 +454,28 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
449
454
|
}
|
|
450
455
|
|
|
451
456
|
/**
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
455
|
-
* @returns {Uint8Array} A compressed witness map
|
|
457
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
458
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
456
459
|
*/
|
|
457
|
-
export function
|
|
458
|
-
const ret = wasm.
|
|
459
|
-
|
|
460
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
461
|
-
}
|
|
462
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
463
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
464
|
-
return v1;
|
|
460
|
+
export function buildInfo() {
|
|
461
|
+
const ret = wasm.buildInfo();
|
|
462
|
+
return ret;
|
|
465
463
|
}
|
|
466
464
|
|
|
467
465
|
/**
|
|
468
|
-
*
|
|
469
|
-
* This should be used to only fetch the witness map for the main function.
|
|
466
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
470
467
|
*
|
|
471
|
-
* @param {Uint8Array}
|
|
472
|
-
* @
|
|
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}
|
|
473
474
|
*/
|
|
474
|
-
export function
|
|
475
|
-
const ptr0 = passArray8ToWasm0(
|
|
475
|
+
export function getReturnWitness(program, witness_map) {
|
|
476
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
476
477
|
const len0 = WASM_VECTOR_LEN;
|
|
477
|
-
const ret = wasm.
|
|
478
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
478
479
|
if (ret[2]) {
|
|
479
480
|
throw takeFromExternrefTable0(ret[1]);
|
|
480
481
|
}
|
|
@@ -482,56 +483,55 @@ export function decompressWitness(compressed_witness) {
|
|
|
482
483
|
}
|
|
483
484
|
|
|
484
485
|
/**
|
|
485
|
-
*
|
|
486
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
486
487
|
*
|
|
487
|
-
* @param {
|
|
488
|
-
* @
|
|
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}
|
|
489
494
|
*/
|
|
490
|
-
export function
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
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]);
|
|
494
501
|
}
|
|
495
|
-
|
|
496
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
497
|
-
return v1;
|
|
502
|
+
return takeFromExternrefTable0(ret[0]);
|
|
498
503
|
}
|
|
499
504
|
|
|
500
505
|
/**
|
|
501
|
-
*
|
|
506
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
502
507
|
*
|
|
503
|
-
* @param {Uint8Array}
|
|
504
|
-
* @
|
|
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}
|
|
505
514
|
*/
|
|
506
|
-
export function
|
|
507
|
-
const ptr0 = passArray8ToWasm0(
|
|
515
|
+
export function getPublicWitness(program, solved_witness) {
|
|
516
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
508
517
|
const len0 = WASM_VECTOR_LEN;
|
|
509
|
-
const ret = wasm.
|
|
518
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
510
519
|
if (ret[2]) {
|
|
511
520
|
throw takeFromExternrefTable0(ret[1]);
|
|
512
521
|
}
|
|
513
522
|
return takeFromExternrefTable0(ret[0]);
|
|
514
523
|
}
|
|
515
524
|
|
|
516
|
-
/**
|
|
517
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
518
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
519
|
-
*/
|
|
520
|
-
export function buildInfo() {
|
|
521
|
-
const ret = wasm.buildInfo();
|
|
522
|
-
return ret;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
|
-
wasm.
|
|
526
|
+
wasm.closure444_externref_shim(arg0, arg1, arg2);
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure928_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure932_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.
|
|
801
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
800
|
+
imports.wbg.__wbindgen_closure_wrapper1443 = function(arg0, arg1, arg2) {
|
|
801
|
+
const ret = makeMutClosure(arg0, arg1, 445, __wbg_adapter_30);
|
|
802
802
|
return ret;
|
|
803
803
|
};
|
|
804
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,23 +2,23 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
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
9
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
10
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
11
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
12
|
export const and: (a: any, b: any) => any;
|
|
12
13
|
export const xor: (a: any, b: any) => any;
|
|
13
14
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
14
15
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
15
16
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
16
17
|
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
18
|
export const buildInfo: () => any;
|
|
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
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure444_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure928_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure932_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|