@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/nodejs/acvm_js.js
CHANGED
|
@@ -9,20 +9,6 @@ heap.push(undefined, null, true, false);
|
|
|
9
9
|
|
|
10
10
|
function getObject(idx) { return heap[idx]; }
|
|
11
11
|
|
|
12
|
-
let heap_next = heap.length;
|
|
13
|
-
|
|
14
|
-
function dropObject(idx) {
|
|
15
|
-
if (idx < 132) return;
|
|
16
|
-
heap[idx] = heap_next;
|
|
17
|
-
heap_next = idx;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function takeObject(idx) {
|
|
21
|
-
const ret = getObject(idx);
|
|
22
|
-
dropObject(idx);
|
|
23
|
-
return ret;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
12
|
function isLikeNone(x) {
|
|
27
13
|
return x === undefined || x === null;
|
|
28
14
|
}
|
|
@@ -45,13 +31,18 @@ function getInt32Memory0() {
|
|
|
45
31
|
return cachedInt32Memory0;
|
|
46
32
|
}
|
|
47
33
|
|
|
48
|
-
|
|
49
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
50
|
-
const idx = heap_next;
|
|
51
|
-
heap_next = heap[idx];
|
|
34
|
+
let heap_next = heap.length;
|
|
52
35
|
|
|
53
|
-
|
|
54
|
-
|
|
36
|
+
function dropObject(idx) {
|
|
37
|
+
if (idx < 132) return;
|
|
38
|
+
heap[idx] = heap_next;
|
|
39
|
+
heap_next = idx;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function takeObject(idx) {
|
|
43
|
+
const ret = getObject(idx);
|
|
44
|
+
dropObject(idx);
|
|
45
|
+
return ret;
|
|
55
46
|
}
|
|
56
47
|
|
|
57
48
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
@@ -72,6 +63,15 @@ function getStringFromWasm0(ptr, len) {
|
|
|
72
63
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
73
64
|
}
|
|
74
65
|
|
|
66
|
+
function addHeapObject(obj) {
|
|
67
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
68
|
+
const idx = heap_next;
|
|
69
|
+
heap_next = heap[idx];
|
|
70
|
+
|
|
71
|
+
heap[idx] = obj;
|
|
72
|
+
return idx;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
75
|
let WASM_VECTOR_LEN = 0;
|
|
76
76
|
|
|
77
77
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -220,79 +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__h21c8ca3eb6ab9385(arg0, arg1, addHeapObject(arg2));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
-
/**
|
|
224
|
-
* Sets the package's logging level.
|
|
225
|
-
*
|
|
226
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
227
|
-
*/
|
|
228
|
-
module.exports.initLogLevel = function(filter) {
|
|
229
|
-
try {
|
|
230
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
231
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
232
|
-
const len0 = WASM_VECTOR_LEN;
|
|
233
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
234
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
235
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
236
|
-
if (r1) {
|
|
237
|
-
throw takeObject(r0);
|
|
238
|
-
}
|
|
239
|
-
} finally {
|
|
240
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
245
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
246
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
247
|
-
WASM_VECTOR_LEN = arg.length;
|
|
248
|
-
return ptr;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
252
|
-
*
|
|
253
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
254
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
255
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
256
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
257
|
-
*/
|
|
258
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
259
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
260
|
-
const len0 = WASM_VECTOR_LEN;
|
|
261
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
262
|
-
return takeObject(ret);
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
267
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
268
|
-
*
|
|
269
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
270
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
271
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
272
|
-
* @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.
|
|
273
|
-
*/
|
|
274
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
275
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
276
|
-
const len0 = WASM_VECTOR_LEN;
|
|
277
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
278
|
-
return takeObject(ret);
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
283
|
-
*
|
|
284
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
285
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
286
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
287
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
288
|
-
*/
|
|
289
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
290
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
291
|
-
const len0 = WASM_VECTOR_LEN;
|
|
292
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
293
|
-
return takeObject(ret);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
223
|
/**
|
|
297
224
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
298
225
|
* @param {string} lhs
|
|
@@ -359,6 +286,13 @@ module.exports.sha256_compression = function(inputs, state) {
|
|
|
359
286
|
}
|
|
360
287
|
};
|
|
361
288
|
|
|
289
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
290
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
291
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
292
|
+
WASM_VECTOR_LEN = arg.length;
|
|
293
|
+
return ptr;
|
|
294
|
+
}
|
|
295
|
+
|
|
362
296
|
function getArrayU8FromWasm0(ptr, len) {
|
|
363
297
|
ptr = ptr >>> 0;
|
|
364
298
|
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
@@ -384,27 +318,6 @@ module.exports.blake2s256 = function(inputs) {
|
|
|
384
318
|
}
|
|
385
319
|
};
|
|
386
320
|
|
|
387
|
-
/**
|
|
388
|
-
* Calculates the Keccak256 hash of the input bytes
|
|
389
|
-
* @param {Uint8Array} inputs
|
|
390
|
-
* @returns {Uint8Array}
|
|
391
|
-
*/
|
|
392
|
-
module.exports.keccak256 = function(inputs) {
|
|
393
|
-
try {
|
|
394
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
395
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
396
|
-
const len0 = WASM_VECTOR_LEN;
|
|
397
|
-
wasm.keccak256(retptr, ptr0, len0);
|
|
398
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
399
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
400
|
-
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
401
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
402
|
-
return v2;
|
|
403
|
-
} finally {
|
|
404
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
|
|
408
321
|
/**
|
|
409
322
|
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
410
323
|
* @param {Uint8Array} hashed_msg
|
|
@@ -447,6 +360,111 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
447
360
|
return ret !== 0;
|
|
448
361
|
};
|
|
449
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Sets the package's logging level.
|
|
365
|
+
*
|
|
366
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
367
|
+
*/
|
|
368
|
+
module.exports.initLogLevel = function(filter) {
|
|
369
|
+
try {
|
|
370
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
371
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
372
|
+
const len0 = WASM_VECTOR_LEN;
|
|
373
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
374
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
375
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
376
|
+
if (r1) {
|
|
377
|
+
throw takeObject(r0);
|
|
378
|
+
}
|
|
379
|
+
} finally {
|
|
380
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
386
|
+
*
|
|
387
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
388
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
389
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
390
|
+
* @param {Uint8Array} program
|
|
391
|
+
* @param {WitnessMap} witness_map
|
|
392
|
+
* @returns {WitnessMap}
|
|
393
|
+
*/
|
|
394
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
395
|
+
try {
|
|
396
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
397
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
398
|
+
const len0 = WASM_VECTOR_LEN;
|
|
399
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
400
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
401
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
402
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
403
|
+
if (r2) {
|
|
404
|
+
throw takeObject(r1);
|
|
405
|
+
}
|
|
406
|
+
return takeObject(r0);
|
|
407
|
+
} finally {
|
|
408
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
414
|
+
*
|
|
415
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
416
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
417
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
418
|
+
* @param {Uint8Array} program
|
|
419
|
+
* @param {WitnessMap} solved_witness
|
|
420
|
+
* @returns {WitnessMap}
|
|
421
|
+
*/
|
|
422
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
423
|
+
try {
|
|
424
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
425
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
426
|
+
const len0 = WASM_VECTOR_LEN;
|
|
427
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
428
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
429
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
430
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
431
|
+
if (r2) {
|
|
432
|
+
throw takeObject(r1);
|
|
433
|
+
}
|
|
434
|
+
return takeObject(r0);
|
|
435
|
+
} finally {
|
|
436
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
442
|
+
*
|
|
443
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
444
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
445
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
446
|
+
* @param {Uint8Array} program
|
|
447
|
+
* @param {WitnessMap} solved_witness
|
|
448
|
+
* @returns {WitnessMap}
|
|
449
|
+
*/
|
|
450
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
451
|
+
try {
|
|
452
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
453
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
454
|
+
const len0 = WASM_VECTOR_LEN;
|
|
455
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
456
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
457
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
458
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
459
|
+
if (r2) {
|
|
460
|
+
throw takeObject(r1);
|
|
461
|
+
}
|
|
462
|
+
return takeObject(r0);
|
|
463
|
+
} finally {
|
|
464
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
|
|
450
468
|
/**
|
|
451
469
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
452
470
|
*
|
|
@@ -547,99 +565,61 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
547
565
|
};
|
|
548
566
|
|
|
549
567
|
/**
|
|
550
|
-
*
|
|
551
|
-
*
|
|
568
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
569
|
+
*
|
|
570
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
571
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
572
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
573
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
552
574
|
*/
|
|
553
|
-
module.exports.
|
|
554
|
-
const
|
|
575
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
576
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
577
|
+
const len0 = WASM_VECTOR_LEN;
|
|
578
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
555
579
|
return takeObject(ret);
|
|
556
580
|
};
|
|
557
581
|
|
|
558
582
|
/**
|
|
559
|
-
*
|
|
583
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
584
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
560
585
|
*
|
|
561
586
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
562
|
-
* @param {WitnessMap}
|
|
563
|
-
* @
|
|
564
|
-
* @
|
|
565
|
-
* @param {WitnessMap} witness_map
|
|
566
|
-
* @returns {WitnessMap}
|
|
587
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
588
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
589
|
+
* @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.
|
|
567
590
|
*/
|
|
568
|
-
module.exports.
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
574
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
575
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
576
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
577
|
-
if (r2) {
|
|
578
|
-
throw takeObject(r1);
|
|
579
|
-
}
|
|
580
|
-
return takeObject(r0);
|
|
581
|
-
} finally {
|
|
582
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
583
|
-
}
|
|
591
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
592
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
593
|
+
const len0 = WASM_VECTOR_LEN;
|
|
594
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
595
|
+
return takeObject(ret);
|
|
584
596
|
};
|
|
585
597
|
|
|
586
598
|
/**
|
|
587
|
-
*
|
|
599
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
588
600
|
*
|
|
589
|
-
* @param {Uint8Array}
|
|
590
|
-
* @param {WitnessMap}
|
|
591
|
-
* @
|
|
592
|
-
* @
|
|
593
|
-
* @param {WitnessMap} solved_witness
|
|
594
|
-
* @returns {WitnessMap}
|
|
601
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
602
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
603
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
604
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
595
605
|
*/
|
|
596
|
-
module.exports.
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
602
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
603
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
604
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
605
|
-
if (r2) {
|
|
606
|
-
throw takeObject(r1);
|
|
607
|
-
}
|
|
608
|
-
return takeObject(r0);
|
|
609
|
-
} finally {
|
|
610
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
611
|
-
}
|
|
606
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
607
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
608
|
+
const len0 = WASM_VECTOR_LEN;
|
|
609
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
610
|
+
return takeObject(ret);
|
|
612
611
|
};
|
|
613
612
|
|
|
614
613
|
/**
|
|
615
|
-
*
|
|
616
|
-
*
|
|
617
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
618
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
619
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
620
|
-
* @param {Uint8Array} program
|
|
621
|
-
* @param {WitnessMap} solved_witness
|
|
622
|
-
* @returns {WitnessMap}
|
|
614
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
615
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
623
616
|
*/
|
|
624
|
-
module.exports.
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
628
|
-
const len0 = WASM_VECTOR_LEN;
|
|
629
|
-
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
630
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
631
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
632
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
633
|
-
if (r2) {
|
|
634
|
-
throw takeObject(r1);
|
|
635
|
-
}
|
|
636
|
-
return takeObject(r0);
|
|
637
|
-
} finally {
|
|
638
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
639
|
-
}
|
|
617
|
+
module.exports.buildInfo = function() {
|
|
618
|
+
const ret = wasm.buildInfo();
|
|
619
|
+
return takeObject(ret);
|
|
640
620
|
};
|
|
641
621
|
|
|
642
|
-
function
|
|
622
|
+
function __wbg_adapter_75(arg0, arg1, arg2, arg3, arg4) {
|
|
643
623
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h17fc532521b46256(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
644
624
|
}
|
|
645
625
|
|
|
@@ -650,10 +630,31 @@ function handleError(f, args) {
|
|
|
650
630
|
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
651
631
|
}
|
|
652
632
|
}
|
|
653
|
-
function
|
|
633
|
+
function __wbg_adapter_92(arg0, arg1, arg2, arg3) {
|
|
654
634
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h0d187b0f08495587(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
655
635
|
}
|
|
656
636
|
|
|
637
|
+
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
638
|
+
const obj = getObject(arg1);
|
|
639
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
640
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
641
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
645
|
+
takeObject(arg0);
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
649
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
650
|
+
return ret;
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
654
|
+
const ret = Array.isArray(getObject(arg0));
|
|
655
|
+
return ret;
|
|
656
|
+
};
|
|
657
|
+
|
|
657
658
|
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
658
659
|
const obj = takeObject(arg0).original;
|
|
659
660
|
if (obj.cnt-- == 1) {
|
|
@@ -664,19 +665,18 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
664
665
|
return ret;
|
|
665
666
|
};
|
|
666
667
|
|
|
667
|
-
module.exports.
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
671
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
668
|
+
module.exports.__wbg_constructor_720343c738f4344c = function(arg0) {
|
|
669
|
+
const ret = new Error(takeObject(arg0));
|
|
670
|
+
return addHeapObject(ret);
|
|
672
671
|
};
|
|
673
672
|
|
|
674
|
-
module.exports.
|
|
675
|
-
|
|
673
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
674
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
675
|
+
return addHeapObject(ret);
|
|
676
676
|
};
|
|
677
677
|
|
|
678
|
-
module.exports.
|
|
679
|
-
const ret = new
|
|
678
|
+
module.exports.__wbg_new_55c288bb849e1b31 = function() {
|
|
679
|
+
const ret = new Array();
|
|
680
680
|
return addHeapObject(ret);
|
|
681
681
|
};
|
|
682
682
|
|
|
@@ -685,8 +685,8 @@ module.exports.__wbindgen_number_new = function(arg0) {
|
|
|
685
685
|
return addHeapObject(ret);
|
|
686
686
|
};
|
|
687
687
|
|
|
688
|
-
module.exports.
|
|
689
|
-
const ret =
|
|
688
|
+
module.exports.__wbg_new_7379c57bfbea14d0 = function() {
|
|
689
|
+
const ret = new Map();
|
|
690
690
|
return addHeapObject(ret);
|
|
691
691
|
};
|
|
692
692
|
|
|
@@ -699,26 +699,6 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
|
699
699
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
700
700
|
};
|
|
701
701
|
|
|
702
|
-
module.exports.__wbg_constructor_f4bcf4c70838c703 = function(arg0) {
|
|
703
|
-
const ret = new Error(takeObject(arg0));
|
|
704
|
-
return addHeapObject(ret);
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
module.exports.__wbindgen_is_array = function(arg0) {
|
|
708
|
-
const ret = Array.isArray(getObject(arg0));
|
|
709
|
-
return ret;
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
713
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
714
|
-
return ret;
|
|
715
|
-
};
|
|
716
|
-
|
|
717
|
-
module.exports.__wbg_new_e14625531a95427d = function() {
|
|
718
|
-
const ret = new Array();
|
|
719
|
-
return addHeapObject(ret);
|
|
720
|
-
};
|
|
721
|
-
|
|
722
702
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
723
703
|
const ret = new Error();
|
|
724
704
|
return addHeapObject(ret);
|
|
@@ -808,7 +788,7 @@ module.exports.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) {
|
|
|
808
788
|
const a = state0.a;
|
|
809
789
|
state0.a = 0;
|
|
810
790
|
try {
|
|
811
|
-
return
|
|
791
|
+
return __wbg_adapter_75(a, state0.b, arg0, arg1, arg2);
|
|
812
792
|
} finally {
|
|
813
793
|
state0.a = a;
|
|
814
794
|
}
|
|
@@ -855,7 +835,7 @@ module.exports.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
|
|
|
855
835
|
const a = state0.a;
|
|
856
836
|
state0.a = 0;
|
|
857
837
|
try {
|
|
858
|
-
return
|
|
838
|
+
return __wbg_adapter_92(a, state0.b, arg0, arg1);
|
|
859
839
|
} finally {
|
|
860
840
|
state0.a = a;
|
|
861
841
|
}
|
|
@@ -888,7 +868,7 @@ module.exports.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) {
|
|
|
888
868
|
const a = state0.a;
|
|
889
869
|
state0.a = 0;
|
|
890
870
|
try {
|
|
891
|
-
return
|
|
871
|
+
return __wbg_adapter_92(a, state0.b, arg0, arg1);
|
|
892
872
|
} finally {
|
|
893
873
|
state0.a = a;
|
|
894
874
|
}
|
|
@@ -937,8 +917,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
937
917
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
938
918
|
};
|
|
939
919
|
|
|
940
|
-
module.exports.
|
|
941
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
920
|
+
module.exports.__wbindgen_closure_wrapper737 = function(arg0, arg1, arg2) {
|
|
921
|
+
const ret = makeMutClosure(arg0, arg1, 268, __wbg_adapter_22);
|
|
942
922
|
return addHeapObject(ret);
|
|
943
923
|
};
|
|
944
924
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -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;
|