@noir-lang/acvm_js 1.0.0-beta.6-ef6d866.nightly → 1.0.0-beta.6-4a4ab26.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 +63 -63
- package/nodejs/acvm_js.js +126 -124
- 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 +74 -74
- package/web/acvm_js.js +126 -124
- 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,34 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
|
+
*
|
|
6
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
7
|
+
* @returns {Uint8Array} A compressed witness map
|
|
6
8
|
*/
|
|
7
|
-
export function
|
|
9
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
10
|
+
/**
|
|
11
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
12
|
+
* This should be used to only fetch the witness map for the main function.
|
|
13
|
+
*
|
|
14
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
15
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
16
|
+
*/
|
|
17
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
18
|
+
/**
|
|
19
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
20
|
+
*
|
|
21
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
22
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
23
|
+
*/
|
|
24
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
25
|
+
/**
|
|
26
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
27
|
+
*
|
|
28
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
29
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
30
|
+
*/
|
|
31
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
8
32
|
/**
|
|
9
33
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
10
34
|
*
|
|
@@ -33,30 +57,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
33
57
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
34
58
|
*/
|
|
35
59
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
36
|
-
/**
|
|
37
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
38
|
-
*
|
|
39
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
40
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
41
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
42
|
-
*/
|
|
43
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
44
|
-
/**
|
|
45
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
46
|
-
*
|
|
47
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
48
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
49
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
50
|
-
*/
|
|
51
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
52
|
-
/**
|
|
53
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
54
|
-
*
|
|
55
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
57
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
58
|
-
*/
|
|
59
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
60
60
|
/**
|
|
61
61
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
62
62
|
*/
|
|
@@ -82,40 +82,40 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
82
82
|
*/
|
|
83
83
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
88
|
-
* @returns {Uint8Array} A compressed witness map
|
|
85
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
86
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
89
87
|
*/
|
|
90
|
-
export function
|
|
88
|
+
export function buildInfo(): BuildInfo;
|
|
91
89
|
/**
|
|
92
|
-
*
|
|
93
|
-
* This should be used to only fetch the witness map for the main function.
|
|
90
|
+
* Sets the package's logging level.
|
|
94
91
|
*
|
|
95
|
-
* @param {
|
|
96
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
92
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
97
93
|
*/
|
|
98
|
-
export function
|
|
94
|
+
export function initLogLevel(filter: string): void;
|
|
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 {
|
|
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
119
|
|
|
120
120
|
/**
|
|
121
121
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -145,6 +145,21 @@ export type ExecutionError = Error & {
|
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
|
|
148
|
+
// Map from witness index to hex string value of witness.
|
|
149
|
+
export type WitnessMap = Map<number, string>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* An execution result containing two witnesses.
|
|
153
|
+
* 1. The full solved witness of the execution.
|
|
154
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
155
|
+
*/
|
|
156
|
+
export type SolvedAndReturnWitness = {
|
|
157
|
+
solvedWitness: WitnessMap;
|
|
158
|
+
returnWitness: WitnessMap;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
148
163
|
export type ForeignCallInput = string[]
|
|
149
164
|
export type ForeignCallOutput = string | string[]
|
|
150
165
|
|
|
@@ -167,18 +182,3 @@ export type StackItem = {
|
|
|
167
182
|
export type WitnessStack = Array<StackItem>;
|
|
168
183
|
|
|
169
184
|
|
|
170
|
-
|
|
171
|
-
// Map from witness index to hex string value of witness.
|
|
172
|
-
export type WitnessMap = Map<number, string>;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* An execution result containing two witnesses.
|
|
176
|
-
* 1. The full solved witness of the execution.
|
|
177
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
178
|
-
*/
|
|
179
|
-
export type SolvedAndReturnWitness = {
|
|
180
|
-
solvedWitness: WitnessMap;
|
|
181
|
-
returnWitness: WitnessMap;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,13 +201,31 @@ 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
|
+
function takeFromExternrefTable0(idx) {
|
|
206
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
207
|
+
wasm.__externref_table_dealloc(idx);
|
|
208
|
+
return value;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
212
|
+
ptr = ptr >>> 0;
|
|
213
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
214
|
+
}
|
|
204
215
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
216
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
217
|
+
*
|
|
218
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
219
|
+
* @returns {Uint8Array} A compressed witness map
|
|
207
220
|
*/
|
|
208
|
-
module.exports.
|
|
209
|
-
const ret = wasm.
|
|
210
|
-
|
|
221
|
+
module.exports.compressWitness = function(witness_map) {
|
|
222
|
+
const ret = wasm.compressWitness(witness_map);
|
|
223
|
+
if (ret[3]) {
|
|
224
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
225
|
+
}
|
|
226
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
227
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
228
|
+
return v1;
|
|
211
229
|
};
|
|
212
230
|
|
|
213
231
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -216,6 +234,55 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
216
234
|
WASM_VECTOR_LEN = arg.length;
|
|
217
235
|
return ptr;
|
|
218
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
239
|
+
* This should be used to only fetch the witness map for the main function.
|
|
240
|
+
*
|
|
241
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
242
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
243
|
+
*/
|
|
244
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
245
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
246
|
+
const len0 = WASM_VECTOR_LEN;
|
|
247
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
248
|
+
if (ret[2]) {
|
|
249
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
250
|
+
}
|
|
251
|
+
return takeFromExternrefTable0(ret[0]);
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
256
|
+
*
|
|
257
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
258
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
259
|
+
*/
|
|
260
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
261
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
262
|
+
if (ret[3]) {
|
|
263
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
264
|
+
}
|
|
265
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
266
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
267
|
+
return v1;
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
272
|
+
*
|
|
273
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
274
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
275
|
+
*/
|
|
276
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
277
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
278
|
+
const len0 = WASM_VECTOR_LEN;
|
|
279
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
280
|
+
if (ret[2]) {
|
|
281
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
282
|
+
}
|
|
283
|
+
return takeFromExternrefTable0(ret[0]);
|
|
284
|
+
};
|
|
285
|
+
|
|
219
286
|
/**
|
|
220
287
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
221
288
|
*
|
|
@@ -262,71 +329,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
262
329
|
return ret;
|
|
263
330
|
};
|
|
264
331
|
|
|
265
|
-
function takeFromExternrefTable0(idx) {
|
|
266
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
267
|
-
wasm.__externref_table_dealloc(idx);
|
|
268
|
-
return value;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
272
|
-
*
|
|
273
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
274
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
275
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
276
|
-
* @param {Uint8Array} program
|
|
277
|
-
* @param {WitnessMap} witness_map
|
|
278
|
-
* @returns {WitnessMap}
|
|
279
|
-
*/
|
|
280
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
281
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
282
|
-
const len0 = WASM_VECTOR_LEN;
|
|
283
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
284
|
-
if (ret[2]) {
|
|
285
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
286
|
-
}
|
|
287
|
-
return takeFromExternrefTable0(ret[0]);
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
292
|
-
*
|
|
293
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
294
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
295
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
296
|
-
* @param {Uint8Array} program
|
|
297
|
-
* @param {WitnessMap} solved_witness
|
|
298
|
-
* @returns {WitnessMap}
|
|
299
|
-
*/
|
|
300
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
301
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
302
|
-
const len0 = WASM_VECTOR_LEN;
|
|
303
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
304
|
-
if (ret[2]) {
|
|
305
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
306
|
-
}
|
|
307
|
-
return takeFromExternrefTable0(ret[0]);
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
/**
|
|
311
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
312
|
-
*
|
|
313
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
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}
|
|
319
|
-
*/
|
|
320
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
321
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
322
|
-
const len0 = WASM_VECTOR_LEN;
|
|
323
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
324
|
-
if (ret[2]) {
|
|
325
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
326
|
-
}
|
|
327
|
-
return takeFromExternrefTable0(ret[0]);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
332
|
/**
|
|
331
333
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
332
334
|
* @param {string} lhs
|
|
@@ -386,10 +388,6 @@ module.exports.sha256_compression = function(inputs, state) {
|
|
|
386
388
|
return v3;
|
|
387
389
|
};
|
|
388
390
|
|
|
389
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
390
|
-
ptr = ptr >>> 0;
|
|
391
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
392
|
-
}
|
|
393
391
|
/**
|
|
394
392
|
* Calculates the Blake2s256 hash of the input bytes
|
|
395
393
|
* @param {Uint8Array} inputs
|
|
@@ -447,64 +445,62 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
447
445
|
};
|
|
448
446
|
|
|
449
447
|
/**
|
|
450
|
-
*
|
|
451
|
-
*
|
|
452
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
453
|
-
* @returns {Uint8Array} A compressed witness map
|
|
448
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
449
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
454
450
|
*/
|
|
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;
|
|
451
|
+
module.exports.buildInfo = function() {
|
|
452
|
+
const ret = wasm.buildInfo();
|
|
453
|
+
return ret;
|
|
463
454
|
};
|
|
464
455
|
|
|
465
456
|
/**
|
|
466
|
-
*
|
|
467
|
-
* This should be used to only fetch the witness map for the main function.
|
|
457
|
+
* Sets the package's logging level.
|
|
468
458
|
*
|
|
469
|
-
* @param {
|
|
470
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
459
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
471
460
|
*/
|
|
472
|
-
module.exports.
|
|
473
|
-
const ptr0 =
|
|
461
|
+
module.exports.initLogLevel = function(filter) {
|
|
462
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
474
463
|
const len0 = WASM_VECTOR_LEN;
|
|
475
|
-
const ret = wasm.
|
|
476
|
-
if (ret[
|
|
477
|
-
throw takeFromExternrefTable0(ret[
|
|
464
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
465
|
+
if (ret[1]) {
|
|
466
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
478
467
|
}
|
|
479
|
-
return takeFromExternrefTable0(ret[0]);
|
|
480
468
|
};
|
|
481
469
|
|
|
482
470
|
/**
|
|
483
|
-
*
|
|
471
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
484
472
|
*
|
|
485
|
-
* @param {
|
|
486
|
-
* @
|
|
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}
|
|
487
479
|
*/
|
|
488
|
-
module.exports.
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
480
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
481
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
482
|
+
const len0 = WASM_VECTOR_LEN;
|
|
483
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
484
|
+
if (ret[2]) {
|
|
485
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
492
486
|
}
|
|
493
|
-
|
|
494
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
495
|
-
return v1;
|
|
487
|
+
return takeFromExternrefTable0(ret[0]);
|
|
496
488
|
};
|
|
497
489
|
|
|
498
490
|
/**
|
|
499
|
-
*
|
|
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,29 +508,35 @@ 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) {
|
|
529
|
-
wasm.
|
|
531
|
+
wasm.closure605_externref_shim(arg0, arg1, arg2);
|
|
530
532
|
}
|
|
531
533
|
|
|
532
534
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
533
|
-
wasm.
|
|
535
|
+
wasm.closure1249_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.closure1253_externref_shim(arg0, arg1, arg2, arg3);
|
|
538
540
|
}
|
|
539
541
|
|
|
540
542
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -812,8 +814,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
812
814
|
return ret;
|
|
813
815
|
};
|
|
814
816
|
|
|
815
|
-
module.exports.
|
|
816
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
817
|
+
module.exports.__wbindgen_closure_wrapper2096 = function(arg0, arg1, arg2) {
|
|
818
|
+
const ret = makeMutClosure(arg0, arg1, 606, __wbg_adapter_30);
|
|
817
819
|
return ret;
|
|
818
820
|
};
|
|
819
821
|
|
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
|
|
4
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
5
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
6
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
7
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
5
8
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
9
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
10
|
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
11
|
export const and: (a: any, b: any) => any;
|
|
12
12
|
export const xor: (a: any, b: any) => any;
|
|
13
13
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
14
14
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
15
15
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
16
16
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
17
|
-
export const
|
|
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];
|
|
17
|
+
export const buildInfo: () => any;
|
|
21
18
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
19
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure605_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure1249_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure1253_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,34 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
|
+
*
|
|
6
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
7
|
+
* @returns {Uint8Array} A compressed witness map
|
|
6
8
|
*/
|
|
7
|
-
export function
|
|
9
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
10
|
+
/**
|
|
11
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
12
|
+
* This should be used to only fetch the witness map for the main function.
|
|
13
|
+
*
|
|
14
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
15
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
16
|
+
*/
|
|
17
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
18
|
+
/**
|
|
19
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
20
|
+
*
|
|
21
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
22
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
23
|
+
*/
|
|
24
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
25
|
+
/**
|
|
26
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
27
|
+
*
|
|
28
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
29
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
30
|
+
*/
|
|
31
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
8
32
|
/**
|
|
9
33
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
10
34
|
*
|
|
@@ -33,30 +57,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
33
57
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
34
58
|
*/
|
|
35
59
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
36
|
-
/**
|
|
37
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
38
|
-
*
|
|
39
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
40
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
41
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
42
|
-
*/
|
|
43
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
44
|
-
/**
|
|
45
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
46
|
-
*
|
|
47
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
48
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
49
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
50
|
-
*/
|
|
51
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
52
|
-
/**
|
|
53
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
54
|
-
*
|
|
55
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
57
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
58
|
-
*/
|
|
59
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
60
60
|
/**
|
|
61
61
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
62
62
|
*/
|
|
@@ -82,40 +82,40 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
82
82
|
*/
|
|
83
83
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
88
|
-
* @returns {Uint8Array} A compressed witness map
|
|
85
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
86
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
89
87
|
*/
|
|
90
|
-
export function
|
|
88
|
+
export function buildInfo(): BuildInfo;
|
|
91
89
|
/**
|
|
92
|
-
*
|
|
93
|
-
* This should be used to only fetch the witness map for the main function.
|
|
90
|
+
* Sets the package's logging level.
|
|
94
91
|
*
|
|
95
|
-
* @param {
|
|
96
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
92
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
97
93
|
*/
|
|
98
|
-
export function
|
|
94
|
+
export function initLogLevel(filter: string): void;
|
|
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 {
|
|
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
119
|
|
|
120
120
|
/**
|
|
121
121
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -145,6 +145,21 @@ export type ExecutionError = Error & {
|
|
|
145
145
|
|
|
146
146
|
|
|
147
147
|
|
|
148
|
+
// Map from witness index to hex string value of witness.
|
|
149
|
+
export type WitnessMap = Map<number, string>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* An execution result containing two witnesses.
|
|
153
|
+
* 1. The full solved witness of the execution.
|
|
154
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
155
|
+
*/
|
|
156
|
+
export type SolvedAndReturnWitness = {
|
|
157
|
+
solvedWitness: WitnessMap;
|
|
158
|
+
returnWitness: WitnessMap;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
148
163
|
export type ForeignCallInput = string[]
|
|
149
164
|
export type ForeignCallOutput = string | string[]
|
|
150
165
|
|
|
@@ -168,43 +183,28 @@ export type WitnessStack = Array<StackItem>;
|
|
|
168
183
|
|
|
169
184
|
|
|
170
185
|
|
|
171
|
-
// Map from witness index to hex string value of witness.
|
|
172
|
-
export type WitnessMap = Map<number, string>;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* An execution result containing two witnesses.
|
|
176
|
-
* 1. The full solved witness of the execution.
|
|
177
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
178
|
-
*/
|
|
179
|
-
export type SolvedAndReturnWitness = {
|
|
180
|
-
solvedWitness: WitnessMap;
|
|
181
|
-
returnWitness: WitnessMap;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
186
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
-
readonly
|
|
190
|
+
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
191
|
+
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
192
|
+
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
193
|
+
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
191
194
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
192
195
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
193
196
|
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
197
|
readonly and: (a: any, b: any) => any;
|
|
198
198
|
readonly xor: (a: any, b: any) => any;
|
|
199
199
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
200
200
|
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
201
201
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
202
202
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
203
|
-
readonly
|
|
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];
|
|
203
|
+
readonly buildInfo: () => any;
|
|
207
204
|
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
205
|
+
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
206
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
207
|
+
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
208
208
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
209
209
|
readonly __externref_table_alloc: () => number;
|
|
210
210
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -213,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 closure605_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure1249_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure1253_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
|
@@ -197,13 +197,31 @@ 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
|
+
function takeFromExternrefTable0(idx) {
|
|
202
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
203
|
+
wasm.__externref_table_dealloc(idx);
|
|
204
|
+
return value;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
208
|
+
ptr = ptr >>> 0;
|
|
209
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
210
|
+
}
|
|
200
211
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
212
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
213
|
+
*
|
|
214
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
215
|
+
* @returns {Uint8Array} A compressed witness map
|
|
203
216
|
*/
|
|
204
|
-
export function
|
|
205
|
-
const ret = wasm.
|
|
206
|
-
|
|
217
|
+
export function compressWitness(witness_map) {
|
|
218
|
+
const ret = wasm.compressWitness(witness_map);
|
|
219
|
+
if (ret[3]) {
|
|
220
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
221
|
+
}
|
|
222
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
223
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
224
|
+
return v1;
|
|
207
225
|
}
|
|
208
226
|
|
|
209
227
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -212,6 +230,55 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
212
230
|
WASM_VECTOR_LEN = arg.length;
|
|
213
231
|
return ptr;
|
|
214
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
235
|
+
* This should be used to only fetch the witness map for the main function.
|
|
236
|
+
*
|
|
237
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
238
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
239
|
+
*/
|
|
240
|
+
export function decompressWitness(compressed_witness) {
|
|
241
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
242
|
+
const len0 = WASM_VECTOR_LEN;
|
|
243
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
244
|
+
if (ret[2]) {
|
|
245
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
246
|
+
}
|
|
247
|
+
return takeFromExternrefTable0(ret[0]);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
252
|
+
*
|
|
253
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
254
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
255
|
+
*/
|
|
256
|
+
export function compressWitnessStack(witness_stack) {
|
|
257
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
258
|
+
if (ret[3]) {
|
|
259
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
260
|
+
}
|
|
261
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
262
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
263
|
+
return v1;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
268
|
+
*
|
|
269
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
270
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
271
|
+
*/
|
|
272
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
273
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
274
|
+
const len0 = WASM_VECTOR_LEN;
|
|
275
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
276
|
+
if (ret[2]) {
|
|
277
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
278
|
+
}
|
|
279
|
+
return takeFromExternrefTable0(ret[0]);
|
|
280
|
+
}
|
|
281
|
+
|
|
215
282
|
/**
|
|
216
283
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
217
284
|
*
|
|
@@ -258,71 +325,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
|
258
325
|
return ret;
|
|
259
326
|
}
|
|
260
327
|
|
|
261
|
-
function takeFromExternrefTable0(idx) {
|
|
262
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
263
|
-
wasm.__externref_table_dealloc(idx);
|
|
264
|
-
return value;
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
268
|
-
*
|
|
269
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
270
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
271
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
272
|
-
* @param {Uint8Array} program
|
|
273
|
-
* @param {WitnessMap} witness_map
|
|
274
|
-
* @returns {WitnessMap}
|
|
275
|
-
*/
|
|
276
|
-
export function getReturnWitness(program, witness_map) {
|
|
277
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
278
|
-
const len0 = WASM_VECTOR_LEN;
|
|
279
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
280
|
-
if (ret[2]) {
|
|
281
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
282
|
-
}
|
|
283
|
-
return takeFromExternrefTable0(ret[0]);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
288
|
-
*
|
|
289
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
290
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
291
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
292
|
-
* @param {Uint8Array} program
|
|
293
|
-
* @param {WitnessMap} solved_witness
|
|
294
|
-
* @returns {WitnessMap}
|
|
295
|
-
*/
|
|
296
|
-
export function getPublicParametersWitness(program, solved_witness) {
|
|
297
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
298
|
-
const len0 = WASM_VECTOR_LEN;
|
|
299
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
300
|
-
if (ret[2]) {
|
|
301
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
302
|
-
}
|
|
303
|
-
return takeFromExternrefTable0(ret[0]);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
308
|
-
*
|
|
309
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
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}
|
|
315
|
-
*/
|
|
316
|
-
export function getPublicWitness(program, solved_witness) {
|
|
317
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
318
|
-
const len0 = WASM_VECTOR_LEN;
|
|
319
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
320
|
-
if (ret[2]) {
|
|
321
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
322
|
-
}
|
|
323
|
-
return takeFromExternrefTable0(ret[0]);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
328
|
/**
|
|
327
329
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
328
330
|
* @param {string} lhs
|
|
@@ -382,10 +384,6 @@ export function sha256_compression(inputs, state) {
|
|
|
382
384
|
return v3;
|
|
383
385
|
}
|
|
384
386
|
|
|
385
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
386
|
-
ptr = ptr >>> 0;
|
|
387
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
388
|
-
}
|
|
389
387
|
/**
|
|
390
388
|
* Calculates the Blake2s256 hash of the input bytes
|
|
391
389
|
* @param {Uint8Array} inputs
|
|
@@ -443,64 +441,62 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
443
441
|
}
|
|
444
442
|
|
|
445
443
|
/**
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
449
|
-
* @returns {Uint8Array} A compressed witness map
|
|
444
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
445
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
450
446
|
*/
|
|
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;
|
|
447
|
+
export function buildInfo() {
|
|
448
|
+
const ret = wasm.buildInfo();
|
|
449
|
+
return ret;
|
|
459
450
|
}
|
|
460
451
|
|
|
461
452
|
/**
|
|
462
|
-
*
|
|
463
|
-
* This should be used to only fetch the witness map for the main function.
|
|
453
|
+
* Sets the package's logging level.
|
|
464
454
|
*
|
|
465
|
-
* @param {
|
|
466
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
455
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
467
456
|
*/
|
|
468
|
-
export function
|
|
469
|
-
const ptr0 =
|
|
457
|
+
export function initLogLevel(filter) {
|
|
458
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
470
459
|
const len0 = WASM_VECTOR_LEN;
|
|
471
|
-
const ret = wasm.
|
|
472
|
-
if (ret[
|
|
473
|
-
throw takeFromExternrefTable0(ret[
|
|
460
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
461
|
+
if (ret[1]) {
|
|
462
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
474
463
|
}
|
|
475
|
-
return takeFromExternrefTable0(ret[0]);
|
|
476
464
|
}
|
|
477
465
|
|
|
478
466
|
/**
|
|
479
|
-
*
|
|
467
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
480
468
|
*
|
|
481
|
-
* @param {
|
|
482
|
-
* @
|
|
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}
|
|
483
475
|
*/
|
|
484
|
-
export function
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
476
|
+
export function getReturnWitness(program, witness_map) {
|
|
477
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
478
|
+
const len0 = WASM_VECTOR_LEN;
|
|
479
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
480
|
+
if (ret[2]) {
|
|
481
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
488
482
|
}
|
|
489
|
-
|
|
490
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
491
|
-
return v1;
|
|
483
|
+
return takeFromExternrefTable0(ret[0]);
|
|
492
484
|
}
|
|
493
485
|
|
|
494
486
|
/**
|
|
495
|
-
*
|
|
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,29 +504,35 @@ 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) {
|
|
525
|
-
wasm.
|
|
527
|
+
wasm.closure605_externref_shim(arg0, arg1, arg2);
|
|
526
528
|
}
|
|
527
529
|
|
|
528
530
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
529
|
-
wasm.
|
|
531
|
+
wasm.closure1249_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.closure1253_externref_shim(arg0, arg1, arg2, arg3);
|
|
534
536
|
}
|
|
535
537
|
|
|
536
538
|
async function __wbg_load(module, imports) {
|
|
@@ -796,8 +798,8 @@ function __wbg_get_imports() {
|
|
|
796
798
|
const ret = false;
|
|
797
799
|
return ret;
|
|
798
800
|
};
|
|
799
|
-
imports.wbg.
|
|
800
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
801
|
+
imports.wbg.__wbindgen_closure_wrapper2096 = function(arg0, arg1, arg2) {
|
|
802
|
+
const ret = makeMutClosure(arg0, arg1, 606, __wbg_adapter_30);
|
|
801
803
|
return ret;
|
|
802
804
|
};
|
|
803
805
|
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
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const
|
|
4
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
5
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
6
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
7
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
5
8
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
9
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
10
|
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
11
|
export const and: (a: any, b: any) => any;
|
|
12
12
|
export const xor: (a: any, b: any) => any;
|
|
13
13
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
14
14
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
15
15
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
16
16
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
17
|
-
export const
|
|
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];
|
|
17
|
+
export const buildInfo: () => any;
|
|
21
18
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
19
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure605_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure1249_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure1253_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|