@noir-lang/acvm_js 1.0.0-beta.3-37be49f.nightly → 1.0.0-beta.3-8e0e5ab.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 +76 -76
- package/nodejs/acvm_js.js +119 -119
- 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 +87 -87
- package/web/acvm_js.js +119 -119
- 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,5 +1,34 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
5
|
+
*
|
|
6
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
8
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
9
|
+
*/
|
|
10
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
11
|
+
/**
|
|
12
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
13
|
+
*
|
|
14
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
15
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
16
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
17
|
+
*/
|
|
18
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
19
|
+
/**
|
|
20
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
21
|
+
*
|
|
22
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
24
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
25
|
+
*/
|
|
26
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
29
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
30
|
+
*/
|
|
31
|
+
export function buildInfo(): BuildInfo;
|
|
3
32
|
/**
|
|
4
33
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
34
|
*
|
|
@@ -28,35 +57,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
28
57
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
29
58
|
*/
|
|
30
59
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
31
|
-
/**
|
|
32
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
33
|
-
*
|
|
34
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
35
|
-
* @returns {Uint8Array} A compressed witness map
|
|
36
|
-
*/
|
|
37
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
38
|
-
/**
|
|
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.
|
|
41
|
-
*
|
|
42
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
43
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
44
|
-
*/
|
|
45
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
46
|
-
/**
|
|
47
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
48
|
-
*
|
|
49
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
50
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
51
|
-
*/
|
|
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
60
|
/**
|
|
61
61
|
* Sets the package's logging level.
|
|
62
62
|
*
|
|
@@ -88,34 +88,48 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
88
88
|
*/
|
|
89
89
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
91
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
92
|
+
*
|
|
93
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
94
|
+
* @returns {Uint8Array} A compressed witness map
|
|
93
95
|
*/
|
|
94
|
-
export function
|
|
96
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
95
97
|
/**
|
|
96
|
-
*
|
|
98
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
99
|
+
* This should be used to only fetch the witness map for the main function.
|
|
97
100
|
*
|
|
98
|
-
* @param {Uint8Array}
|
|
99
|
-
* @
|
|
100
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
101
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
102
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
101
103
|
*/
|
|
102
|
-
export function
|
|
104
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
103
105
|
/**
|
|
104
|
-
*
|
|
106
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
105
107
|
*
|
|
106
|
-
* @param {
|
|
107
|
-
* @
|
|
108
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
108
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
109
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
109
110
|
*/
|
|
110
|
-
export function
|
|
111
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
111
112
|
/**
|
|
112
|
-
*
|
|
113
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
113
114
|
*
|
|
114
|
-
* @param {Uint8Array}
|
|
115
|
-
* @
|
|
116
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
115
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
116
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
118
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
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.
|
|
125
|
+
*/
|
|
126
|
+
export type BuildInfo = {
|
|
127
|
+
gitHash: string;
|
|
128
|
+
version: string;
|
|
129
|
+
dirty: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
export type RawAssertionPayload = {
|
|
121
135
|
selector: string;
|
|
@@ -130,6 +144,21 @@ export type ExecutionError = Error & {
|
|
|
130
144
|
|
|
131
145
|
|
|
132
146
|
|
|
147
|
+
// Map from witness index to hex string value of witness.
|
|
148
|
+
export type WitnessMap = Map<number, string>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* An execution result containing two witnesses.
|
|
152
|
+
* 1. The full solved witness of the execution.
|
|
153
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
154
|
+
*/
|
|
155
|
+
export type SolvedAndReturnWitness = {
|
|
156
|
+
solvedWitness: WitnessMap;
|
|
157
|
+
returnWitness: WitnessMap;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
133
162
|
export type StackItem = {
|
|
134
163
|
index: number;
|
|
135
164
|
witness: WitnessMap;
|
|
@@ -139,20 +168,6 @@ export type WitnessStack = Array<StackItem>;
|
|
|
139
168
|
|
|
140
169
|
|
|
141
170
|
|
|
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
171
|
export type ForeignCallInput = string[]
|
|
157
172
|
export type ForeignCallOutput = string | string[]
|
|
158
173
|
|
|
@@ -166,18 +181,3 @@ export type ForeignCallOutput = string | string[]
|
|
|
166
181
|
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
167
182
|
|
|
168
183
|
|
|
169
|
-
|
|
170
|
-
// Map from witness index to hex string value of witness.
|
|
171
|
-
export type WitnessMap = Map<number, string>;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* An execution result containing two witnesses.
|
|
175
|
-
* 1. The full solved witness of the execution.
|
|
176
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
177
|
-
*/
|
|
178
|
-
export type SolvedAndReturnWitness = {
|
|
179
|
-
solvedWitness: WitnessMap;
|
|
180
|
-
returnWitness: WitnessMap;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -208,6 +208,81 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
208
208
|
WASM_VECTOR_LEN = arg.length;
|
|
209
209
|
return ptr;
|
|
210
210
|
}
|
|
211
|
+
|
|
212
|
+
function takeFromExternrefTable0(idx) {
|
|
213
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
214
|
+
wasm.__externref_table_dealloc(idx);
|
|
215
|
+
return value;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
219
|
+
*
|
|
220
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
221
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
222
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
223
|
+
* @param {Uint8Array} program
|
|
224
|
+
* @param {WitnessMap} witness_map
|
|
225
|
+
* @returns {WitnessMap}
|
|
226
|
+
*/
|
|
227
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
228
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
230
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
231
|
+
if (ret[2]) {
|
|
232
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
233
|
+
}
|
|
234
|
+
return takeFromExternrefTable0(ret[0]);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
239
|
+
*
|
|
240
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
241
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
242
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
243
|
+
* @param {Uint8Array} program
|
|
244
|
+
* @param {WitnessMap} solved_witness
|
|
245
|
+
* @returns {WitnessMap}
|
|
246
|
+
*/
|
|
247
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
248
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
249
|
+
const len0 = WASM_VECTOR_LEN;
|
|
250
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
251
|
+
if (ret[2]) {
|
|
252
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
253
|
+
}
|
|
254
|
+
return takeFromExternrefTable0(ret[0]);
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
259
|
+
*
|
|
260
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
261
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
262
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
263
|
+
* @param {Uint8Array} program
|
|
264
|
+
* @param {WitnessMap} solved_witness
|
|
265
|
+
* @returns {WitnessMap}
|
|
266
|
+
*/
|
|
267
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
268
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
270
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
271
|
+
if (ret[2]) {
|
|
272
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
273
|
+
}
|
|
274
|
+
return takeFromExternrefTable0(ret[0]);
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
279
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
280
|
+
*/
|
|
281
|
+
module.exports.buildInfo = function() {
|
|
282
|
+
const ret = wasm.buildInfo();
|
|
283
|
+
return ret;
|
|
284
|
+
};
|
|
285
|
+
|
|
211
286
|
/**
|
|
212
287
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
213
288
|
*
|
|
@@ -254,81 +329,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
254
329
|
return ret;
|
|
255
330
|
};
|
|
256
331
|
|
|
257
|
-
function takeFromExternrefTable0(idx) {
|
|
258
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
259
|
-
wasm.__externref_table_dealloc(idx);
|
|
260
|
-
return value;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
264
|
-
ptr = ptr >>> 0;
|
|
265
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
269
|
-
*
|
|
270
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
271
|
-
* @returns {Uint8Array} A compressed witness map
|
|
272
|
-
*/
|
|
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);
|
|
292
|
-
const len0 = WASM_VECTOR_LEN;
|
|
293
|
-
const ret = wasm.decompressWitness(ptr0, len0);
|
|
294
|
-
if (ret[2]) {
|
|
295
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
296
|
-
}
|
|
297
|
-
return takeFromExternrefTable0(ret[0]);
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
302
|
-
*
|
|
303
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
304
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
305
|
-
*/
|
|
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);
|
|
324
|
-
const len0 = WASM_VECTOR_LEN;
|
|
325
|
-
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
326
|
-
if (ret[2]) {
|
|
327
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
328
|
-
}
|
|
329
|
-
return takeFromExternrefTable0(ret[0]);
|
|
330
|
-
};
|
|
331
|
-
|
|
332
332
|
/**
|
|
333
333
|
* Sets the package's logging level.
|
|
334
334
|
*
|
|
@@ -402,6 +402,10 @@ module.exports.sha256_compression = function(inputs, state) {
|
|
|
402
402
|
return v3;
|
|
403
403
|
};
|
|
404
404
|
|
|
405
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
406
|
+
ptr = ptr >>> 0;
|
|
407
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
408
|
+
}
|
|
405
409
|
/**
|
|
406
410
|
* Calculates the Blake2s256 hash of the input bytes
|
|
407
411
|
* @param {Uint8Array} inputs
|
|
@@ -459,28 +463,32 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
459
463
|
};
|
|
460
464
|
|
|
461
465
|
/**
|
|
462
|
-
*
|
|
463
|
-
*
|
|
466
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
467
|
+
*
|
|
468
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
469
|
+
* @returns {Uint8Array} A compressed witness map
|
|
464
470
|
*/
|
|
465
|
-
module.exports.
|
|
466
|
-
const ret = wasm.
|
|
467
|
-
|
|
471
|
+
module.exports.compressWitness = function(witness_map) {
|
|
472
|
+
const ret = wasm.compressWitness(witness_map);
|
|
473
|
+
if (ret[3]) {
|
|
474
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
475
|
+
}
|
|
476
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
477
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
478
|
+
return v1;
|
|
468
479
|
};
|
|
469
480
|
|
|
470
481
|
/**
|
|
471
|
-
*
|
|
482
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
483
|
+
* This should be used to only fetch the witness map for the main function.
|
|
472
484
|
*
|
|
473
|
-
* @param {Uint8Array}
|
|
474
|
-
* @
|
|
475
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
476
|
-
* @param {Uint8Array} program
|
|
477
|
-
* @param {WitnessMap} witness_map
|
|
478
|
-
* @returns {WitnessMap}
|
|
485
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
486
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
479
487
|
*/
|
|
480
|
-
module.exports.
|
|
481
|
-
const ptr0 = passArray8ToWasm0(
|
|
488
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
489
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
482
490
|
const len0 = WASM_VECTOR_LEN;
|
|
483
|
-
const ret = wasm.
|
|
491
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
484
492
|
if (ret[2]) {
|
|
485
493
|
throw takeFromExternrefTable0(ret[1]);
|
|
486
494
|
}
|
|
@@ -488,39 +496,31 @@ module.exports.getReturnWitness = function(program, witness_map) {
|
|
|
488
496
|
};
|
|
489
497
|
|
|
490
498
|
/**
|
|
491
|
-
*
|
|
499
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
492
500
|
*
|
|
493
|
-
* @param {
|
|
494
|
-
* @
|
|
495
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
496
|
-
* @param {Uint8Array} program
|
|
497
|
-
* @param {WitnessMap} solved_witness
|
|
498
|
-
* @returns {WitnessMap}
|
|
501
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
502
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
499
503
|
*/
|
|
500
|
-
module.exports.
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
if (ret[2]) {
|
|
505
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
504
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
505
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
506
|
+
if (ret[3]) {
|
|
507
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
506
508
|
}
|
|
507
|
-
|
|
509
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
510
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
511
|
+
return v1;
|
|
508
512
|
};
|
|
509
513
|
|
|
510
514
|
/**
|
|
511
|
-
*
|
|
515
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
512
516
|
*
|
|
513
|
-
* @param {Uint8Array}
|
|
514
|
-
* @
|
|
515
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
516
|
-
* @param {Uint8Array} program
|
|
517
|
-
* @param {WitnessMap} solved_witness
|
|
518
|
-
* @returns {WitnessMap}
|
|
517
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
518
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
519
519
|
*/
|
|
520
|
-
module.exports.
|
|
521
|
-
const ptr0 = passArray8ToWasm0(
|
|
520
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
521
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
522
522
|
const len0 = WASM_VECTOR_LEN;
|
|
523
|
-
const ret = wasm.
|
|
523
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
524
524
|
if (ret[2]) {
|
|
525
525
|
throw takeFromExternrefTable0(ret[1]);
|
|
526
526
|
}
|
|
@@ -528,15 +528,15 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
528
528
|
};
|
|
529
529
|
|
|
530
530
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
531
|
-
wasm.
|
|
531
|
+
wasm.closure249_externref_shim(arg0, arg1, arg2);
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
535
|
-
wasm.
|
|
535
|
+
wasm.closure810_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
536
536
|
}
|
|
537
537
|
|
|
538
538
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
539
|
-
wasm.
|
|
539
|
+
wasm.closure814_externref_shim(arg0, arg1, arg2, arg3);
|
|
540
540
|
}
|
|
541
541
|
|
|
542
542
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -814,8 +814,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
814
814
|
return ret;
|
|
815
815
|
};
|
|
816
816
|
|
|
817
|
-
module.exports.
|
|
818
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
817
|
+
module.exports.__wbindgen_closure_wrapper725 = function(arg0, arg1, arg2) {
|
|
818
|
+
const ret = makeMutClosure(arg0, arg1, 250, __wbg_adapter_30);
|
|
819
819
|
return ret;
|
|
820
820
|
};
|
|
821
821
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
5
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
6
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
7
|
+
export const buildInfo: () => any;
|
|
4
8
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
5
9
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
6
10
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
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
11
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
12
12
|
export const and: (a: any, b: any) => any;
|
|
13
13
|
export const xor: (a: any, b: any) => any;
|
|
@@ -15,10 +15,10 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
|
|
|
15
15
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
16
16
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
17
17
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
18
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
19
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
20
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
21
|
+
export const decompressWitnessStack: (a: number, b: number) => [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 closure249_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure810_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure814_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,5 +1,34 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
5
|
+
*
|
|
6
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
8
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
9
|
+
*/
|
|
10
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
11
|
+
/**
|
|
12
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
13
|
+
*
|
|
14
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
15
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
16
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
17
|
+
*/
|
|
18
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
19
|
+
/**
|
|
20
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
21
|
+
*
|
|
22
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
24
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
25
|
+
*/
|
|
26
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
29
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
30
|
+
*/
|
|
31
|
+
export function buildInfo(): BuildInfo;
|
|
3
32
|
/**
|
|
4
33
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
5
34
|
*
|
|
@@ -28,35 +57,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
28
57
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
29
58
|
*/
|
|
30
59
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
31
|
-
/**
|
|
32
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
33
|
-
*
|
|
34
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
35
|
-
* @returns {Uint8Array} A compressed witness map
|
|
36
|
-
*/
|
|
37
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
38
|
-
/**
|
|
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.
|
|
41
|
-
*
|
|
42
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
43
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
44
|
-
*/
|
|
45
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
46
|
-
/**
|
|
47
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
48
|
-
*
|
|
49
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
50
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
51
|
-
*/
|
|
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
60
|
/**
|
|
61
61
|
* Sets the package's logging level.
|
|
62
62
|
*
|
|
@@ -88,34 +88,48 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
88
88
|
*/
|
|
89
89
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
91
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
92
|
+
*
|
|
93
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
94
|
+
* @returns {Uint8Array} A compressed witness map
|
|
93
95
|
*/
|
|
94
|
-
export function
|
|
96
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
95
97
|
/**
|
|
96
|
-
*
|
|
98
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
99
|
+
* This should be used to only fetch the witness map for the main function.
|
|
97
100
|
*
|
|
98
|
-
* @param {Uint8Array}
|
|
99
|
-
* @
|
|
100
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
101
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
102
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
101
103
|
*/
|
|
102
|
-
export function
|
|
104
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
103
105
|
/**
|
|
104
|
-
*
|
|
106
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
105
107
|
*
|
|
106
|
-
* @param {
|
|
107
|
-
* @
|
|
108
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
108
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
109
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
109
110
|
*/
|
|
110
|
-
export function
|
|
111
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
111
112
|
/**
|
|
112
|
-
*
|
|
113
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
113
114
|
*
|
|
114
|
-
* @param {Uint8Array}
|
|
115
|
-
* @
|
|
116
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
115
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
116
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
118
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
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.
|
|
125
|
+
*/
|
|
126
|
+
export type BuildInfo = {
|
|
127
|
+
gitHash: string;
|
|
128
|
+
version: string;
|
|
129
|
+
dirty: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
export type RawAssertionPayload = {
|
|
121
135
|
selector: string;
|
|
@@ -130,6 +144,21 @@ export type ExecutionError = Error & {
|
|
|
130
144
|
|
|
131
145
|
|
|
132
146
|
|
|
147
|
+
// Map from witness index to hex string value of witness.
|
|
148
|
+
export type WitnessMap = Map<number, string>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* An execution result containing two witnesses.
|
|
152
|
+
* 1. The full solved witness of the execution.
|
|
153
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
154
|
+
*/
|
|
155
|
+
export type SolvedAndReturnWitness = {
|
|
156
|
+
solvedWitness: WitnessMap;
|
|
157
|
+
returnWitness: WitnessMap;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
133
162
|
export type StackItem = {
|
|
134
163
|
index: number;
|
|
135
164
|
witness: WitnessMap;
|
|
@@ -139,20 +168,6 @@ export type WitnessStack = Array<StackItem>;
|
|
|
139
168
|
|
|
140
169
|
|
|
141
170
|
|
|
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
171
|
export type ForeignCallInput = string[]
|
|
157
172
|
export type ForeignCallOutput = string | string[]
|
|
158
173
|
|
|
@@ -167,32 +182,17 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
167
182
|
|
|
168
183
|
|
|
169
184
|
|
|
170
|
-
// Map from witness index to hex string value of witness.
|
|
171
|
-
export type WitnessMap = Map<number, string>;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* An execution result containing two witnesses.
|
|
175
|
-
* 1. The full solved witness of the execution.
|
|
176
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
177
|
-
*/
|
|
178
|
-
export type SolvedAndReturnWitness = {
|
|
179
|
-
solvedWitness: WitnessMap;
|
|
180
|
-
returnWitness: WitnessMap;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
185
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
186
186
|
|
|
187
187
|
export interface InitOutput {
|
|
188
188
|
readonly memory: WebAssembly.Memory;
|
|
189
|
+
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
190
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
191
|
+
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
192
|
+
readonly buildInfo: () => any;
|
|
189
193
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
190
194
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
191
195
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
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
196
|
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
197
197
|
readonly and: (a: any, b: any) => any;
|
|
198
198
|
readonly xor: (a: any, b: any) => any;
|
|
@@ -200,10 +200,10 @@ export interface InitOutput {
|
|
|
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
|
|
205
|
-
readonly
|
|
206
|
-
readonly
|
|
203
|
+
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
204
|
+
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
205
|
+
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
206
|
+
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
207
207
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
208
208
|
readonly __externref_table_alloc: () => number;
|
|
209
209
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -212,9 +212,9 @@ export interface InitOutput {
|
|
|
212
212
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
213
213
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
214
214
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
215
|
-
readonly
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
215
|
+
readonly closure249_externref_shim: (a: number, b: number, c: any) => void;
|
|
216
|
+
readonly closure810_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
217
|
+
readonly closure814_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
|
@@ -204,6 +204,81 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
204
204
|
WASM_VECTOR_LEN = arg.length;
|
|
205
205
|
return ptr;
|
|
206
206
|
}
|
|
207
|
+
|
|
208
|
+
function takeFromExternrefTable0(idx) {
|
|
209
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
210
|
+
wasm.__externref_table_dealloc(idx);
|
|
211
|
+
return value;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
215
|
+
*
|
|
216
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
217
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
218
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
219
|
+
* @param {Uint8Array} program
|
|
220
|
+
* @param {WitnessMap} witness_map
|
|
221
|
+
* @returns {WitnessMap}
|
|
222
|
+
*/
|
|
223
|
+
export function getReturnWitness(program, witness_map) {
|
|
224
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
225
|
+
const len0 = WASM_VECTOR_LEN;
|
|
226
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
227
|
+
if (ret[2]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
229
|
+
}
|
|
230
|
+
return takeFromExternrefTable0(ret[0]);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
235
|
+
*
|
|
236
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
237
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
238
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
239
|
+
* @param {Uint8Array} program
|
|
240
|
+
* @param {WitnessMap} solved_witness
|
|
241
|
+
* @returns {WitnessMap}
|
|
242
|
+
*/
|
|
243
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
244
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
245
|
+
const len0 = WASM_VECTOR_LEN;
|
|
246
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
247
|
+
if (ret[2]) {
|
|
248
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
249
|
+
}
|
|
250
|
+
return takeFromExternrefTable0(ret[0]);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
255
|
+
*
|
|
256
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
257
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
258
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
259
|
+
* @param {Uint8Array} program
|
|
260
|
+
* @param {WitnessMap} solved_witness
|
|
261
|
+
* @returns {WitnessMap}
|
|
262
|
+
*/
|
|
263
|
+
export function getPublicWitness(program, solved_witness) {
|
|
264
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
265
|
+
const len0 = WASM_VECTOR_LEN;
|
|
266
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
267
|
+
if (ret[2]) {
|
|
268
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
269
|
+
}
|
|
270
|
+
return takeFromExternrefTable0(ret[0]);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
275
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
276
|
+
*/
|
|
277
|
+
export function buildInfo() {
|
|
278
|
+
const ret = wasm.buildInfo();
|
|
279
|
+
return ret;
|
|
280
|
+
}
|
|
281
|
+
|
|
207
282
|
/**
|
|
208
283
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
209
284
|
*
|
|
@@ -250,81 +325,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
|
250
325
|
return ret;
|
|
251
326
|
}
|
|
252
327
|
|
|
253
|
-
function takeFromExternrefTable0(idx) {
|
|
254
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
255
|
-
wasm.__externref_table_dealloc(idx);
|
|
256
|
-
return value;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
260
|
-
ptr = ptr >>> 0;
|
|
261
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
265
|
-
*
|
|
266
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
267
|
-
* @returns {Uint8Array} A compressed witness map
|
|
268
|
-
*/
|
|
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);
|
|
288
|
-
const len0 = WASM_VECTOR_LEN;
|
|
289
|
-
const ret = wasm.decompressWitness(ptr0, len0);
|
|
290
|
-
if (ret[2]) {
|
|
291
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
292
|
-
}
|
|
293
|
-
return takeFromExternrefTable0(ret[0]);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
298
|
-
*
|
|
299
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
300
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
301
|
-
*/
|
|
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);
|
|
320
|
-
const len0 = WASM_VECTOR_LEN;
|
|
321
|
-
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
322
|
-
if (ret[2]) {
|
|
323
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
324
|
-
}
|
|
325
|
-
return takeFromExternrefTable0(ret[0]);
|
|
326
|
-
}
|
|
327
|
-
|
|
328
328
|
/**
|
|
329
329
|
* Sets the package's logging level.
|
|
330
330
|
*
|
|
@@ -398,6 +398,10 @@ export function sha256_compression(inputs, state) {
|
|
|
398
398
|
return v3;
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
402
|
+
ptr = ptr >>> 0;
|
|
403
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
404
|
+
}
|
|
401
405
|
/**
|
|
402
406
|
* Calculates the Blake2s256 hash of the input bytes
|
|
403
407
|
* @param {Uint8Array} inputs
|
|
@@ -455,28 +459,32 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
455
459
|
}
|
|
456
460
|
|
|
457
461
|
/**
|
|
458
|
-
*
|
|
459
|
-
*
|
|
462
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
463
|
+
*
|
|
464
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
465
|
+
* @returns {Uint8Array} A compressed witness map
|
|
460
466
|
*/
|
|
461
|
-
export function
|
|
462
|
-
const ret = wasm.
|
|
463
|
-
|
|
467
|
+
export function compressWitness(witness_map) {
|
|
468
|
+
const ret = wasm.compressWitness(witness_map);
|
|
469
|
+
if (ret[3]) {
|
|
470
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
471
|
+
}
|
|
472
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
473
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
474
|
+
return v1;
|
|
464
475
|
}
|
|
465
476
|
|
|
466
477
|
/**
|
|
467
|
-
*
|
|
478
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
479
|
+
* This should be used to only fetch the witness map for the main function.
|
|
468
480
|
*
|
|
469
|
-
* @param {Uint8Array}
|
|
470
|
-
* @
|
|
471
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
472
|
-
* @param {Uint8Array} program
|
|
473
|
-
* @param {WitnessMap} witness_map
|
|
474
|
-
* @returns {WitnessMap}
|
|
481
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
482
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
475
483
|
*/
|
|
476
|
-
export function
|
|
477
|
-
const ptr0 = passArray8ToWasm0(
|
|
484
|
+
export function decompressWitness(compressed_witness) {
|
|
485
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
478
486
|
const len0 = WASM_VECTOR_LEN;
|
|
479
|
-
const ret = wasm.
|
|
487
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
480
488
|
if (ret[2]) {
|
|
481
489
|
throw takeFromExternrefTable0(ret[1]);
|
|
482
490
|
}
|
|
@@ -484,39 +492,31 @@ export function getReturnWitness(program, witness_map) {
|
|
|
484
492
|
}
|
|
485
493
|
|
|
486
494
|
/**
|
|
487
|
-
*
|
|
495
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
488
496
|
*
|
|
489
|
-
* @param {
|
|
490
|
-
* @
|
|
491
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
492
|
-
* @param {Uint8Array} program
|
|
493
|
-
* @param {WitnessMap} solved_witness
|
|
494
|
-
* @returns {WitnessMap}
|
|
497
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
498
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
495
499
|
*/
|
|
496
|
-
export function
|
|
497
|
-
const
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
if (ret[2]) {
|
|
501
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
500
|
+
export function compressWitnessStack(witness_stack) {
|
|
501
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
502
|
+
if (ret[3]) {
|
|
503
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
502
504
|
}
|
|
503
|
-
|
|
505
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
506
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
507
|
+
return v1;
|
|
504
508
|
}
|
|
505
509
|
|
|
506
510
|
/**
|
|
507
|
-
*
|
|
511
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
508
512
|
*
|
|
509
|
-
* @param {Uint8Array}
|
|
510
|
-
* @
|
|
511
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
512
|
-
* @param {Uint8Array} program
|
|
513
|
-
* @param {WitnessMap} solved_witness
|
|
514
|
-
* @returns {WitnessMap}
|
|
513
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
514
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
515
515
|
*/
|
|
516
|
-
export function
|
|
517
|
-
const ptr0 = passArray8ToWasm0(
|
|
516
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
517
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
518
518
|
const len0 = WASM_VECTOR_LEN;
|
|
519
|
-
const ret = wasm.
|
|
519
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
520
520
|
if (ret[2]) {
|
|
521
521
|
throw takeFromExternrefTable0(ret[1]);
|
|
522
522
|
}
|
|
@@ -524,15 +524,15 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
524
524
|
}
|
|
525
525
|
|
|
526
526
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
527
|
-
wasm.
|
|
527
|
+
wasm.closure249_externref_shim(arg0, arg1, arg2);
|
|
528
528
|
}
|
|
529
529
|
|
|
530
530
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
531
|
-
wasm.
|
|
531
|
+
wasm.closure810_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
532
532
|
}
|
|
533
533
|
|
|
534
534
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
535
|
-
wasm.
|
|
535
|
+
wasm.closure814_externref_shim(arg0, arg1, arg2, arg3);
|
|
536
536
|
}
|
|
537
537
|
|
|
538
538
|
async function __wbg_load(module, imports) {
|
|
@@ -798,8 +798,8 @@ function __wbg_get_imports() {
|
|
|
798
798
|
const ret = false;
|
|
799
799
|
return ret;
|
|
800
800
|
};
|
|
801
|
-
imports.wbg.
|
|
802
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
801
|
+
imports.wbg.__wbindgen_closure_wrapper725 = function(arg0, arg1, arg2) {
|
|
802
|
+
const ret = makeMutClosure(arg0, arg1, 250, __wbg_adapter_30);
|
|
803
803
|
return ret;
|
|
804
804
|
};
|
|
805
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,13 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
5
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
6
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
7
|
+
export const buildInfo: () => any;
|
|
4
8
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
5
9
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
6
10
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
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
11
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
12
12
|
export const and: (a: any, b: any) => any;
|
|
13
13
|
export const xor: (a: any, b: any) => any;
|
|
@@ -15,10 +15,10 @@ export const sha256_compression: (a: number, b: number, c: number, d: number) =>
|
|
|
15
15
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
16
16
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
17
17
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
18
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
19
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
20
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
21
|
+
export const decompressWitnessStack: (a: number, b: number) => [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 closure249_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure810_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure814_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|