@noir-lang/acvm_js 0.46.0-ff7bb72.nightly → 0.47.0-55d8e05.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 +62 -62
- package/nodejs/acvm_js.js +156 -156
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +7 -7
- package/package.json +1 -1
- package/web/acvm_js.d.ts +69 -69
- package/web/acvm_js.js +153 -153
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +7 -7
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
7
|
-
* @returns {Uint8Array} A compressed witness map
|
|
8
|
-
*/
|
|
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.
|
|
4
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
13
5
|
*
|
|
14
|
-
* @param {Uint8Array}
|
|
15
|
-
* @
|
|
6
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
16
10
|
*/
|
|
17
|
-
export function
|
|
11
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
18
12
|
/**
|
|
19
|
-
*
|
|
13
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
20
15
|
*
|
|
21
|
-
* @param {
|
|
22
|
-
* @
|
|
16
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
23
20
|
*/
|
|
24
|
-
export function
|
|
21
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
23
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
27
24
|
*
|
|
28
|
-
* @param {Uint8Array}
|
|
29
|
-
* @
|
|
25
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
26
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
30
29
|
*/
|
|
31
|
-
export function
|
|
30
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
32
31
|
/**
|
|
33
32
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
34
33
|
*
|
|
@@ -63,34 +62,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
63
62
|
*/
|
|
64
63
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
65
64
|
/**
|
|
66
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
67
|
-
*
|
|
68
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
69
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
70
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
71
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
72
|
-
*/
|
|
73
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
74
|
-
/**
|
|
75
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
76
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
77
|
-
*
|
|
78
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
79
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
80
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
81
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
82
|
-
*/
|
|
83
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
84
|
-
/**
|
|
85
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
86
|
-
*
|
|
87
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
88
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
89
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
90
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
91
|
-
*/
|
|
92
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
93
|
-
/**
|
|
94
65
|
* Sets the package's logging level.
|
|
95
66
|
*
|
|
96
67
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
@@ -151,6 +122,35 @@ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
151
122
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
152
123
|
*/
|
|
153
124
|
export function buildInfo(): BuildInfo;
|
|
125
|
+
/**
|
|
126
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
127
|
+
*
|
|
128
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
129
|
+
* @returns {Uint8Array} A compressed witness map
|
|
130
|
+
*/
|
|
131
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
132
|
+
/**
|
|
133
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
134
|
+
* This should be used to only fetch the witness map for the main function.
|
|
135
|
+
*
|
|
136
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
137
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
138
|
+
*/
|
|
139
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
140
|
+
/**
|
|
141
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
142
|
+
*
|
|
143
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
144
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
145
|
+
*/
|
|
146
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
147
|
+
/**
|
|
148
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
149
|
+
*
|
|
150
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
151
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
152
|
+
*/
|
|
153
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
154
154
|
|
|
155
155
|
export type RawAssertionPayload = {
|
|
156
156
|
selector: string;
|
|
@@ -163,20 +163,6 @@ export type ExecutionError = Error & {
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
export type ForeignCallInput = string[]
|
|
167
|
-
export type ForeignCallOutput = string | string[]
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* A callback which performs an foreign call and returns the response.
|
|
171
|
-
* @callback ForeignCallHandler
|
|
172
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
173
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
174
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
175
|
-
*/
|
|
176
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
166
|
// Map from witness index to hex string value of witness.
|
|
181
167
|
export type WitnessMap = Map<number, string>;
|
|
182
168
|
|
|
@@ -201,6 +187,20 @@ export type WitnessStack = Array<StackItem>;
|
|
|
201
187
|
|
|
202
188
|
|
|
203
189
|
|
|
190
|
+
export type ForeignCallInput = string[]
|
|
191
|
+
export type ForeignCallOutput = string | string[]
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* A callback which performs an foreign call and returns the response.
|
|
195
|
+
* @callback ForeignCallHandler
|
|
196
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
197
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
198
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
199
|
+
*/
|
|
200
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
204
|
/**
|
|
205
205
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
206
206
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -220,35 +220,6 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
220
220
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
224
|
-
ptr = ptr >>> 0;
|
|
225
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
229
|
-
*
|
|
230
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
231
|
-
* @returns {Uint8Array} A compressed witness map
|
|
232
|
-
*/
|
|
233
|
-
module.exports.compressWitness = function(witness_map) {
|
|
234
|
-
try {
|
|
235
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
236
|
-
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
237
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
238
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
239
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
240
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
241
|
-
if (r3) {
|
|
242
|
-
throw takeObject(r2);
|
|
243
|
-
}
|
|
244
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
245
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
246
|
-
return v1;
|
|
247
|
-
} finally {
|
|
248
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
|
|
252
223
|
function passArray8ToWasm0(arg, malloc) {
|
|
253
224
|
const ptr = malloc(arg.length * 1) >>> 0;
|
|
254
225
|
getUint8Memory0().set(arg, ptr / 1);
|
|
@@ -256,77 +227,49 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
256
227
|
return ptr;
|
|
257
228
|
}
|
|
258
229
|
/**
|
|
259
|
-
*
|
|
260
|
-
* This should be used to only fetch the witness map for the main function.
|
|
230
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
261
231
|
*
|
|
262
|
-
* @param {Uint8Array}
|
|
263
|
-
* @
|
|
232
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
233
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
234
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
235
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
264
236
|
*/
|
|
265
|
-
module.exports.
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
wasm.decompressWitness(retptr, ptr0, len0);
|
|
271
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
272
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
273
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
274
|
-
if (r2) {
|
|
275
|
-
throw takeObject(r1);
|
|
276
|
-
}
|
|
277
|
-
return takeObject(r0);
|
|
278
|
-
} finally {
|
|
279
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
280
|
-
}
|
|
237
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
238
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
239
|
+
const len0 = WASM_VECTOR_LEN;
|
|
240
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
241
|
+
return takeObject(ret);
|
|
281
242
|
};
|
|
282
243
|
|
|
283
244
|
/**
|
|
284
|
-
*
|
|
245
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
246
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
285
247
|
*
|
|
286
|
-
* @param {
|
|
287
|
-
* @
|
|
248
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
249
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
250
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
251
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
288
252
|
*/
|
|
289
|
-
module.exports.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
295
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
296
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
297
|
-
if (r3) {
|
|
298
|
-
throw takeObject(r2);
|
|
299
|
-
}
|
|
300
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
301
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
302
|
-
return v1;
|
|
303
|
-
} finally {
|
|
304
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
305
|
-
}
|
|
253
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
254
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
255
|
+
const len0 = WASM_VECTOR_LEN;
|
|
256
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
257
|
+
return takeObject(ret);
|
|
306
258
|
};
|
|
307
259
|
|
|
308
260
|
/**
|
|
309
|
-
*
|
|
261
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
310
262
|
*
|
|
311
|
-
* @param {Uint8Array}
|
|
312
|
-
* @
|
|
263
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
264
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
265
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
266
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
313
267
|
*/
|
|
314
|
-
module.exports.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
320
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
321
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
322
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
323
|
-
if (r2) {
|
|
324
|
-
throw takeObject(r1);
|
|
325
|
-
}
|
|
326
|
-
return takeObject(r0);
|
|
327
|
-
} finally {
|
|
328
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
329
|
-
}
|
|
268
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
269
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
270
|
+
const len0 = WASM_VECTOR_LEN;
|
|
271
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
272
|
+
return takeObject(ret);
|
|
330
273
|
};
|
|
331
274
|
|
|
332
275
|
/**
|
|
@@ -413,52 +356,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
413
356
|
}
|
|
414
357
|
};
|
|
415
358
|
|
|
416
|
-
/**
|
|
417
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
418
|
-
*
|
|
419
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
420
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
421
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
422
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
423
|
-
*/
|
|
424
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
425
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
426
|
-
const len0 = WASM_VECTOR_LEN;
|
|
427
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
428
|
-
return takeObject(ret);
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
/**
|
|
432
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
433
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
434
|
-
*
|
|
435
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
436
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
437
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
438
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
439
|
-
*/
|
|
440
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
441
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
442
|
-
const len0 = WASM_VECTOR_LEN;
|
|
443
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
444
|
-
return takeObject(ret);
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
449
|
-
*
|
|
450
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
451
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
452
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
453
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
454
|
-
*/
|
|
455
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
456
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
457
|
-
const len0 = WASM_VECTOR_LEN;
|
|
458
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
459
|
-
return takeObject(ret);
|
|
460
|
-
};
|
|
461
|
-
|
|
462
359
|
/**
|
|
463
360
|
* Sets the package's logging level.
|
|
464
361
|
*
|
|
@@ -502,6 +399,10 @@ module.exports.xor = function(lhs, rhs) {
|
|
|
502
399
|
return takeObject(ret);
|
|
503
400
|
};
|
|
504
401
|
|
|
402
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
403
|
+
ptr = ptr >>> 0;
|
|
404
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
405
|
+
}
|
|
505
406
|
/**
|
|
506
407
|
* Calculates the SHA256 hash of the input bytes
|
|
507
408
|
* @param {Uint8Array} inputs
|
|
@@ -616,6 +517,105 @@ module.exports.buildInfo = function() {
|
|
|
616
517
|
return takeObject(ret);
|
|
617
518
|
};
|
|
618
519
|
|
|
520
|
+
/**
|
|
521
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
522
|
+
*
|
|
523
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
524
|
+
* @returns {Uint8Array} A compressed witness map
|
|
525
|
+
*/
|
|
526
|
+
module.exports.compressWitness = function(witness_map) {
|
|
527
|
+
try {
|
|
528
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
529
|
+
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
530
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
531
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
532
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
533
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
534
|
+
if (r3) {
|
|
535
|
+
throw takeObject(r2);
|
|
536
|
+
}
|
|
537
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
538
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
539
|
+
return v1;
|
|
540
|
+
} finally {
|
|
541
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
547
|
+
* This should be used to only fetch the witness map for the main function.
|
|
548
|
+
*
|
|
549
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
550
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
551
|
+
*/
|
|
552
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
553
|
+
try {
|
|
554
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
555
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
556
|
+
const len0 = WASM_VECTOR_LEN;
|
|
557
|
+
wasm.decompressWitness(retptr, ptr0, len0);
|
|
558
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
559
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
560
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
561
|
+
if (r2) {
|
|
562
|
+
throw takeObject(r1);
|
|
563
|
+
}
|
|
564
|
+
return takeObject(r0);
|
|
565
|
+
} finally {
|
|
566
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
572
|
+
*
|
|
573
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
574
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
575
|
+
*/
|
|
576
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
577
|
+
try {
|
|
578
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
579
|
+
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
580
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
581
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
582
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
583
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
584
|
+
if (r3) {
|
|
585
|
+
throw takeObject(r2);
|
|
586
|
+
}
|
|
587
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
588
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
589
|
+
return v1;
|
|
590
|
+
} finally {
|
|
591
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
597
|
+
*
|
|
598
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
599
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
600
|
+
*/
|
|
601
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
602
|
+
try {
|
|
603
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
604
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
605
|
+
const len0 = WASM_VECTOR_LEN;
|
|
606
|
+
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
607
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
608
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
609
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
610
|
+
if (r2) {
|
|
611
|
+
throw takeObject(r1);
|
|
612
|
+
}
|
|
613
|
+
return takeObject(r0);
|
|
614
|
+
} finally {
|
|
615
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
|
|
619
619
|
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
|
|
620
620
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
621
621
|
}
|
|
@@ -635,32 +635,22 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
635
635
|
takeObject(arg0);
|
|
636
636
|
};
|
|
637
637
|
|
|
638
|
-
module.exports.__wbg_constructor_81b34c49dcbdd2af = function(arg0) {
|
|
639
|
-
const ret = new Error(takeObject(arg0));
|
|
640
|
-
return addHeapObject(ret);
|
|
641
|
-
};
|
|
642
|
-
|
|
643
638
|
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
644
639
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
645
640
|
return addHeapObject(ret);
|
|
646
641
|
};
|
|
647
642
|
|
|
648
|
-
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
649
|
-
const obj = takeObject(arg0).original;
|
|
650
|
-
if (obj.cnt-- == 1) {
|
|
651
|
-
obj.a = 0;
|
|
652
|
-
return true;
|
|
653
|
-
}
|
|
654
|
-
const ret = false;
|
|
655
|
-
return ret;
|
|
656
|
-
};
|
|
657
|
-
|
|
658
643
|
module.exports.__wbindgen_is_array = function(arg0) {
|
|
659
644
|
const ret = Array.isArray(getObject(arg0));
|
|
660
645
|
return ret;
|
|
661
646
|
};
|
|
662
647
|
|
|
663
|
-
module.exports.
|
|
648
|
+
module.exports.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
649
|
+
const ret = new Error(takeObject(arg0));
|
|
650
|
+
return addHeapObject(ret);
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
module.exports.__wbg_new_193bac1dd2be232d = function() {
|
|
664
654
|
const ret = new Map();
|
|
665
655
|
return addHeapObject(ret);
|
|
666
656
|
};
|
|
@@ -686,16 +676,26 @@ module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
|
686
676
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
687
677
|
};
|
|
688
678
|
|
|
689
|
-
module.exports.__wbg_new_ee5ac63ff3b0fa4d = function() {
|
|
690
|
-
const ret = new Array();
|
|
691
|
-
return addHeapObject(ret);
|
|
692
|
-
};
|
|
693
|
-
|
|
694
679
|
module.exports.__wbindgen_is_string = function(arg0) {
|
|
695
680
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
696
681
|
return ret;
|
|
697
682
|
};
|
|
698
683
|
|
|
684
|
+
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
685
|
+
const obj = takeObject(arg0).original;
|
|
686
|
+
if (obj.cnt-- == 1) {
|
|
687
|
+
obj.a = 0;
|
|
688
|
+
return true;
|
|
689
|
+
}
|
|
690
|
+
const ret = false;
|
|
691
|
+
return ret;
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
module.exports.__wbg_new_f139361aad331bd0 = function() {
|
|
695
|
+
const ret = new Array();
|
|
696
|
+
return addHeapObject(ret);
|
|
697
|
+
};
|
|
698
|
+
|
|
699
699
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
700
700
|
const ret = new Error();
|
|
701
701
|
return addHeapObject(ret);
|
|
@@ -915,7 +915,7 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
915
915
|
};
|
|
916
916
|
|
|
917
917
|
module.exports.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
|
|
918
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
918
|
+
const ret = makeMutClosure(arg0, arg1, 237, __wbg_adapter_22);
|
|
919
919
|
return addHeapObject(ret);
|
|
920
920
|
};
|
|
921
921
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function compressWitness(a: number, b: number): void;
|
|
5
|
-
export function decompressWitness(a: number, b: number, c: number): void;
|
|
6
|
-
export function compressWitnessStack(a: number, b: number): void;
|
|
7
|
-
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
8
|
-
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
9
|
-
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
|
-
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
11
4
|
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
12
5
|
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
13
6
|
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
7
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
8
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
9
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
14
10
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
15
11
|
export function and(a: number, b: number): number;
|
|
16
12
|
export function xor(a: number, b: number): number;
|
|
@@ -20,6 +16,10 @@ export function keccak256(a: number, b: number, c: number): void;
|
|
|
20
16
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
21
17
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
22
18
|
export function buildInfo(): number;
|
|
19
|
+
export function compressWitness(a: number, b: number): void;
|
|
20
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
21
|
+
export function compressWitnessStack(a: number, b: number): void;
|
|
22
|
+
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
23
23
|
export function __wbindgen_malloc(a: number): number;
|
|
24
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,34 +1,33 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
7
|
-
* @returns {Uint8Array} A compressed witness map
|
|
8
|
-
*/
|
|
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.
|
|
4
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
13
5
|
*
|
|
14
|
-
* @param {Uint8Array}
|
|
15
|
-
* @
|
|
6
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
16
10
|
*/
|
|
17
|
-
export function
|
|
11
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
18
12
|
/**
|
|
19
|
-
*
|
|
13
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
20
15
|
*
|
|
21
|
-
* @param {
|
|
22
|
-
* @
|
|
16
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
23
20
|
*/
|
|
24
|
-
export function
|
|
21
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
23
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
27
24
|
*
|
|
28
|
-
* @param {Uint8Array}
|
|
29
|
-
* @
|
|
25
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
26
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
30
29
|
*/
|
|
31
|
-
export function
|
|
30
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
32
31
|
/**
|
|
33
32
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
34
33
|
*
|
|
@@ -63,34 +62,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
63
62
|
*/
|
|
64
63
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
65
64
|
/**
|
|
66
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
67
|
-
*
|
|
68
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
69
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
70
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
71
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
72
|
-
*/
|
|
73
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
74
|
-
/**
|
|
75
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
76
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
77
|
-
*
|
|
78
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
79
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
80
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
81
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
82
|
-
*/
|
|
83
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
84
|
-
/**
|
|
85
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
86
|
-
*
|
|
87
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
88
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
89
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
90
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
91
|
-
*/
|
|
92
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
93
|
-
/**
|
|
94
65
|
* Sets the package's logging level.
|
|
95
66
|
*
|
|
96
67
|
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
@@ -151,6 +122,35 @@ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
151
122
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
152
123
|
*/
|
|
153
124
|
export function buildInfo(): BuildInfo;
|
|
125
|
+
/**
|
|
126
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
127
|
+
*
|
|
128
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
129
|
+
* @returns {Uint8Array} A compressed witness map
|
|
130
|
+
*/
|
|
131
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
132
|
+
/**
|
|
133
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
134
|
+
* This should be used to only fetch the witness map for the main function.
|
|
135
|
+
*
|
|
136
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
137
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
138
|
+
*/
|
|
139
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
140
|
+
/**
|
|
141
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
142
|
+
*
|
|
143
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
144
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
145
|
+
*/
|
|
146
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
147
|
+
/**
|
|
148
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
149
|
+
*
|
|
150
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
151
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
152
|
+
*/
|
|
153
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
154
154
|
|
|
155
155
|
export type RawAssertionPayload = {
|
|
156
156
|
selector: string;
|
|
@@ -163,20 +163,6 @@ export type ExecutionError = Error & {
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
export type ForeignCallInput = string[]
|
|
167
|
-
export type ForeignCallOutput = string | string[]
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* A callback which performs an foreign call and returns the response.
|
|
171
|
-
* @callback ForeignCallHandler
|
|
172
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
173
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
174
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
175
|
-
*/
|
|
176
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
166
|
// Map from witness index to hex string value of witness.
|
|
181
167
|
export type WitnessMap = Map<number, string>;
|
|
182
168
|
|
|
@@ -201,6 +187,20 @@ export type WitnessStack = Array<StackItem>;
|
|
|
201
187
|
|
|
202
188
|
|
|
203
189
|
|
|
190
|
+
export type ForeignCallInput = string[]
|
|
191
|
+
export type ForeignCallOutput = string | string[]
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* A callback which performs an foreign call and returns the response.
|
|
195
|
+
* @callback ForeignCallHandler
|
|
196
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
197
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
198
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
199
|
+
*/
|
|
200
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
204
|
/**
|
|
205
205
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
206
206
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
@@ -219,16 +219,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
219
219
|
|
|
220
220
|
export interface InitOutput {
|
|
221
221
|
readonly memory: WebAssembly.Memory;
|
|
222
|
-
readonly compressWitness: (a: number, b: number) => void;
|
|
223
|
-
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
224
|
-
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
225
|
-
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
226
|
-
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
227
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
228
|
-
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
229
222
|
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
230
223
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
231
224
|
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
225
|
+
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
226
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
227
|
+
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
232
228
|
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
233
229
|
readonly and: (a: number, b: number) => number;
|
|
234
230
|
readonly xor: (a: number, b: number) => number;
|
|
@@ -238,6 +234,10 @@ export interface InitOutput {
|
|
|
238
234
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
239
235
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
240
236
|
readonly buildInfo: () => number;
|
|
237
|
+
readonly compressWitness: (a: number, b: number) => void;
|
|
238
|
+
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
239
|
+
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
240
|
+
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
241
241
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
242
242
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
243
243
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
package/web/acvm_js.js
CHANGED
|
@@ -217,35 +217,6 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
217
217
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
221
|
-
ptr = ptr >>> 0;
|
|
222
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
226
|
-
*
|
|
227
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
228
|
-
* @returns {Uint8Array} A compressed witness map
|
|
229
|
-
*/
|
|
230
|
-
export function compressWitness(witness_map) {
|
|
231
|
-
try {
|
|
232
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
233
|
-
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
234
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
235
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
236
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
237
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
238
|
-
if (r3) {
|
|
239
|
-
throw takeObject(r2);
|
|
240
|
-
}
|
|
241
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
242
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
243
|
-
return v1;
|
|
244
|
-
} finally {
|
|
245
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
220
|
function passArray8ToWasm0(arg, malloc) {
|
|
250
221
|
const ptr = malloc(arg.length * 1) >>> 0;
|
|
251
222
|
getUint8Memory0().set(arg, ptr / 1);
|
|
@@ -253,77 +224,49 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
253
224
|
return ptr;
|
|
254
225
|
}
|
|
255
226
|
/**
|
|
256
|
-
*
|
|
257
|
-
* This should be used to only fetch the witness map for the main function.
|
|
227
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
258
228
|
*
|
|
259
|
-
* @param {Uint8Array}
|
|
260
|
-
* @
|
|
229
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
230
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
231
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
232
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
261
233
|
*/
|
|
262
|
-
export function
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
wasm.decompressWitness(retptr, ptr0, len0);
|
|
268
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
269
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
270
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
271
|
-
if (r2) {
|
|
272
|
-
throw takeObject(r1);
|
|
273
|
-
}
|
|
274
|
-
return takeObject(r0);
|
|
275
|
-
} finally {
|
|
276
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
277
|
-
}
|
|
234
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
235
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
236
|
+
const len0 = WASM_VECTOR_LEN;
|
|
237
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
238
|
+
return takeObject(ret);
|
|
278
239
|
}
|
|
279
240
|
|
|
280
241
|
/**
|
|
281
|
-
*
|
|
242
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
243
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
282
244
|
*
|
|
283
|
-
* @param {
|
|
284
|
-
* @
|
|
245
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
246
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
247
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
248
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
285
249
|
*/
|
|
286
|
-
export function
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
292
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
293
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
294
|
-
if (r3) {
|
|
295
|
-
throw takeObject(r2);
|
|
296
|
-
}
|
|
297
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
298
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
299
|
-
return v1;
|
|
300
|
-
} finally {
|
|
301
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
302
|
-
}
|
|
250
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
251
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
253
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
254
|
+
return takeObject(ret);
|
|
303
255
|
}
|
|
304
256
|
|
|
305
257
|
/**
|
|
306
|
-
*
|
|
258
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
307
259
|
*
|
|
308
|
-
* @param {Uint8Array}
|
|
309
|
-
* @
|
|
260
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
261
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
262
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
263
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
310
264
|
*/
|
|
311
|
-
export function
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
317
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
318
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
319
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
320
|
-
if (r2) {
|
|
321
|
-
throw takeObject(r1);
|
|
322
|
-
}
|
|
323
|
-
return takeObject(r0);
|
|
324
|
-
} finally {
|
|
325
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
326
|
-
}
|
|
265
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
266
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
267
|
+
const len0 = WASM_VECTOR_LEN;
|
|
268
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
269
|
+
return takeObject(ret);
|
|
327
270
|
}
|
|
328
271
|
|
|
329
272
|
/**
|
|
@@ -410,52 +353,6 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
410
353
|
}
|
|
411
354
|
}
|
|
412
355
|
|
|
413
|
-
/**
|
|
414
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
415
|
-
*
|
|
416
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
417
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
418
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
419
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
420
|
-
*/
|
|
421
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
422
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
423
|
-
const len0 = WASM_VECTOR_LEN;
|
|
424
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
425
|
-
return takeObject(ret);
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
430
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
431
|
-
*
|
|
432
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
433
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
434
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
435
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
436
|
-
*/
|
|
437
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
438
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
439
|
-
const len0 = WASM_VECTOR_LEN;
|
|
440
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
441
|
-
return takeObject(ret);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
/**
|
|
445
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
446
|
-
*
|
|
447
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
448
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
449
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
450
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
451
|
-
*/
|
|
452
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
453
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
454
|
-
const len0 = WASM_VECTOR_LEN;
|
|
455
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
456
|
-
return takeObject(ret);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
356
|
/**
|
|
460
357
|
* Sets the package's logging level.
|
|
461
358
|
*
|
|
@@ -499,6 +396,10 @@ export function xor(lhs, rhs) {
|
|
|
499
396
|
return takeObject(ret);
|
|
500
397
|
}
|
|
501
398
|
|
|
399
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
400
|
+
ptr = ptr >>> 0;
|
|
401
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
402
|
+
}
|
|
502
403
|
/**
|
|
503
404
|
* Calculates the SHA256 hash of the input bytes
|
|
504
405
|
* @param {Uint8Array} inputs
|
|
@@ -613,6 +514,105 @@ export function buildInfo() {
|
|
|
613
514
|
return takeObject(ret);
|
|
614
515
|
}
|
|
615
516
|
|
|
517
|
+
/**
|
|
518
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
519
|
+
*
|
|
520
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
521
|
+
* @returns {Uint8Array} A compressed witness map
|
|
522
|
+
*/
|
|
523
|
+
export function compressWitness(witness_map) {
|
|
524
|
+
try {
|
|
525
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
526
|
+
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
527
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
528
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
529
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
530
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
531
|
+
if (r3) {
|
|
532
|
+
throw takeObject(r2);
|
|
533
|
+
}
|
|
534
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
535
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
536
|
+
return v1;
|
|
537
|
+
} finally {
|
|
538
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
544
|
+
* This should be used to only fetch the witness map for the main function.
|
|
545
|
+
*
|
|
546
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
547
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
548
|
+
*/
|
|
549
|
+
export function decompressWitness(compressed_witness) {
|
|
550
|
+
try {
|
|
551
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
552
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
553
|
+
const len0 = WASM_VECTOR_LEN;
|
|
554
|
+
wasm.decompressWitness(retptr, ptr0, len0);
|
|
555
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
556
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
557
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
558
|
+
if (r2) {
|
|
559
|
+
throw takeObject(r1);
|
|
560
|
+
}
|
|
561
|
+
return takeObject(r0);
|
|
562
|
+
} finally {
|
|
563
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
569
|
+
*
|
|
570
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
571
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
572
|
+
*/
|
|
573
|
+
export function compressWitnessStack(witness_stack) {
|
|
574
|
+
try {
|
|
575
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
576
|
+
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
577
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
578
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
579
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
580
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
581
|
+
if (r3) {
|
|
582
|
+
throw takeObject(r2);
|
|
583
|
+
}
|
|
584
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
585
|
+
wasm.__wbindgen_free(r0, r1 * 1);
|
|
586
|
+
return v1;
|
|
587
|
+
} finally {
|
|
588
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
594
|
+
*
|
|
595
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
596
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
597
|
+
*/
|
|
598
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
599
|
+
try {
|
|
600
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
601
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
602
|
+
const len0 = WASM_VECTOR_LEN;
|
|
603
|
+
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
604
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
605
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
606
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
607
|
+
if (r2) {
|
|
608
|
+
throw takeObject(r1);
|
|
609
|
+
}
|
|
610
|
+
return takeObject(r0);
|
|
611
|
+
} finally {
|
|
612
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
616
616
|
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
|
|
617
617
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
618
618
|
}
|
|
@@ -665,28 +665,19 @@ function __wbg_get_imports() {
|
|
|
665
665
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
666
666
|
takeObject(arg0);
|
|
667
667
|
};
|
|
668
|
-
imports.wbg.__wbg_constructor_81b34c49dcbdd2af = function(arg0) {
|
|
669
|
-
const ret = new Error(takeObject(arg0));
|
|
670
|
-
return addHeapObject(ret);
|
|
671
|
-
};
|
|
672
668
|
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
673
669
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
674
670
|
return addHeapObject(ret);
|
|
675
671
|
};
|
|
676
|
-
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
677
|
-
const obj = takeObject(arg0).original;
|
|
678
|
-
if (obj.cnt-- == 1) {
|
|
679
|
-
obj.a = 0;
|
|
680
|
-
return true;
|
|
681
|
-
}
|
|
682
|
-
const ret = false;
|
|
683
|
-
return ret;
|
|
684
|
-
};
|
|
685
672
|
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
686
673
|
const ret = Array.isArray(getObject(arg0));
|
|
687
674
|
return ret;
|
|
688
675
|
};
|
|
689
|
-
imports.wbg.
|
|
676
|
+
imports.wbg.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
677
|
+
const ret = new Error(takeObject(arg0));
|
|
678
|
+
return addHeapObject(ret);
|
|
679
|
+
};
|
|
680
|
+
imports.wbg.__wbg_new_193bac1dd2be232d = function() {
|
|
690
681
|
const ret = new Map();
|
|
691
682
|
return addHeapObject(ret);
|
|
692
683
|
};
|
|
@@ -708,14 +699,23 @@ function __wbg_get_imports() {
|
|
|
708
699
|
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
709
700
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
710
701
|
};
|
|
711
|
-
imports.wbg.__wbg_new_ee5ac63ff3b0fa4d = function() {
|
|
712
|
-
const ret = new Array();
|
|
713
|
-
return addHeapObject(ret);
|
|
714
|
-
};
|
|
715
702
|
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
716
703
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
717
704
|
return ret;
|
|
718
705
|
};
|
|
706
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
707
|
+
const obj = takeObject(arg0).original;
|
|
708
|
+
if (obj.cnt-- == 1) {
|
|
709
|
+
obj.a = 0;
|
|
710
|
+
return true;
|
|
711
|
+
}
|
|
712
|
+
const ret = false;
|
|
713
|
+
return ret;
|
|
714
|
+
};
|
|
715
|
+
imports.wbg.__wbg_new_f139361aad331bd0 = function() {
|
|
716
|
+
const ret = new Array();
|
|
717
|
+
return addHeapObject(ret);
|
|
718
|
+
};
|
|
719
719
|
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
720
720
|
const ret = new Error();
|
|
721
721
|
return addHeapObject(ret);
|
|
@@ -900,7 +900,7 @@ function __wbg_get_imports() {
|
|
|
900
900
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
901
901
|
};
|
|
902
902
|
imports.wbg.__wbindgen_closure_wrapper739 = function(arg0, arg1, arg2) {
|
|
903
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
903
|
+
const ret = makeMutClosure(arg0, arg1, 237, __wbg_adapter_22);
|
|
904
904
|
return addHeapObject(ret);
|
|
905
905
|
};
|
|
906
906
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function compressWitness(a: number, b: number): void;
|
|
5
|
-
export function decompressWitness(a: number, b: number, c: number): void;
|
|
6
|
-
export function compressWitnessStack(a: number, b: number): void;
|
|
7
|
-
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
8
|
-
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
9
|
-
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
10
|
-
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
11
4
|
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
12
5
|
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
13
6
|
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
7
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
8
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
9
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
14
10
|
export function initLogLevel(a: number, b: number, c: number): void;
|
|
15
11
|
export function and(a: number, b: number): number;
|
|
16
12
|
export function xor(a: number, b: number): number;
|
|
@@ -20,6 +16,10 @@ export function keccak256(a: number, b: number, c: number): void;
|
|
|
20
16
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
21
17
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
22
18
|
export function buildInfo(): number;
|
|
19
|
+
export function compressWitness(a: number, b: number): void;
|
|
20
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
21
|
+
export function compressWitnessStack(a: number, b: number): void;
|
|
22
|
+
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
23
23
|
export function __wbindgen_malloc(a: number): number;
|
|
24
24
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
25
|
export const __wbindgen_export_2: WebAssembly.Table;
|