@noir-lang/acvm_js 1.0.0-beta.3-5a3d2bc.nightly → 1.0.0-beta.3-37be49f.nightly
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nodejs/acvm_js.d.ts +58 -58
- package/nodejs/acvm_js.js +98 -96
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +11 -11
- package/package.json +1 -1
- package/web/acvm_js.d.ts +69 -69
- package/web/acvm_js.js +98 -96
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +11 -11
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
-
*/
|
|
7
|
-
export function buildInfo(): BuildInfo;
|
|
8
3
|
/**
|
|
9
4
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
10
5
|
*
|
|
@@ -34,29 +29,40 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
34
29
|
*/
|
|
35
30
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
36
31
|
/**
|
|
37
|
-
*
|
|
32
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
38
33
|
*
|
|
39
|
-
* @param {
|
|
40
|
-
* @
|
|
41
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
34
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
35
|
+
* @returns {Uint8Array} A compressed witness map
|
|
42
36
|
*/
|
|
43
|
-
export function
|
|
37
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
44
38
|
/**
|
|
45
|
-
*
|
|
39
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
40
|
+
* This should be used to only fetch the witness map for the main function.
|
|
46
41
|
*
|
|
47
|
-
* @param {Uint8Array}
|
|
48
|
-
* @
|
|
49
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
42
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
43
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
50
44
|
*/
|
|
51
|
-
export function
|
|
45
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
52
46
|
/**
|
|
53
|
-
*
|
|
47
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
54
48
|
*
|
|
55
|
-
* @param {
|
|
56
|
-
* @
|
|
57
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
49
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
50
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
58
51
|
*/
|
|
59
|
-
export function
|
|
52
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
53
|
+
/**
|
|
54
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
55
|
+
*
|
|
56
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
57
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
58
|
+
*/
|
|
59
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the package's logging level.
|
|
62
|
+
*
|
|
63
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
64
|
+
*/
|
|
65
|
+
export function initLogLevel(filter: string): void;
|
|
60
66
|
/**
|
|
61
67
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
62
68
|
*/
|
|
@@ -82,54 +88,34 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
82
88
|
*/
|
|
83
89
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
84
90
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
88
|
-
* @returns {Uint8Array} A compressed witness map
|
|
89
|
-
*/
|
|
90
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
91
|
-
/**
|
|
92
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
93
|
-
* This should be used to only fetch the witness map for the main function.
|
|
94
|
-
*
|
|
95
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
96
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
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.
|
|
97
93
|
*/
|
|
98
|
-
export function
|
|
94
|
+
export function buildInfo(): BuildInfo;
|
|
99
95
|
/**
|
|
100
|
-
*
|
|
96
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
101
97
|
*
|
|
102
|
-
* @param {
|
|
103
|
-
* @
|
|
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.
|
|
104
101
|
*/
|
|
105
|
-
export function
|
|
102
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
106
103
|
/**
|
|
107
|
-
*
|
|
104
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
108
105
|
*
|
|
109
|
-
* @param {Uint8Array}
|
|
110
|
-
* @
|
|
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.
|
|
111
109
|
*/
|
|
112
|
-
export function
|
|
110
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
113
111
|
/**
|
|
114
|
-
*
|
|
112
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
115
113
|
*
|
|
116
|
-
* @param {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
122
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
123
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
124
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when 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.
|
|
125
117
|
*/
|
|
126
|
-
export
|
|
127
|
-
gitHash: string;
|
|
128
|
-
version: string;
|
|
129
|
-
dirty: string;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
118
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
133
119
|
|
|
134
120
|
export type RawAssertionPayload = {
|
|
135
121
|
selector: string;
|
|
@@ -153,6 +139,20 @@ export type WitnessStack = Array<StackItem>;
|
|
|
153
139
|
|
|
154
140
|
|
|
155
141
|
|
|
142
|
+
/**
|
|
143
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
144
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
145
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
146
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
147
|
+
*/
|
|
148
|
+
export type BuildInfo = {
|
|
149
|
+
gitHash: string;
|
|
150
|
+
version: string;
|
|
151
|
+
dirty: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
156
|
export type ForeignCallInput = string[]
|
|
157
157
|
export type ForeignCallOutput = string | string[]
|
|
158
158
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,14 +201,6 @@ function debugString(val) {
|
|
|
201
201
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
202
202
|
return className;
|
|
203
203
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
206
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
207
|
-
*/
|
|
208
|
-
module.exports.buildInfo = function() {
|
|
209
|
-
const ret = wasm.buildInfo();
|
|
210
|
-
return ret;
|
|
211
|
-
};
|
|
212
204
|
|
|
213
205
|
function passArray8ToWasm0(arg, malloc) {
|
|
214
206
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
@@ -267,20 +259,38 @@ function takeFromExternrefTable0(idx) {
|
|
|
267
259
|
wasm.__externref_table_dealloc(idx);
|
|
268
260
|
return value;
|
|
269
261
|
}
|
|
262
|
+
|
|
263
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
264
|
+
ptr = ptr >>> 0;
|
|
265
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
266
|
+
}
|
|
270
267
|
/**
|
|
271
|
-
*
|
|
268
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
272
269
|
*
|
|
273
|
-
* @param {
|
|
274
|
-
* @
|
|
275
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
276
|
-
* @param {Uint8Array} program
|
|
277
|
-
* @param {WitnessMap} witness_map
|
|
278
|
-
* @returns {WitnessMap}
|
|
270
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
271
|
+
* @returns {Uint8Array} A compressed witness map
|
|
279
272
|
*/
|
|
280
|
-
module.exports.
|
|
281
|
-
const
|
|
273
|
+
module.exports.compressWitness = function(witness_map) {
|
|
274
|
+
const ret = wasm.compressWitness(witness_map);
|
|
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 as outputted by Nargo into a `WitnessMap`.
|
|
285
|
+
* This should be used to only fetch the witness map for the main function.
|
|
286
|
+
*
|
|
287
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
288
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
289
|
+
*/
|
|
290
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
291
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
282
292
|
const len0 = WASM_VECTOR_LEN;
|
|
283
|
-
const ret = wasm.
|
|
293
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
284
294
|
if (ret[2]) {
|
|
285
295
|
throw takeFromExternrefTable0(ret[1]);
|
|
286
296
|
}
|
|
@@ -288,19 +298,31 @@ module.exports.getReturnWitness = function(program, witness_map) {
|
|
|
288
298
|
};
|
|
289
299
|
|
|
290
300
|
/**
|
|
291
|
-
*
|
|
301
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
292
302
|
*
|
|
293
|
-
* @param {
|
|
294
|
-
* @
|
|
295
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
296
|
-
* @param {Uint8Array} program
|
|
297
|
-
* @param {WitnessMap} solved_witness
|
|
298
|
-
* @returns {WitnessMap}
|
|
303
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
304
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
299
305
|
*/
|
|
300
|
-
module.exports.
|
|
301
|
-
const
|
|
306
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
307
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
308
|
+
if (ret[3]) {
|
|
309
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
310
|
+
}
|
|
311
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
312
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
313
|
+
return v1;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
318
|
+
*
|
|
319
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
320
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
321
|
+
*/
|
|
322
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
323
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
302
324
|
const len0 = WASM_VECTOR_LEN;
|
|
303
|
-
const ret = wasm.
|
|
325
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
304
326
|
if (ret[2]) {
|
|
305
327
|
throw takeFromExternrefTable0(ret[1]);
|
|
306
328
|
}
|
|
@@ -308,23 +330,17 @@ module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
|
308
330
|
};
|
|
309
331
|
|
|
310
332
|
/**
|
|
311
|
-
*
|
|
333
|
+
* Sets the package's logging level.
|
|
312
334
|
*
|
|
313
|
-
* @param {
|
|
314
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
315
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
316
|
-
* @param {Uint8Array} program
|
|
317
|
-
* @param {WitnessMap} solved_witness
|
|
318
|
-
* @returns {WitnessMap}
|
|
335
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
319
336
|
*/
|
|
320
|
-
module.exports.
|
|
321
|
-
const ptr0 =
|
|
337
|
+
module.exports.initLogLevel = function(filter) {
|
|
338
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
322
339
|
const len0 = WASM_VECTOR_LEN;
|
|
323
|
-
const ret = wasm.
|
|
324
|
-
if (ret[
|
|
325
|
-
throw takeFromExternrefTable0(ret[
|
|
340
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
341
|
+
if (ret[1]) {
|
|
342
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
326
343
|
}
|
|
327
|
-
return takeFromExternrefTable0(ret[0]);
|
|
328
344
|
};
|
|
329
345
|
|
|
330
346
|
/**
|
|
@@ -386,10 +402,6 @@ module.exports.sha256_compression = function(inputs, state) {
|
|
|
386
402
|
return v3;
|
|
387
403
|
};
|
|
388
404
|
|
|
389
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
390
|
-
ptr = ptr >>> 0;
|
|
391
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
392
|
-
}
|
|
393
405
|
/**
|
|
394
406
|
* Calculates the Blake2s256 hash of the input bytes
|
|
395
407
|
* @param {Uint8Array} inputs
|
|
@@ -447,32 +459,28 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
447
459
|
};
|
|
448
460
|
|
|
449
461
|
/**
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
453
|
-
* @returns {Uint8Array} A compressed witness map
|
|
462
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
463
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
454
464
|
*/
|
|
455
|
-
module.exports.
|
|
456
|
-
const ret = wasm.
|
|
457
|
-
|
|
458
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
459
|
-
}
|
|
460
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
461
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
462
|
-
return v1;
|
|
465
|
+
module.exports.buildInfo = function() {
|
|
466
|
+
const ret = wasm.buildInfo();
|
|
467
|
+
return ret;
|
|
463
468
|
};
|
|
464
469
|
|
|
465
470
|
/**
|
|
466
|
-
*
|
|
467
|
-
* This should be used to only fetch the witness map for the main function.
|
|
471
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
468
472
|
*
|
|
469
|
-
* @param {Uint8Array}
|
|
470
|
-
* @
|
|
473
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
474
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
475
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
476
|
+
* @param {Uint8Array} program
|
|
477
|
+
* @param {WitnessMap} witness_map
|
|
478
|
+
* @returns {WitnessMap}
|
|
471
479
|
*/
|
|
472
|
-
module.exports.
|
|
473
|
-
const ptr0 = passArray8ToWasm0(
|
|
480
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
481
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
474
482
|
const len0 = WASM_VECTOR_LEN;
|
|
475
|
-
const ret = wasm.
|
|
483
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
476
484
|
if (ret[2]) {
|
|
477
485
|
throw takeFromExternrefTable0(ret[1]);
|
|
478
486
|
}
|
|
@@ -480,31 +488,19 @@ module.exports.decompressWitness = function(compressed_witness) {
|
|
|
480
488
|
};
|
|
481
489
|
|
|
482
490
|
/**
|
|
483
|
-
*
|
|
484
|
-
*
|
|
485
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
486
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
487
|
-
*/
|
|
488
|
-
module.exports.compressWitnessStack = function(witness_stack) {
|
|
489
|
-
const ret = wasm.compressWitnessStack(witness_stack);
|
|
490
|
-
if (ret[3]) {
|
|
491
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
492
|
-
}
|
|
493
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
494
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
495
|
-
return v1;
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
491
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
500
492
|
*
|
|
501
|
-
* @param {Uint8Array}
|
|
502
|
-
* @
|
|
493
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
494
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
495
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
496
|
+
* @param {Uint8Array} program
|
|
497
|
+
* @param {WitnessMap} solved_witness
|
|
498
|
+
* @returns {WitnessMap}
|
|
503
499
|
*/
|
|
504
|
-
module.exports.
|
|
505
|
-
const ptr0 = passArray8ToWasm0(
|
|
500
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
501
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
506
502
|
const len0 = WASM_VECTOR_LEN;
|
|
507
|
-
const ret = wasm.
|
|
503
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
508
504
|
if (ret[2]) {
|
|
509
505
|
throw takeFromExternrefTable0(ret[1]);
|
|
510
506
|
}
|
|
@@ -512,17 +508,23 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
512
508
|
};
|
|
513
509
|
|
|
514
510
|
/**
|
|
515
|
-
*
|
|
511
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
516
512
|
*
|
|
517
|
-
* @param {
|
|
513
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
514
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
515
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
516
|
+
* @param {Uint8Array} program
|
|
517
|
+
* @param {WitnessMap} solved_witness
|
|
518
|
+
* @returns {WitnessMap}
|
|
518
519
|
*/
|
|
519
|
-
module.exports.
|
|
520
|
-
const ptr0 =
|
|
520
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
521
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
521
522
|
const len0 = WASM_VECTOR_LEN;
|
|
522
|
-
const ret = wasm.
|
|
523
|
-
if (ret[
|
|
524
|
-
throw takeFromExternrefTable0(ret[
|
|
523
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
524
|
+
if (ret[2]) {
|
|
525
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
525
526
|
}
|
|
527
|
+
return takeFromExternrefTable0(ret[0]);
|
|
526
528
|
};
|
|
527
529
|
|
|
528
530
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
@@ -530,11 +532,11 @@ function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
|
530
532
|
}
|
|
531
533
|
|
|
532
534
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
533
|
-
wasm.
|
|
535
|
+
wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
534
536
|
}
|
|
535
537
|
|
|
536
538
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
537
|
-
wasm.
|
|
539
|
+
wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
|
|
538
540
|
}
|
|
539
541
|
|
|
540
542
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -812,7 +814,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
812
814
|
return ret;
|
|
813
815
|
};
|
|
814
816
|
|
|
815
|
-
module.exports.
|
|
817
|
+
module.exports.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
|
|
816
818
|
const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
|
|
817
819
|
return ret;
|
|
818
820
|
};
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const buildInfo: () => any;
|
|
5
4
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
5
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
6
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
7
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
8
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
9
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
10
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
11
|
+
export const initLogLevel: (a: number, b: 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
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
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;
|
|
@@ -28,6 +28,6 @@ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) =>
|
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
30
|
export const closure265_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
31
|
+
export const closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure830_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
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
-
*/
|
|
7
|
-
export function buildInfo(): BuildInfo;
|
|
8
3
|
/**
|
|
9
4
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
10
5
|
*
|
|
@@ -34,29 +29,40 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
34
29
|
*/
|
|
35
30
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
36
31
|
/**
|
|
37
|
-
*
|
|
32
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
38
33
|
*
|
|
39
|
-
* @param {
|
|
40
|
-
* @
|
|
41
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
34
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
35
|
+
* @returns {Uint8Array} A compressed witness map
|
|
42
36
|
*/
|
|
43
|
-
export function
|
|
37
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
44
38
|
/**
|
|
45
|
-
*
|
|
39
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
40
|
+
* This should be used to only fetch the witness map for the main function.
|
|
46
41
|
*
|
|
47
|
-
* @param {Uint8Array}
|
|
48
|
-
* @
|
|
49
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
42
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
43
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
50
44
|
*/
|
|
51
|
-
export function
|
|
45
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
52
46
|
/**
|
|
53
|
-
*
|
|
47
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
54
48
|
*
|
|
55
|
-
* @param {
|
|
56
|
-
* @
|
|
57
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
49
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
50
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
58
51
|
*/
|
|
59
|
-
export function
|
|
52
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
53
|
+
/**
|
|
54
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
55
|
+
*
|
|
56
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
57
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
58
|
+
*/
|
|
59
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
60
|
+
/**
|
|
61
|
+
* Sets the package's logging level.
|
|
62
|
+
*
|
|
63
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
64
|
+
*/
|
|
65
|
+
export function initLogLevel(filter: string): void;
|
|
60
66
|
/**
|
|
61
67
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
62
68
|
*/
|
|
@@ -82,54 +88,34 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
82
88
|
*/
|
|
83
89
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
84
90
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
88
|
-
* @returns {Uint8Array} A compressed witness map
|
|
89
|
-
*/
|
|
90
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
91
|
-
/**
|
|
92
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
93
|
-
* This should be used to only fetch the witness map for the main function.
|
|
94
|
-
*
|
|
95
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
96
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
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.
|
|
97
93
|
*/
|
|
98
|
-
export function
|
|
94
|
+
export function buildInfo(): BuildInfo;
|
|
99
95
|
/**
|
|
100
|
-
*
|
|
96
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
101
97
|
*
|
|
102
|
-
* @param {
|
|
103
|
-
* @
|
|
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.
|
|
104
101
|
*/
|
|
105
|
-
export function
|
|
102
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
106
103
|
/**
|
|
107
|
-
*
|
|
104
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
108
105
|
*
|
|
109
|
-
* @param {Uint8Array}
|
|
110
|
-
* @
|
|
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.
|
|
111
109
|
*/
|
|
112
|
-
export function
|
|
110
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
113
111
|
/**
|
|
114
|
-
*
|
|
112
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
115
113
|
*
|
|
116
|
-
* @param {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
122
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
123
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
124
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when 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.
|
|
125
117
|
*/
|
|
126
|
-
export
|
|
127
|
-
gitHash: string;
|
|
128
|
-
version: string;
|
|
129
|
-
dirty: string;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
118
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
133
119
|
|
|
134
120
|
export type RawAssertionPayload = {
|
|
135
121
|
selector: string;
|
|
@@ -153,6 +139,20 @@ export type WitnessStack = Array<StackItem>;
|
|
|
153
139
|
|
|
154
140
|
|
|
155
141
|
|
|
142
|
+
/**
|
|
143
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
144
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
145
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
146
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
147
|
+
*/
|
|
148
|
+
export type BuildInfo = {
|
|
149
|
+
gitHash: string;
|
|
150
|
+
version: string;
|
|
151
|
+
dirty: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
156
|
export type ForeignCallInput = string[]
|
|
157
157
|
export type ForeignCallOutput = string | string[]
|
|
158
158
|
|
|
@@ -186,24 +186,24 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
186
186
|
|
|
187
187
|
export interface InitOutput {
|
|
188
188
|
readonly memory: WebAssembly.Memory;
|
|
189
|
-
readonly buildInfo: () => any;
|
|
190
189
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
191
190
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
192
191
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
193
|
-
readonly
|
|
194
|
-
readonly
|
|
195
|
-
readonly
|
|
192
|
+
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
193
|
+
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
194
|
+
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
195
|
+
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
196
|
+
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
196
197
|
readonly and: (a: any, b: any) => any;
|
|
197
198
|
readonly xor: (a: any, b: any) => any;
|
|
198
199
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
199
200
|
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
200
201
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
201
202
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
202
|
-
readonly
|
|
203
|
-
readonly
|
|
204
|
-
readonly
|
|
205
|
-
readonly
|
|
206
|
-
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
203
|
+
readonly buildInfo: () => any;
|
|
204
|
+
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
205
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
206
|
+
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
207
207
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
208
208
|
readonly __externref_table_alloc: () => number;
|
|
209
209
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -213,8 +213,8 @@ export interface InitOutput {
|
|
|
213
213
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
214
214
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
215
215
|
readonly closure265_externref_shim: (a: number, b: number, c: any) => void;
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
216
|
+
readonly closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
217
|
+
readonly closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
218
218
|
readonly __wbindgen_start: () => void;
|
|
219
219
|
}
|
|
220
220
|
|
package/web/acvm_js.js
CHANGED
|
@@ -197,14 +197,6 @@ function debugString(val) {
|
|
|
197
197
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
198
198
|
return className;
|
|
199
199
|
}
|
|
200
|
-
/**
|
|
201
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
202
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
203
|
-
*/
|
|
204
|
-
export function buildInfo() {
|
|
205
|
-
const ret = wasm.buildInfo();
|
|
206
|
-
return ret;
|
|
207
|
-
}
|
|
208
200
|
|
|
209
201
|
function passArray8ToWasm0(arg, malloc) {
|
|
210
202
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
@@ -263,20 +255,38 @@ function takeFromExternrefTable0(idx) {
|
|
|
263
255
|
wasm.__externref_table_dealloc(idx);
|
|
264
256
|
return value;
|
|
265
257
|
}
|
|
258
|
+
|
|
259
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
260
|
+
ptr = ptr >>> 0;
|
|
261
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
262
|
+
}
|
|
266
263
|
/**
|
|
267
|
-
*
|
|
264
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
268
265
|
*
|
|
269
|
-
* @param {
|
|
270
|
-
* @
|
|
271
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
272
|
-
* @param {Uint8Array} program
|
|
273
|
-
* @param {WitnessMap} witness_map
|
|
274
|
-
* @returns {WitnessMap}
|
|
266
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
267
|
+
* @returns {Uint8Array} A compressed witness map
|
|
275
268
|
*/
|
|
276
|
-
export function
|
|
277
|
-
const
|
|
269
|
+
export function compressWitness(witness_map) {
|
|
270
|
+
const ret = wasm.compressWitness(witness_map);
|
|
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 as outputted by Nargo into a `WitnessMap`.
|
|
281
|
+
* This should be used to only fetch the witness map for the main function.
|
|
282
|
+
*
|
|
283
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
284
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
285
|
+
*/
|
|
286
|
+
export function decompressWitness(compressed_witness) {
|
|
287
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
278
288
|
const len0 = WASM_VECTOR_LEN;
|
|
279
|
-
const ret = wasm.
|
|
289
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
280
290
|
if (ret[2]) {
|
|
281
291
|
throw takeFromExternrefTable0(ret[1]);
|
|
282
292
|
}
|
|
@@ -284,19 +294,31 @@ export function getReturnWitness(program, witness_map) {
|
|
|
284
294
|
}
|
|
285
295
|
|
|
286
296
|
/**
|
|
287
|
-
*
|
|
297
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
288
298
|
*
|
|
289
|
-
* @param {
|
|
290
|
-
* @
|
|
291
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
292
|
-
* @param {Uint8Array} program
|
|
293
|
-
* @param {WitnessMap} solved_witness
|
|
294
|
-
* @returns {WitnessMap}
|
|
299
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
300
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
295
301
|
*/
|
|
296
|
-
export function
|
|
297
|
-
const
|
|
302
|
+
export function compressWitnessStack(witness_stack) {
|
|
303
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
304
|
+
if (ret[3]) {
|
|
305
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
306
|
+
}
|
|
307
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
308
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
309
|
+
return v1;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
314
|
+
*
|
|
315
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
316
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
317
|
+
*/
|
|
318
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
319
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
298
320
|
const len0 = WASM_VECTOR_LEN;
|
|
299
|
-
const ret = wasm.
|
|
321
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
300
322
|
if (ret[2]) {
|
|
301
323
|
throw takeFromExternrefTable0(ret[1]);
|
|
302
324
|
}
|
|
@@ -304,23 +326,17 @@ export function getPublicParametersWitness(program, solved_witness) {
|
|
|
304
326
|
}
|
|
305
327
|
|
|
306
328
|
/**
|
|
307
|
-
*
|
|
329
|
+
* Sets the package's logging level.
|
|
308
330
|
*
|
|
309
|
-
* @param {
|
|
310
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
311
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
312
|
-
* @param {Uint8Array} program
|
|
313
|
-
* @param {WitnessMap} solved_witness
|
|
314
|
-
* @returns {WitnessMap}
|
|
331
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
315
332
|
*/
|
|
316
|
-
export function
|
|
317
|
-
const ptr0 =
|
|
333
|
+
export function initLogLevel(filter) {
|
|
334
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
318
335
|
const len0 = WASM_VECTOR_LEN;
|
|
319
|
-
const ret = wasm.
|
|
320
|
-
if (ret[
|
|
321
|
-
throw takeFromExternrefTable0(ret[
|
|
336
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
337
|
+
if (ret[1]) {
|
|
338
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
322
339
|
}
|
|
323
|
-
return takeFromExternrefTable0(ret[0]);
|
|
324
340
|
}
|
|
325
341
|
|
|
326
342
|
/**
|
|
@@ -382,10 +398,6 @@ export function sha256_compression(inputs, state) {
|
|
|
382
398
|
return v3;
|
|
383
399
|
}
|
|
384
400
|
|
|
385
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
386
|
-
ptr = ptr >>> 0;
|
|
387
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
388
|
-
}
|
|
389
401
|
/**
|
|
390
402
|
* Calculates the Blake2s256 hash of the input bytes
|
|
391
403
|
* @param {Uint8Array} inputs
|
|
@@ -443,32 +455,28 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
443
455
|
}
|
|
444
456
|
|
|
445
457
|
/**
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
449
|
-
* @returns {Uint8Array} A compressed witness map
|
|
458
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
459
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
450
460
|
*/
|
|
451
|
-
export function
|
|
452
|
-
const ret = wasm.
|
|
453
|
-
|
|
454
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
455
|
-
}
|
|
456
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
457
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
458
|
-
return v1;
|
|
461
|
+
export function buildInfo() {
|
|
462
|
+
const ret = wasm.buildInfo();
|
|
463
|
+
return ret;
|
|
459
464
|
}
|
|
460
465
|
|
|
461
466
|
/**
|
|
462
|
-
*
|
|
463
|
-
* This should be used to only fetch the witness map for the main function.
|
|
467
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
464
468
|
*
|
|
465
|
-
* @param {Uint8Array}
|
|
466
|
-
* @
|
|
469
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
470
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
471
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
472
|
+
* @param {Uint8Array} program
|
|
473
|
+
* @param {WitnessMap} witness_map
|
|
474
|
+
* @returns {WitnessMap}
|
|
467
475
|
*/
|
|
468
|
-
export function
|
|
469
|
-
const ptr0 = passArray8ToWasm0(
|
|
476
|
+
export function getReturnWitness(program, witness_map) {
|
|
477
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
470
478
|
const len0 = WASM_VECTOR_LEN;
|
|
471
|
-
const ret = wasm.
|
|
479
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
472
480
|
if (ret[2]) {
|
|
473
481
|
throw takeFromExternrefTable0(ret[1]);
|
|
474
482
|
}
|
|
@@ -476,31 +484,19 @@ export function decompressWitness(compressed_witness) {
|
|
|
476
484
|
}
|
|
477
485
|
|
|
478
486
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
482
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
483
|
-
*/
|
|
484
|
-
export function compressWitnessStack(witness_stack) {
|
|
485
|
-
const ret = wasm.compressWitnessStack(witness_stack);
|
|
486
|
-
if (ret[3]) {
|
|
487
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
488
|
-
}
|
|
489
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
490
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
491
|
-
return v1;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
487
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
496
488
|
*
|
|
497
|
-
* @param {Uint8Array}
|
|
498
|
-
* @
|
|
489
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
490
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
491
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
492
|
+
* @param {Uint8Array} program
|
|
493
|
+
* @param {WitnessMap} solved_witness
|
|
494
|
+
* @returns {WitnessMap}
|
|
499
495
|
*/
|
|
500
|
-
export function
|
|
501
|
-
const ptr0 = passArray8ToWasm0(
|
|
496
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
497
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
502
498
|
const len0 = WASM_VECTOR_LEN;
|
|
503
|
-
const ret = wasm.
|
|
499
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
504
500
|
if (ret[2]) {
|
|
505
501
|
throw takeFromExternrefTable0(ret[1]);
|
|
506
502
|
}
|
|
@@ -508,17 +504,23 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
508
504
|
}
|
|
509
505
|
|
|
510
506
|
/**
|
|
511
|
-
*
|
|
507
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
512
508
|
*
|
|
513
|
-
* @param {
|
|
509
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
510
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
511
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
512
|
+
* @param {Uint8Array} program
|
|
513
|
+
* @param {WitnessMap} solved_witness
|
|
514
|
+
* @returns {WitnessMap}
|
|
514
515
|
*/
|
|
515
|
-
export function
|
|
516
|
-
const ptr0 =
|
|
516
|
+
export function getPublicWitness(program, solved_witness) {
|
|
517
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
517
518
|
const len0 = WASM_VECTOR_LEN;
|
|
518
|
-
const ret = wasm.
|
|
519
|
-
if (ret[
|
|
520
|
-
throw takeFromExternrefTable0(ret[
|
|
519
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
520
|
+
if (ret[2]) {
|
|
521
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
521
522
|
}
|
|
523
|
+
return takeFromExternrefTable0(ret[0]);
|
|
522
524
|
}
|
|
523
525
|
|
|
524
526
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
@@ -526,11 +528,11 @@ function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
|
526
528
|
}
|
|
527
529
|
|
|
528
530
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
529
|
-
wasm.
|
|
531
|
+
wasm.closure826_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
530
532
|
}
|
|
531
533
|
|
|
532
534
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
533
|
-
wasm.
|
|
535
|
+
wasm.closure830_externref_shim(arg0, arg1, arg2, arg3);
|
|
534
536
|
}
|
|
535
537
|
|
|
536
538
|
async function __wbg_load(module, imports) {
|
|
@@ -796,7 +798,7 @@ function __wbg_get_imports() {
|
|
|
796
798
|
const ret = false;
|
|
797
799
|
return ret;
|
|
798
800
|
};
|
|
799
|
-
imports.wbg.
|
|
801
|
+
imports.wbg.__wbindgen_closure_wrapper740 = function(arg0, arg1, arg2) {
|
|
800
802
|
const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_30);
|
|
801
803
|
return ret;
|
|
802
804
|
};
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const buildInfo: () => any;
|
|
5
4
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
5
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
6
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
7
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
8
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
9
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
10
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
11
|
+
export const initLogLevel: (a: number, b: 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
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
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;
|
|
@@ -28,6 +28,6 @@ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) =>
|
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
30
|
export const closure265_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
31
|
+
export const closure826_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure830_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|