@noir-lang/acvm_js 0.50.0 → 0.51.0-052aee8.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 +106 -105
- package/nodejs/acvm_js.js +253 -231
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +9 -9
- package/package.json +2 -2
- package/web/acvm_js.d.ts +115 -114
- package/web/acvm_js.js +250 -227
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +9 -9
package/web/acvm_js.js
CHANGED
|
@@ -6,28 +6,6 @@ heap.push(undefined, null, true, false);
|
|
|
6
6
|
|
|
7
7
|
function getObject(idx) { return heap[idx]; }
|
|
8
8
|
|
|
9
|
-
function isLikeNone(x) {
|
|
10
|
-
return x === undefined || x === null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let cachedFloat64Memory0 = null;
|
|
14
|
-
|
|
15
|
-
function getFloat64Memory0() {
|
|
16
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
17
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
18
|
-
}
|
|
19
|
-
return cachedFloat64Memory0;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
let cachedInt32Memory0 = null;
|
|
23
|
-
|
|
24
|
-
function getInt32Memory0() {
|
|
25
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
26
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
27
|
-
}
|
|
28
|
-
return cachedInt32Memory0;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
9
|
let heap_next = heap.length;
|
|
32
10
|
|
|
33
11
|
function dropObject(idx) {
|
|
@@ -42,15 +20,6 @@ function takeObject(idx) {
|
|
|
42
20
|
return ret;
|
|
43
21
|
}
|
|
44
22
|
|
|
45
|
-
function addHeapObject(obj) {
|
|
46
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
47
|
-
const idx = heap_next;
|
|
48
|
-
heap_next = heap[idx];
|
|
49
|
-
|
|
50
|
-
heap[idx] = obj;
|
|
51
|
-
return idx;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
23
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
55
24
|
|
|
56
25
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
@@ -69,6 +38,37 @@ function getStringFromWasm0(ptr, len) {
|
|
|
69
38
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
70
39
|
}
|
|
71
40
|
|
|
41
|
+
function addHeapObject(obj) {
|
|
42
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
43
|
+
const idx = heap_next;
|
|
44
|
+
heap_next = heap[idx];
|
|
45
|
+
|
|
46
|
+
heap[idx] = obj;
|
|
47
|
+
return idx;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isLikeNone(x) {
|
|
51
|
+
return x === undefined || x === null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let cachedFloat64Memory0 = null;
|
|
55
|
+
|
|
56
|
+
function getFloat64Memory0() {
|
|
57
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
58
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
59
|
+
}
|
|
60
|
+
return cachedFloat64Memory0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
let cachedInt32Memory0 = null;
|
|
64
|
+
|
|
65
|
+
function getInt32Memory0() {
|
|
66
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
67
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
68
|
+
}
|
|
69
|
+
return cachedInt32Memory0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
72
|
let WASM_VECTOR_LEN = 0;
|
|
73
73
|
|
|
74
74
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -217,6 +217,172 @@ 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__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
222
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
223
|
+
*/
|
|
224
|
+
export function buildInfo() {
|
|
225
|
+
const ret = wasm.buildInfo();
|
|
226
|
+
return takeObject(ret);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
230
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
231
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
232
|
+
WASM_VECTOR_LEN = arg.length;
|
|
233
|
+
return ptr;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
237
|
+
*
|
|
238
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
239
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
240
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
241
|
+
* @param {Uint8Array} program
|
|
242
|
+
* @param {WitnessMap} witness_map
|
|
243
|
+
* @returns {WitnessMap}
|
|
244
|
+
*/
|
|
245
|
+
export function getReturnWitness(program, witness_map) {
|
|
246
|
+
try {
|
|
247
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
248
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
249
|
+
const len0 = WASM_VECTOR_LEN;
|
|
250
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
251
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
252
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
253
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
254
|
+
if (r2) {
|
|
255
|
+
throw takeObject(r1);
|
|
256
|
+
}
|
|
257
|
+
return takeObject(r0);
|
|
258
|
+
} finally {
|
|
259
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
265
|
+
*
|
|
266
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
267
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
268
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
269
|
+
* @param {Uint8Array} program
|
|
270
|
+
* @param {WitnessMap} solved_witness
|
|
271
|
+
* @returns {WitnessMap}
|
|
272
|
+
*/
|
|
273
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
274
|
+
try {
|
|
275
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
276
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
277
|
+
const len0 = WASM_VECTOR_LEN;
|
|
278
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
279
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
280
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
281
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
282
|
+
if (r2) {
|
|
283
|
+
throw takeObject(r1);
|
|
284
|
+
}
|
|
285
|
+
return takeObject(r0);
|
|
286
|
+
} finally {
|
|
287
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
293
|
+
*
|
|
294
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
295
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
296
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
297
|
+
* @param {Uint8Array} program
|
|
298
|
+
* @param {WitnessMap} solved_witness
|
|
299
|
+
* @returns {WitnessMap}
|
|
300
|
+
*/
|
|
301
|
+
export function getPublicWitness(program, solved_witness) {
|
|
302
|
+
try {
|
|
303
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
304
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
305
|
+
const len0 = WASM_VECTOR_LEN;
|
|
306
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
307
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
308
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
309
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
310
|
+
if (r2) {
|
|
311
|
+
throw takeObject(r1);
|
|
312
|
+
}
|
|
313
|
+
return takeObject(r0);
|
|
314
|
+
} finally {
|
|
315
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Sets the package's logging level.
|
|
321
|
+
*
|
|
322
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
323
|
+
*/
|
|
324
|
+
export function initLogLevel(filter) {
|
|
325
|
+
try {
|
|
326
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
327
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
328
|
+
const len0 = WASM_VECTOR_LEN;
|
|
329
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
330
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
331
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
332
|
+
if (r1) {
|
|
333
|
+
throw takeObject(r0);
|
|
334
|
+
}
|
|
335
|
+
} finally {
|
|
336
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
342
|
+
*
|
|
343
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
344
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
345
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
346
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
347
|
+
*/
|
|
348
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
349
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
350
|
+
const len0 = WASM_VECTOR_LEN;
|
|
351
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
352
|
+
return takeObject(ret);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
357
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
358
|
+
*
|
|
359
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
360
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
361
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
362
|
+
* @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.
|
|
363
|
+
*/
|
|
364
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
365
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
366
|
+
const len0 = WASM_VECTOR_LEN;
|
|
367
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
368
|
+
return takeObject(ret);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
373
|
+
*
|
|
374
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
375
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
376
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
377
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
378
|
+
*/
|
|
379
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
380
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
381
|
+
const len0 = WASM_VECTOR_LEN;
|
|
382
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
383
|
+
return takeObject(ret);
|
|
384
|
+
}
|
|
385
|
+
|
|
220
386
|
/**
|
|
221
387
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
222
388
|
* @param {string} lhs
|
|
@@ -239,38 +405,54 @@ export function xor(lhs, rhs) {
|
|
|
239
405
|
return takeObject(ret);
|
|
240
406
|
}
|
|
241
407
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
408
|
+
let cachedUint32Memory0 = null;
|
|
409
|
+
|
|
410
|
+
function getUint32Memory0() {
|
|
411
|
+
if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
|
|
412
|
+
cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
|
|
413
|
+
}
|
|
414
|
+
return cachedUint32Memory0;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
418
|
+
const ptr = malloc(arg.length * 4) >>> 0;
|
|
419
|
+
getUint32Memory0().set(arg, ptr / 4);
|
|
245
420
|
WASM_VECTOR_LEN = arg.length;
|
|
246
421
|
return ptr;
|
|
247
422
|
}
|
|
248
423
|
|
|
249
|
-
function
|
|
424
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
250
425
|
ptr = ptr >>> 0;
|
|
251
|
-
return
|
|
426
|
+
return getUint32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
|
252
427
|
}
|
|
253
428
|
/**
|
|
254
|
-
*
|
|
255
|
-
* @param {
|
|
256
|
-
* @
|
|
429
|
+
* Sha256 compression function
|
|
430
|
+
* @param {Uint32Array} inputs
|
|
431
|
+
* @param {Uint32Array} state
|
|
432
|
+
* @returns {Uint32Array}
|
|
257
433
|
*/
|
|
258
|
-
export function
|
|
434
|
+
export function sha256_compression(inputs, state) {
|
|
259
435
|
try {
|
|
260
436
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
261
|
-
const ptr0 =
|
|
437
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
262
438
|
const len0 = WASM_VECTOR_LEN;
|
|
263
|
-
|
|
439
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
440
|
+
const len1 = WASM_VECTOR_LEN;
|
|
441
|
+
wasm.sha256_compression(retptr, ptr0, len0, ptr1, len1);
|
|
264
442
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
265
443
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
266
|
-
var
|
|
267
|
-
wasm.__wbindgen_free(r0, r1 *
|
|
268
|
-
return
|
|
444
|
+
var v3 = getArrayU32FromWasm0(r0, r1).slice();
|
|
445
|
+
wasm.__wbindgen_free(r0, r1 * 4);
|
|
446
|
+
return v3;
|
|
269
447
|
} finally {
|
|
270
448
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
271
449
|
}
|
|
272
450
|
}
|
|
273
451
|
|
|
452
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
453
|
+
ptr = ptr >>> 0;
|
|
454
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
455
|
+
}
|
|
274
456
|
/**
|
|
275
457
|
* Calculates the Blake2s256 hash of the input bytes
|
|
276
458
|
* @param {Uint8Array} inputs
|
|
@@ -454,166 +636,6 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
454
636
|
}
|
|
455
637
|
}
|
|
456
638
|
|
|
457
|
-
/**
|
|
458
|
-
* Sets the package's logging level.
|
|
459
|
-
*
|
|
460
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
461
|
-
*/
|
|
462
|
-
export function initLogLevel(filter) {
|
|
463
|
-
try {
|
|
464
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
465
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
466
|
-
const len0 = WASM_VECTOR_LEN;
|
|
467
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
468
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
469
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
470
|
-
if (r1) {
|
|
471
|
-
throw takeObject(r0);
|
|
472
|
-
}
|
|
473
|
-
} finally {
|
|
474
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
/**
|
|
479
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
480
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
481
|
-
*/
|
|
482
|
-
export function buildInfo() {
|
|
483
|
-
const ret = wasm.buildInfo();
|
|
484
|
-
return takeObject(ret);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
489
|
-
*
|
|
490
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
491
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
492
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
493
|
-
* @param {Uint8Array} program
|
|
494
|
-
* @param {WitnessMap} witness_map
|
|
495
|
-
* @returns {WitnessMap}
|
|
496
|
-
*/
|
|
497
|
-
export function getReturnWitness(program, witness_map) {
|
|
498
|
-
try {
|
|
499
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
500
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
501
|
-
const len0 = WASM_VECTOR_LEN;
|
|
502
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
503
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
504
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
505
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
506
|
-
if (r2) {
|
|
507
|
-
throw takeObject(r1);
|
|
508
|
-
}
|
|
509
|
-
return takeObject(r0);
|
|
510
|
-
} finally {
|
|
511
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
517
|
-
*
|
|
518
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
519
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
520
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
521
|
-
* @param {Uint8Array} program
|
|
522
|
-
* @param {WitnessMap} solved_witness
|
|
523
|
-
* @returns {WitnessMap}
|
|
524
|
-
*/
|
|
525
|
-
export function getPublicParametersWitness(program, solved_witness) {
|
|
526
|
-
try {
|
|
527
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
528
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
529
|
-
const len0 = WASM_VECTOR_LEN;
|
|
530
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
531
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
532
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
533
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
534
|
-
if (r2) {
|
|
535
|
-
throw takeObject(r1);
|
|
536
|
-
}
|
|
537
|
-
return takeObject(r0);
|
|
538
|
-
} finally {
|
|
539
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
545
|
-
*
|
|
546
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
547
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
548
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
549
|
-
* @param {Uint8Array} program
|
|
550
|
-
* @param {WitnessMap} solved_witness
|
|
551
|
-
* @returns {WitnessMap}
|
|
552
|
-
*/
|
|
553
|
-
export function getPublicWitness(program, solved_witness) {
|
|
554
|
-
try {
|
|
555
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
556
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
557
|
-
const len0 = WASM_VECTOR_LEN;
|
|
558
|
-
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
559
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
560
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
561
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
562
|
-
if (r2) {
|
|
563
|
-
throw takeObject(r1);
|
|
564
|
-
}
|
|
565
|
-
return takeObject(r0);
|
|
566
|
-
} finally {
|
|
567
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
/**
|
|
572
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
573
|
-
*
|
|
574
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
575
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
576
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
577
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
578
|
-
*/
|
|
579
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
580
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
581
|
-
const len0 = WASM_VECTOR_LEN;
|
|
582
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
583
|
-
return takeObject(ret);
|
|
584
|
-
}
|
|
585
|
-
|
|
586
|
-
/**
|
|
587
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
588
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
589
|
-
*
|
|
590
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
591
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
592
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
593
|
-
* @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.
|
|
594
|
-
*/
|
|
595
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
596
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
597
|
-
const len0 = WASM_VECTOR_LEN;
|
|
598
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
599
|
-
return takeObject(ret);
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
604
|
-
*
|
|
605
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
606
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
607
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
608
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
609
|
-
*/
|
|
610
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
611
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
612
|
-
const len0 = WASM_VECTOR_LEN;
|
|
613
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
614
|
-
return takeObject(ret);
|
|
615
|
-
}
|
|
616
|
-
|
|
617
639
|
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
|
|
618
640
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
619
641
|
}
|
|
@@ -663,15 +685,6 @@ async function __wbg_load(module, imports) {
|
|
|
663
685
|
function __wbg_get_imports() {
|
|
664
686
|
const imports = {};
|
|
665
687
|
imports.wbg = {};
|
|
666
|
-
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
667
|
-
const obj = getObject(arg1);
|
|
668
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
669
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
670
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
671
|
-
};
|
|
672
|
-
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
673
|
-
takeObject(arg0);
|
|
674
|
-
};
|
|
675
688
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
676
689
|
const obj = takeObject(arg0).original;
|
|
677
690
|
if (obj.cnt-- == 1) {
|
|
@@ -681,16 +694,33 @@ function __wbg_get_imports() {
|
|
|
681
694
|
const ret = false;
|
|
682
695
|
return ret;
|
|
683
696
|
};
|
|
684
|
-
imports.wbg.
|
|
685
|
-
|
|
697
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
698
|
+
takeObject(arg0);
|
|
699
|
+
};
|
|
700
|
+
imports.wbg.__wbg_constructor_f4bcf4c70838c703 = function(arg0) {
|
|
701
|
+
const ret = new Error(takeObject(arg0));
|
|
702
|
+
return addHeapObject(ret);
|
|
703
|
+
};
|
|
704
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
705
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
706
|
+
return addHeapObject(ret);
|
|
707
|
+
};
|
|
708
|
+
imports.wbg.__wbg_new_e14625531a95427d = function() {
|
|
709
|
+
const ret = new Array();
|
|
686
710
|
return addHeapObject(ret);
|
|
687
711
|
};
|
|
688
712
|
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
689
713
|
const ret = arg0;
|
|
690
714
|
return addHeapObject(ret);
|
|
691
715
|
};
|
|
692
|
-
imports.wbg.
|
|
693
|
-
const
|
|
716
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
717
|
+
const obj = getObject(arg1);
|
|
718
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
719
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
720
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
721
|
+
};
|
|
722
|
+
imports.wbg.__wbg_new_3b3e21164d5381ca = function() {
|
|
723
|
+
const ret = new Map();
|
|
694
724
|
return addHeapObject(ret);
|
|
695
725
|
};
|
|
696
726
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
@@ -701,14 +731,6 @@ function __wbg_get_imports() {
|
|
|
701
731
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
702
732
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
703
733
|
};
|
|
704
|
-
imports.wbg.__wbg_constructor_cd1bce44c75e1104 = function(arg0) {
|
|
705
|
-
const ret = new Error(takeObject(arg0));
|
|
706
|
-
return addHeapObject(ret);
|
|
707
|
-
};
|
|
708
|
-
imports.wbg.__wbg_new_76b464e4772843b0 = function() {
|
|
709
|
-
const ret = new Array();
|
|
710
|
-
return addHeapObject(ret);
|
|
711
|
-
};
|
|
712
734
|
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
713
735
|
const ret = Array.isArray(getObject(arg0));
|
|
714
736
|
return ret;
|
|
@@ -901,7 +923,7 @@ function __wbg_get_imports() {
|
|
|
901
923
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
902
924
|
};
|
|
903
925
|
imports.wbg.__wbindgen_closure_wrapper747 = function(arg0, arg1, arg2) {
|
|
904
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
926
|
+
const ret = makeMutClosure(arg0, arg1, 266, __wbg_adapter_22);
|
|
905
927
|
return addHeapObject(ret);
|
|
906
928
|
};
|
|
907
929
|
|
|
@@ -917,6 +939,7 @@ function __wbg_finalize_init(instance, module) {
|
|
|
917
939
|
__wbg_init.__wbindgen_wasm_module = module;
|
|
918
940
|
cachedFloat64Memory0 = null;
|
|
919
941
|
cachedInt32Memory0 = null;
|
|
942
|
+
cachedUint32Memory0 = null;
|
|
920
943
|
cachedUint8Memory0 = null;
|
|
921
944
|
|
|
922
945
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export function buildInfo(): number;
|
|
5
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
6
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
7
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
8
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
9
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
10
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
11
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
4
12
|
export function and(a: number, b: number): number;
|
|
5
13
|
export function xor(a: number, b: number): number;
|
|
6
|
-
export function
|
|
14
|
+
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
|
|
7
15
|
export function blake2s256(a: number, b: number, c: number): void;
|
|
8
16
|
export function keccak256(a: number, b: number, c: number): void;
|
|
9
17
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
@@ -12,14 +20,6 @@ export function compressWitness(a: number, b: number): void;
|
|
|
12
20
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
13
21
|
export function compressWitnessStack(a: number, b: number): void;
|
|
14
22
|
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
15
|
-
export function initLogLevel(a: number, b: number, c: number): void;
|
|
16
|
-
export function buildInfo(): number;
|
|
17
|
-
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
18
|
-
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
19
|
-
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
20
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
21
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
22
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
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;
|