@noir-lang/acvm_js 0.51.0 → 0.52.0-075c3d3.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 +93 -99
- package/nodejs/acvm_js.js +205 -225
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +7 -8
- package/package.json +1 -1
- package/web/acvm_js.d.ts +100 -107
- package/web/acvm_js.js +201 -221
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +7 -8
package/web/acvm_js.js
CHANGED
|
@@ -6,20 +6,6 @@ heap.push(undefined, null, true, false);
|
|
|
6
6
|
|
|
7
7
|
function getObject(idx) { return heap[idx]; }
|
|
8
8
|
|
|
9
|
-
let heap_next = heap.length;
|
|
10
|
-
|
|
11
|
-
function dropObject(idx) {
|
|
12
|
-
if (idx < 132) return;
|
|
13
|
-
heap[idx] = heap_next;
|
|
14
|
-
heap_next = idx;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function takeObject(idx) {
|
|
18
|
-
const ret = getObject(idx);
|
|
19
|
-
dropObject(idx);
|
|
20
|
-
return ret;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
9
|
function isLikeNone(x) {
|
|
24
10
|
return x === undefined || x === null;
|
|
25
11
|
}
|
|
@@ -42,13 +28,18 @@ function getInt32Memory0() {
|
|
|
42
28
|
return cachedInt32Memory0;
|
|
43
29
|
}
|
|
44
30
|
|
|
45
|
-
|
|
46
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
47
|
-
const idx = heap_next;
|
|
48
|
-
heap_next = heap[idx];
|
|
31
|
+
let heap_next = heap.length;
|
|
49
32
|
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
function dropObject(idx) {
|
|
34
|
+
if (idx < 132) return;
|
|
35
|
+
heap[idx] = heap_next;
|
|
36
|
+
heap_next = idx;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function takeObject(idx) {
|
|
40
|
+
const ret = getObject(idx);
|
|
41
|
+
dropObject(idx);
|
|
42
|
+
return ret;
|
|
52
43
|
}
|
|
53
44
|
|
|
54
45
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
@@ -69,6 +60,15 @@ function getStringFromWasm0(ptr, len) {
|
|
|
69
60
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
70
61
|
}
|
|
71
62
|
|
|
63
|
+
function addHeapObject(obj) {
|
|
64
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
65
|
+
const idx = heap_next;
|
|
66
|
+
heap_next = heap[idx];
|
|
67
|
+
|
|
68
|
+
heap[idx] = obj;
|
|
69
|
+
return idx;
|
|
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,79 +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__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
/**
|
|
221
|
-
* Sets the package's logging level.
|
|
222
|
-
*
|
|
223
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
224
|
-
*/
|
|
225
|
-
export function initLogLevel(filter) {
|
|
226
|
-
try {
|
|
227
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
228
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
229
|
-
const len0 = WASM_VECTOR_LEN;
|
|
230
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
231
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
232
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
233
|
-
if (r1) {
|
|
234
|
-
throw takeObject(r0);
|
|
235
|
-
}
|
|
236
|
-
} finally {
|
|
237
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
242
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
243
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
244
|
-
WASM_VECTOR_LEN = arg.length;
|
|
245
|
-
return ptr;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
249
|
-
*
|
|
250
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
251
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
252
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
253
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
254
|
-
*/
|
|
255
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
256
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
257
|
-
const len0 = WASM_VECTOR_LEN;
|
|
258
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
259
|
-
return takeObject(ret);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
264
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
265
|
-
*
|
|
266
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
267
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
268
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
269
|
-
* @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.
|
|
270
|
-
*/
|
|
271
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
272
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
273
|
-
const len0 = WASM_VECTOR_LEN;
|
|
274
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
275
|
-
return takeObject(ret);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
280
|
-
*
|
|
281
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
282
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
283
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
284
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
285
|
-
*/
|
|
286
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
287
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
288
|
-
const len0 = WASM_VECTOR_LEN;
|
|
289
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
290
|
-
return takeObject(ret);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
220
|
/**
|
|
294
221
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
295
222
|
* @param {string} lhs
|
|
@@ -356,6 +283,13 @@ export function sha256_compression(inputs, state) {
|
|
|
356
283
|
}
|
|
357
284
|
}
|
|
358
285
|
|
|
286
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
287
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
288
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
289
|
+
WASM_VECTOR_LEN = arg.length;
|
|
290
|
+
return ptr;
|
|
291
|
+
}
|
|
292
|
+
|
|
359
293
|
function getArrayU8FromWasm0(ptr, len) {
|
|
360
294
|
ptr = ptr >>> 0;
|
|
361
295
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -381,27 +315,6 @@ export function blake2s256(inputs) {
|
|
|
381
315
|
}
|
|
382
316
|
}
|
|
383
317
|
|
|
384
|
-
/**
|
|
385
|
-
* Calculates the Keccak256 hash of the input bytes
|
|
386
|
-
* @param {Uint8Array} inputs
|
|
387
|
-
* @returns {Uint8Array}
|
|
388
|
-
*/
|
|
389
|
-
export function keccak256(inputs) {
|
|
390
|
-
try {
|
|
391
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
392
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
393
|
-
const len0 = WASM_VECTOR_LEN;
|
|
394
|
-
wasm.keccak256(retptr, ptr0, len0);
|
|
395
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
396
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
397
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
398
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
399
|
-
return v2;
|
|
400
|
-
} finally {
|
|
401
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
318
|
/**
|
|
406
319
|
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
407
320
|
* @param {Uint8Array} hashed_msg
|
|
@@ -444,6 +357,111 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
444
357
|
return ret !== 0;
|
|
445
358
|
}
|
|
446
359
|
|
|
360
|
+
/**
|
|
361
|
+
* Sets the package's logging level.
|
|
362
|
+
*
|
|
363
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
364
|
+
*/
|
|
365
|
+
export function initLogLevel(filter) {
|
|
366
|
+
try {
|
|
367
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
368
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
369
|
+
const len0 = WASM_VECTOR_LEN;
|
|
370
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
371
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
372
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
373
|
+
if (r1) {
|
|
374
|
+
throw takeObject(r0);
|
|
375
|
+
}
|
|
376
|
+
} finally {
|
|
377
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
383
|
+
*
|
|
384
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
385
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
386
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
387
|
+
* @param {Uint8Array} program
|
|
388
|
+
* @param {WitnessMap} witness_map
|
|
389
|
+
* @returns {WitnessMap}
|
|
390
|
+
*/
|
|
391
|
+
export function getReturnWitness(program, witness_map) {
|
|
392
|
+
try {
|
|
393
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
394
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
395
|
+
const len0 = WASM_VECTOR_LEN;
|
|
396
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
397
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
398
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
399
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
400
|
+
if (r2) {
|
|
401
|
+
throw takeObject(r1);
|
|
402
|
+
}
|
|
403
|
+
return takeObject(r0);
|
|
404
|
+
} finally {
|
|
405
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
411
|
+
*
|
|
412
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
413
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
414
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
415
|
+
* @param {Uint8Array} program
|
|
416
|
+
* @param {WitnessMap} solved_witness
|
|
417
|
+
* @returns {WitnessMap}
|
|
418
|
+
*/
|
|
419
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
420
|
+
try {
|
|
421
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
422
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
423
|
+
const len0 = WASM_VECTOR_LEN;
|
|
424
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
425
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
426
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
427
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
428
|
+
if (r2) {
|
|
429
|
+
throw takeObject(r1);
|
|
430
|
+
}
|
|
431
|
+
return takeObject(r0);
|
|
432
|
+
} finally {
|
|
433
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
439
|
+
*
|
|
440
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
441
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
442
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
443
|
+
* @param {Uint8Array} program
|
|
444
|
+
* @param {WitnessMap} solved_witness
|
|
445
|
+
* @returns {WitnessMap}
|
|
446
|
+
*/
|
|
447
|
+
export function getPublicWitness(program, solved_witness) {
|
|
448
|
+
try {
|
|
449
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
450
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
451
|
+
const len0 = WASM_VECTOR_LEN;
|
|
452
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
453
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
454
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
455
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
456
|
+
if (r2) {
|
|
457
|
+
throw takeObject(r1);
|
|
458
|
+
}
|
|
459
|
+
return takeObject(r0);
|
|
460
|
+
} finally {
|
|
461
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
447
465
|
/**
|
|
448
466
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
449
467
|
*
|
|
@@ -544,99 +562,61 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
544
562
|
}
|
|
545
563
|
|
|
546
564
|
/**
|
|
547
|
-
*
|
|
548
|
-
*
|
|
565
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
566
|
+
*
|
|
567
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
568
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
569
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
570
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
549
571
|
*/
|
|
550
|
-
export function
|
|
551
|
-
const
|
|
572
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
573
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
574
|
+
const len0 = WASM_VECTOR_LEN;
|
|
575
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
552
576
|
return takeObject(ret);
|
|
553
577
|
}
|
|
554
578
|
|
|
555
579
|
/**
|
|
556
|
-
*
|
|
580
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
581
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
557
582
|
*
|
|
558
583
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
559
|
-
* @param {WitnessMap}
|
|
560
|
-
* @
|
|
561
|
-
* @
|
|
562
|
-
* @param {WitnessMap} witness_map
|
|
563
|
-
* @returns {WitnessMap}
|
|
584
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
585
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
586
|
+
* @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.
|
|
564
587
|
*/
|
|
565
|
-
export function
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
571
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
572
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
573
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
574
|
-
if (r2) {
|
|
575
|
-
throw takeObject(r1);
|
|
576
|
-
}
|
|
577
|
-
return takeObject(r0);
|
|
578
|
-
} finally {
|
|
579
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
580
|
-
}
|
|
588
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
589
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
590
|
+
const len0 = WASM_VECTOR_LEN;
|
|
591
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
592
|
+
return takeObject(ret);
|
|
581
593
|
}
|
|
582
594
|
|
|
583
595
|
/**
|
|
584
|
-
*
|
|
596
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
585
597
|
*
|
|
586
|
-
* @param {Uint8Array}
|
|
587
|
-
* @param {WitnessMap}
|
|
588
|
-
* @
|
|
589
|
-
* @
|
|
590
|
-
* @param {WitnessMap} solved_witness
|
|
591
|
-
* @returns {WitnessMap}
|
|
598
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
599
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
600
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
601
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
592
602
|
*/
|
|
593
|
-
export function
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
599
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
600
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
601
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
602
|
-
if (r2) {
|
|
603
|
-
throw takeObject(r1);
|
|
604
|
-
}
|
|
605
|
-
return takeObject(r0);
|
|
606
|
-
} finally {
|
|
607
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
608
|
-
}
|
|
603
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
604
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
605
|
+
const len0 = WASM_VECTOR_LEN;
|
|
606
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
607
|
+
return takeObject(ret);
|
|
609
608
|
}
|
|
610
609
|
|
|
611
610
|
/**
|
|
612
|
-
*
|
|
613
|
-
*
|
|
614
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
615
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
616
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
617
|
-
* @param {Uint8Array} program
|
|
618
|
-
* @param {WitnessMap} solved_witness
|
|
619
|
-
* @returns {WitnessMap}
|
|
611
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
612
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
620
613
|
*/
|
|
621
|
-
export function
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
625
|
-
const len0 = WASM_VECTOR_LEN;
|
|
626
|
-
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
627
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
628
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
629
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
630
|
-
if (r2) {
|
|
631
|
-
throw takeObject(r1);
|
|
632
|
-
}
|
|
633
|
-
return takeObject(r0);
|
|
634
|
-
} finally {
|
|
635
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
636
|
-
}
|
|
614
|
+
export function buildInfo() {
|
|
615
|
+
const ret = wasm.buildInfo();
|
|
616
|
+
return takeObject(ret);
|
|
637
617
|
}
|
|
638
618
|
|
|
639
|
-
function
|
|
619
|
+
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
|
|
640
620
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
641
621
|
}
|
|
642
622
|
|
|
@@ -647,7 +627,7 @@ function handleError(f, args) {
|
|
|
647
627
|
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
648
628
|
}
|
|
649
629
|
}
|
|
650
|
-
function
|
|
630
|
+
function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
|
|
651
631
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
652
632
|
}
|
|
653
633
|
|
|
@@ -685,6 +665,23 @@ async function __wbg_load(module, imports) {
|
|
|
685
665
|
function __wbg_get_imports() {
|
|
686
666
|
const imports = {};
|
|
687
667
|
imports.wbg = {};
|
|
668
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
669
|
+
const obj = getObject(arg1);
|
|
670
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
671
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
672
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
673
|
+
};
|
|
674
|
+
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
675
|
+
takeObject(arg0);
|
|
676
|
+
};
|
|
677
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
678
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
679
|
+
return ret;
|
|
680
|
+
};
|
|
681
|
+
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
682
|
+
const ret = Array.isArray(getObject(arg0));
|
|
683
|
+
return ret;
|
|
684
|
+
};
|
|
688
685
|
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
689
686
|
const obj = takeObject(arg0).original;
|
|
690
687
|
if (obj.cnt-- == 1) {
|
|
@@ -694,25 +691,24 @@ function __wbg_get_imports() {
|
|
|
694
691
|
const ret = false;
|
|
695
692
|
return ret;
|
|
696
693
|
};
|
|
697
|
-
imports.wbg.
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
701
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
694
|
+
imports.wbg.__wbg_constructor_720343c738f4344c = function(arg0) {
|
|
695
|
+
const ret = new Error(takeObject(arg0));
|
|
696
|
+
return addHeapObject(ret);
|
|
702
697
|
};
|
|
703
|
-
imports.wbg.
|
|
704
|
-
|
|
698
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
699
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
700
|
+
return addHeapObject(ret);
|
|
705
701
|
};
|
|
706
|
-
imports.wbg.
|
|
707
|
-
const ret = new
|
|
702
|
+
imports.wbg.__wbg_new_55c288bb849e1b31 = function() {
|
|
703
|
+
const ret = new Array();
|
|
708
704
|
return addHeapObject(ret);
|
|
709
705
|
};
|
|
710
706
|
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
711
707
|
const ret = arg0;
|
|
712
708
|
return addHeapObject(ret);
|
|
713
709
|
};
|
|
714
|
-
imports.wbg.
|
|
715
|
-
const ret =
|
|
710
|
+
imports.wbg.__wbg_new_7379c57bfbea14d0 = function() {
|
|
711
|
+
const ret = new Map();
|
|
716
712
|
return addHeapObject(ret);
|
|
717
713
|
};
|
|
718
714
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
@@ -723,22 +719,6 @@ function __wbg_get_imports() {
|
|
|
723
719
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
724
720
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
725
721
|
};
|
|
726
|
-
imports.wbg.__wbg_constructor_f4bcf4c70838c703 = function(arg0) {
|
|
727
|
-
const ret = new Error(takeObject(arg0));
|
|
728
|
-
return addHeapObject(ret);
|
|
729
|
-
};
|
|
730
|
-
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
731
|
-
const ret = Array.isArray(getObject(arg0));
|
|
732
|
-
return ret;
|
|
733
|
-
};
|
|
734
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
735
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
736
|
-
return ret;
|
|
737
|
-
};
|
|
738
|
-
imports.wbg.__wbg_new_e14625531a95427d = function() {
|
|
739
|
-
const ret = new Array();
|
|
740
|
-
return addHeapObject(ret);
|
|
741
|
-
};
|
|
742
722
|
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
743
723
|
const ret = new Error();
|
|
744
724
|
return addHeapObject(ret);
|
|
@@ -812,7 +792,7 @@ function __wbg_get_imports() {
|
|
|
812
792
|
const a = state0.a;
|
|
813
793
|
state0.a = 0;
|
|
814
794
|
try {
|
|
815
|
-
return
|
|
795
|
+
return __wbg_adapter_75(a, state0.b, arg0, arg1, arg2);
|
|
816
796
|
} finally {
|
|
817
797
|
state0.a = a;
|
|
818
798
|
}
|
|
@@ -852,7 +832,7 @@ function __wbg_get_imports() {
|
|
|
852
832
|
const a = state0.a;
|
|
853
833
|
state0.a = 0;
|
|
854
834
|
try {
|
|
855
|
-
return
|
|
835
|
+
return __wbg_adapter_92(a, state0.b, arg0, arg1);
|
|
856
836
|
} finally {
|
|
857
837
|
state0.a = a;
|
|
858
838
|
}
|
|
@@ -881,7 +861,7 @@ function __wbg_get_imports() {
|
|
|
881
861
|
const a = state0.a;
|
|
882
862
|
state0.a = 0;
|
|
883
863
|
try {
|
|
884
|
-
return
|
|
864
|
+
return __wbg_adapter_92(a, state0.b, arg0, arg1);
|
|
885
865
|
} finally {
|
|
886
866
|
state0.a = a;
|
|
887
867
|
}
|
|
@@ -922,8 +902,8 @@ function __wbg_get_imports() {
|
|
|
922
902
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
923
903
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
924
904
|
};
|
|
925
|
-
imports.wbg.
|
|
926
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
905
|
+
imports.wbg.__wbindgen_closure_wrapper737 = function(arg0, arg1, arg2) {
|
|
906
|
+
const ret = makeMutClosure(arg0, arg1, 268, __wbg_adapter_22);
|
|
927
907
|
return addHeapObject(ret);
|
|
928
908
|
};
|
|
929
909
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function initLogLevel(a: number, b: number, c: number): void;
|
|
5
|
-
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
7
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
8
4
|
export function and(a: number, b: number): number;
|
|
9
5
|
export function xor(a: number, b: number): number;
|
|
10
6
|
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
|
|
11
7
|
export function blake2s256(a: number, b: number, c: number): void;
|
|
12
|
-
export function keccak256(a: number, b: number, c: number): void;
|
|
13
8
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
14
9
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
10
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
11
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
12
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
13
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
15
14
|
export function compressWitness(a: number, b: number): void;
|
|
16
15
|
export function decompressWitness(a: number, b: number, c: number): void;
|
|
17
16
|
export function compressWitnessStack(a: number, b: number): void;
|
|
18
17
|
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
18
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
19
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
20
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
19
21
|
export function buildInfo(): number;
|
|
20
|
-
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
21
|
-
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
22
|
-
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
23
22
|
export function __wbindgen_malloc(a: number): number;
|
|
24
23
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|