@noir-lang/acvm_js 0.46.0-e4eb5f5.nightly → 0.46.0-e73cdbb.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 +82 -99
- package/nodejs/acvm_js.js +249 -318
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +9 -13
- package/package.json +1 -1
- package/web/acvm_js.d.ts +91 -112
- package/web/acvm_js.js +246 -313
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +9 -13
package/nodejs/acvm_js.js
CHANGED
|
@@ -23,28 +23,6 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function isLikeNone(x) {
|
|
27
|
-
return x === undefined || x === null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
let cachedFloat64Memory0 = null;
|
|
31
|
-
|
|
32
|
-
function getFloat64Memory0() {
|
|
33
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
34
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
35
|
-
}
|
|
36
|
-
return cachedFloat64Memory0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
let cachedInt32Memory0 = null;
|
|
40
|
-
|
|
41
|
-
function getInt32Memory0() {
|
|
42
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
43
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
44
|
-
}
|
|
45
|
-
return cachedInt32Memory0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
26
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
49
27
|
|
|
50
28
|
cachedTextDecoder.decode();
|
|
@@ -72,6 +50,28 @@ function addHeapObject(obj) {
|
|
|
72
50
|
return idx;
|
|
73
51
|
}
|
|
74
52
|
|
|
53
|
+
function isLikeNone(x) {
|
|
54
|
+
return x === undefined || x === null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let cachedFloat64Memory0 = null;
|
|
58
|
+
|
|
59
|
+
function getFloat64Memory0() {
|
|
60
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
61
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
62
|
+
}
|
|
63
|
+
return cachedFloat64Memory0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let cachedInt32Memory0 = null;
|
|
67
|
+
|
|
68
|
+
function getInt32Memory0() {
|
|
69
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
70
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
71
|
+
}
|
|
72
|
+
return cachedInt32Memory0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
75
|
let WASM_VECTOR_LEN = 0;
|
|
76
76
|
|
|
77
77
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -220,6 +220,199 @@ 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
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
253
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
254
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
255
|
+
WASM_VECTOR_LEN = arg.length;
|
|
256
|
+
return ptr;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
260
|
+
* This should be used to only fetch the witness map for the main function.
|
|
261
|
+
*
|
|
262
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
263
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
264
|
+
*/
|
|
265
|
+
module.exports.decompressWitness = function(compressed_witness) {
|
|
266
|
+
try {
|
|
267
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
268
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
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
|
+
}
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
285
|
+
*
|
|
286
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
287
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
288
|
+
*/
|
|
289
|
+
module.exports.compressWitnessStack = function(witness_stack) {
|
|
290
|
+
try {
|
|
291
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
292
|
+
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
293
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
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
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
310
|
+
*
|
|
311
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
312
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
313
|
+
*/
|
|
314
|
+
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
315
|
+
try {
|
|
316
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
317
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
318
|
+
const len0 = WASM_VECTOR_LEN;
|
|
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
|
+
}
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
334
|
+
*
|
|
335
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
336
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
337
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
338
|
+
* @param {Uint8Array} program
|
|
339
|
+
* @param {WitnessMap} witness_map
|
|
340
|
+
* @returns {WitnessMap}
|
|
341
|
+
*/
|
|
342
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
343
|
+
try {
|
|
344
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
345
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
346
|
+
const len0 = WASM_VECTOR_LEN;
|
|
347
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
348
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
349
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
350
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
351
|
+
if (r2) {
|
|
352
|
+
throw takeObject(r1);
|
|
353
|
+
}
|
|
354
|
+
return takeObject(r0);
|
|
355
|
+
} finally {
|
|
356
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
362
|
+
*
|
|
363
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
364
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
365
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
366
|
+
* @param {Uint8Array} program
|
|
367
|
+
* @param {WitnessMap} solved_witness
|
|
368
|
+
* @returns {WitnessMap}
|
|
369
|
+
*/
|
|
370
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
371
|
+
try {
|
|
372
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
373
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
374
|
+
const len0 = WASM_VECTOR_LEN;
|
|
375
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
376
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
377
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
378
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
379
|
+
if (r2) {
|
|
380
|
+
throw takeObject(r1);
|
|
381
|
+
}
|
|
382
|
+
return takeObject(r0);
|
|
383
|
+
} finally {
|
|
384
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
390
|
+
*
|
|
391
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
392
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
393
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
394
|
+
* @param {Uint8Array} program
|
|
395
|
+
* @param {WitnessMap} solved_witness
|
|
396
|
+
* @returns {WitnessMap}
|
|
397
|
+
*/
|
|
398
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
399
|
+
try {
|
|
400
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
401
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
402
|
+
const len0 = WASM_VECTOR_LEN;
|
|
403
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
404
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
405
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
406
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
407
|
+
if (r2) {
|
|
408
|
+
throw takeObject(r1);
|
|
409
|
+
}
|
|
410
|
+
return takeObject(r0);
|
|
411
|
+
} finally {
|
|
412
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
|
|
223
416
|
/**
|
|
224
417
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
225
418
|
* @param {string} lhs
|
|
@@ -242,17 +435,6 @@ module.exports.xor = function(lhs, rhs) {
|
|
|
242
435
|
return takeObject(ret);
|
|
243
436
|
};
|
|
244
437
|
|
|
245
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
246
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
247
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
248
|
-
WASM_VECTOR_LEN = arg.length;
|
|
249
|
-
return ptr;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
253
|
-
ptr = ptr >>> 0;
|
|
254
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
255
|
-
}
|
|
256
438
|
/**
|
|
257
439
|
* Calculates the SHA256 hash of the input bytes
|
|
258
440
|
* @param {Uint8Array} inputs
|
|
@@ -359,10 +541,11 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
359
541
|
};
|
|
360
542
|
|
|
361
543
|
/**
|
|
362
|
-
*
|
|
544
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
545
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
363
546
|
*/
|
|
364
|
-
module.exports.
|
|
365
|
-
const ret = wasm.
|
|
547
|
+
module.exports.buildInfo = function() {
|
|
548
|
+
const ret = wasm.buildInfo();
|
|
366
549
|
return takeObject(ret);
|
|
367
550
|
};
|
|
368
551
|
|
|
@@ -381,48 +564,29 @@ module.exports.executeCircuit = function(program, initial_witness, foreign_call_
|
|
|
381
564
|
return takeObject(ret);
|
|
382
565
|
};
|
|
383
566
|
|
|
384
|
-
function _assertClass(instance, klass) {
|
|
385
|
-
if (!(instance instanceof klass)) {
|
|
386
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
387
|
-
}
|
|
388
|
-
return instance.ptr;
|
|
389
|
-
}
|
|
390
567
|
/**
|
|
391
568
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
392
569
|
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
393
570
|
*
|
|
394
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
395
571
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
396
572
|
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
397
573
|
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
398
574
|
* @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.
|
|
399
575
|
*/
|
|
400
|
-
module.exports.executeCircuitWithReturnWitness = function(
|
|
401
|
-
_assertClass(_solver, WasmBlackBoxFunctionSolver);
|
|
576
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
402
577
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
403
578
|
const len0 = WASM_VECTOR_LEN;
|
|
404
|
-
const ret = wasm.executeCircuitWithReturnWitness(
|
|
579
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
405
580
|
return takeObject(ret);
|
|
406
581
|
};
|
|
407
582
|
|
|
408
583
|
/**
|
|
409
584
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
410
585
|
*
|
|
411
|
-
* @param {
|
|
412
|
-
* @param {
|
|
413
|
-
* @param {
|
|
414
|
-
* @
|
|
415
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
416
|
-
*/
|
|
417
|
-
module.exports.executeCircuitWithBlackBoxSolver = function(_solver, program, initial_witness, foreign_call_handler) {
|
|
418
|
-
_assertClass(_solver, WasmBlackBoxFunctionSolver);
|
|
419
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
420
|
-
const len0 = WASM_VECTOR_LEN;
|
|
421
|
-
const ret = wasm.executeCircuitWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
422
|
-
return takeObject(ret);
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
/**
|
|
586
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
587
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
588
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
589
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
426
590
|
*/
|
|
427
591
|
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
428
592
|
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
@@ -431,16 +595,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
431
595
|
return takeObject(ret);
|
|
432
596
|
};
|
|
433
597
|
|
|
434
|
-
/**
|
|
435
|
-
*/
|
|
436
|
-
module.exports.executeProgramWithBlackBoxSolver = function(_solver, program, initial_witness, foreign_call_executor) {
|
|
437
|
-
_assertClass(_solver, WasmBlackBoxFunctionSolver);
|
|
438
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
439
|
-
const len0 = WASM_VECTOR_LEN;
|
|
440
|
-
const ret = wasm.executeProgramWithBlackBoxSolver(_solver.__wbg_ptr, ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_executor));
|
|
441
|
-
return takeObject(ret);
|
|
442
|
-
};
|
|
443
|
-
|
|
444
598
|
/**
|
|
445
599
|
* Sets the package's logging level.
|
|
446
600
|
*
|
|
@@ -462,199 +616,7 @@ module.exports.initLogLevel = function(filter) {
|
|
|
462
616
|
}
|
|
463
617
|
};
|
|
464
618
|
|
|
465
|
-
|
|
466
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
467
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
468
|
-
*/
|
|
469
|
-
module.exports.buildInfo = function() {
|
|
470
|
-
const ret = wasm.buildInfo();
|
|
471
|
-
return takeObject(ret);
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
476
|
-
*
|
|
477
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
478
|
-
* @returns {Uint8Array} A compressed witness map
|
|
479
|
-
*/
|
|
480
|
-
module.exports.compressWitness = function(witness_map) {
|
|
481
|
-
try {
|
|
482
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
483
|
-
wasm.compressWitness(retptr, addHeapObject(witness_map));
|
|
484
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
485
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
486
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
487
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
488
|
-
if (r3) {
|
|
489
|
-
throw takeObject(r2);
|
|
490
|
-
}
|
|
491
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
492
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
493
|
-
return v1;
|
|
494
|
-
} finally {
|
|
495
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
501
|
-
* This should be used to only fetch the witness map for the main function.
|
|
502
|
-
*
|
|
503
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
504
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
505
|
-
*/
|
|
506
|
-
module.exports.decompressWitness = function(compressed_witness) {
|
|
507
|
-
try {
|
|
508
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
509
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
510
|
-
const len0 = WASM_VECTOR_LEN;
|
|
511
|
-
wasm.decompressWitness(retptr, ptr0, len0);
|
|
512
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
513
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
514
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
515
|
-
if (r2) {
|
|
516
|
-
throw takeObject(r1);
|
|
517
|
-
}
|
|
518
|
-
return takeObject(r0);
|
|
519
|
-
} finally {
|
|
520
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
521
|
-
}
|
|
522
|
-
};
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
526
|
-
*
|
|
527
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
528
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
529
|
-
*/
|
|
530
|
-
module.exports.compressWitnessStack = function(witness_stack) {
|
|
531
|
-
try {
|
|
532
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
533
|
-
wasm.compressWitnessStack(retptr, addHeapObject(witness_stack));
|
|
534
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
535
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
536
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
537
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
538
|
-
if (r3) {
|
|
539
|
-
throw takeObject(r2);
|
|
540
|
-
}
|
|
541
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
542
|
-
wasm.__wbindgen_free(r0, r1 * 1);
|
|
543
|
-
return v1;
|
|
544
|
-
} finally {
|
|
545
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
551
|
-
*
|
|
552
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
553
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
554
|
-
*/
|
|
555
|
-
module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
556
|
-
try {
|
|
557
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
558
|
-
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
559
|
-
const len0 = WASM_VECTOR_LEN;
|
|
560
|
-
wasm.decompressWitnessStack(retptr, ptr0, len0);
|
|
561
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
562
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
563
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
564
|
-
if (r2) {
|
|
565
|
-
throw takeObject(r1);
|
|
566
|
-
}
|
|
567
|
-
return takeObject(r0);
|
|
568
|
-
} finally {
|
|
569
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
570
|
-
}
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
575
|
-
*
|
|
576
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
577
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
578
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
579
|
-
* @param {Uint8Array} program
|
|
580
|
-
* @param {WitnessMap} witness_map
|
|
581
|
-
* @returns {WitnessMap}
|
|
582
|
-
*/
|
|
583
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
584
|
-
try {
|
|
585
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
586
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
587
|
-
const len0 = WASM_VECTOR_LEN;
|
|
588
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
589
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
590
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
591
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
592
|
-
if (r2) {
|
|
593
|
-
throw takeObject(r1);
|
|
594
|
-
}
|
|
595
|
-
return takeObject(r0);
|
|
596
|
-
} finally {
|
|
597
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
598
|
-
}
|
|
599
|
-
};
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
603
|
-
*
|
|
604
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
605
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
606
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
607
|
-
* @param {Uint8Array} program
|
|
608
|
-
* @param {WitnessMap} solved_witness
|
|
609
|
-
* @returns {WitnessMap}
|
|
610
|
-
*/
|
|
611
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
612
|
-
try {
|
|
613
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
614
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
615
|
-
const len0 = WASM_VECTOR_LEN;
|
|
616
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
617
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
618
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
619
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
620
|
-
if (r2) {
|
|
621
|
-
throw takeObject(r1);
|
|
622
|
-
}
|
|
623
|
-
return takeObject(r0);
|
|
624
|
-
} finally {
|
|
625
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
631
|
-
*
|
|
632
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
633
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
634
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
635
|
-
* @param {Uint8Array} program
|
|
636
|
-
* @param {WitnessMap} solved_witness
|
|
637
|
-
* @returns {WitnessMap}
|
|
638
|
-
*/
|
|
639
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
640
|
-
try {
|
|
641
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
642
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
643
|
-
const len0 = WASM_VECTOR_LEN;
|
|
644
|
-
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
645
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
646
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
647
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
648
|
-
if (r2) {
|
|
649
|
-
throw takeObject(r1);
|
|
650
|
-
}
|
|
651
|
-
return takeObject(r0);
|
|
652
|
-
} finally {
|
|
653
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
|
|
657
|
-
function __wbg_adapter_81(arg0, arg1, arg2, arg3, arg4) {
|
|
619
|
+
function __wbg_adapter_76(arg0, arg1, arg2, arg3, arg4) {
|
|
658
620
|
wasm.wasm_bindgen__convert__closures__invoke3_mut__h629417323d5efbaa(arg0, arg1, addHeapObject(arg2), arg3, addHeapObject(arg4));
|
|
659
621
|
}
|
|
660
622
|
|
|
@@ -665,52 +627,14 @@ function handleError(f, args) {
|
|
|
665
627
|
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
666
628
|
}
|
|
667
629
|
}
|
|
668
|
-
function
|
|
630
|
+
function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
|
|
669
631
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
670
632
|
}
|
|
671
633
|
|
|
672
|
-
/**
|
|
673
|
-
*/
|
|
674
|
-
class WasmBlackBoxFunctionSolver {
|
|
675
|
-
|
|
676
|
-
static __wrap(ptr) {
|
|
677
|
-
ptr = ptr >>> 0;
|
|
678
|
-
const obj = Object.create(WasmBlackBoxFunctionSolver.prototype);
|
|
679
|
-
obj.__wbg_ptr = ptr;
|
|
680
|
-
|
|
681
|
-
return obj;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
__destroy_into_raw() {
|
|
685
|
-
const ptr = this.__wbg_ptr;
|
|
686
|
-
this.__wbg_ptr = 0;
|
|
687
|
-
|
|
688
|
-
return ptr;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
free() {
|
|
692
|
-
const ptr = this.__destroy_into_raw();
|
|
693
|
-
wasm.__wbg_wasmblackboxfunctionsolver_free(ptr);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
module.exports.WasmBlackBoxFunctionSolver = WasmBlackBoxFunctionSolver;
|
|
697
|
-
|
|
698
634
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
699
635
|
takeObject(arg0);
|
|
700
636
|
};
|
|
701
637
|
|
|
702
|
-
module.exports.__wbg_wasmblackboxfunctionsolver_new = function(arg0) {
|
|
703
|
-
const ret = WasmBlackBoxFunctionSolver.__wrap(arg0);
|
|
704
|
-
return addHeapObject(ret);
|
|
705
|
-
};
|
|
706
|
-
|
|
707
|
-
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
708
|
-
const obj = getObject(arg1);
|
|
709
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
710
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
711
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
712
|
-
};
|
|
713
|
-
|
|
714
638
|
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
715
639
|
const obj = takeObject(arg0).original;
|
|
716
640
|
if (obj.cnt-- == 1) {
|
|
@@ -721,16 +645,6 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
721
645
|
return ret;
|
|
722
646
|
};
|
|
723
647
|
|
|
724
|
-
module.exports.__wbindgen_is_array = function(arg0) {
|
|
725
|
-
const ret = Array.isArray(getObject(arg0));
|
|
726
|
-
return ret;
|
|
727
|
-
};
|
|
728
|
-
|
|
729
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
730
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
731
|
-
return ret;
|
|
732
|
-
};
|
|
733
|
-
|
|
734
648
|
module.exports.__wbg_constructor_81b34c49dcbdd2af = function(arg0) {
|
|
735
649
|
const ret = new Error(takeObject(arg0));
|
|
736
650
|
return addHeapObject(ret);
|
|
@@ -741,6 +655,18 @@ module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
|
741
655
|
return addHeapObject(ret);
|
|
742
656
|
};
|
|
743
657
|
|
|
658
|
+
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
659
|
+
const obj = getObject(arg1);
|
|
660
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
661
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
662
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
666
|
+
const ret = Array.isArray(getObject(arg0));
|
|
667
|
+
return ret;
|
|
668
|
+
};
|
|
669
|
+
|
|
744
670
|
module.exports.__wbg_new_6f6c75f9324b78e8 = function() {
|
|
745
671
|
const ret = new Map();
|
|
746
672
|
return addHeapObject(ret);
|
|
@@ -765,6 +691,11 @@ module.exports.__wbg_new_ee5ac63ff3b0fa4d = function() {
|
|
|
765
691
|
return addHeapObject(ret);
|
|
766
692
|
};
|
|
767
693
|
|
|
694
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
695
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
696
|
+
return ret;
|
|
697
|
+
};
|
|
698
|
+
|
|
768
699
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
769
700
|
const ret = new Error();
|
|
770
701
|
return addHeapObject(ret);
|
|
@@ -854,7 +785,7 @@ module.exports.__wbg_forEach_5ae261259d7517c8 = function(arg0, arg1, arg2) {
|
|
|
854
785
|
const a = state0.a;
|
|
855
786
|
state0.a = 0;
|
|
856
787
|
try {
|
|
857
|
-
return
|
|
788
|
+
return __wbg_adapter_76(a, state0.b, arg0, arg1, arg2);
|
|
858
789
|
} finally {
|
|
859
790
|
state0.a = a;
|
|
860
791
|
}
|
|
@@ -901,7 +832,7 @@ module.exports.__wbg_forEach_942772130a8d06a6 = function(arg0, arg1, arg2) {
|
|
|
901
832
|
const a = state0.a;
|
|
902
833
|
state0.a = 0;
|
|
903
834
|
try {
|
|
904
|
-
return
|
|
835
|
+
return __wbg_adapter_93(a, state0.b, arg0, arg1);
|
|
905
836
|
} finally {
|
|
906
837
|
state0.a = a;
|
|
907
838
|
}
|
|
@@ -934,7 +865,7 @@ module.exports.__wbg_new_2b55e405e4af4986 = function(arg0, arg1) {
|
|
|
934
865
|
const a = state0.a;
|
|
935
866
|
state0.a = 0;
|
|
936
867
|
try {
|
|
937
|
-
return
|
|
868
|
+
return __wbg_adapter_93(a, state0.b, arg0, arg1);
|
|
938
869
|
} finally {
|
|
939
870
|
state0.a = a;
|
|
940
871
|
}
|
|
@@ -983,8 +914,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
983
914
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
984
915
|
};
|
|
985
916
|
|
|
986
|
-
module.exports.
|
|
987
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
917
|
+
module.exports.__wbindgen_closure_wrapper742 = function(arg0, arg1, arg2) {
|
|
918
|
+
const ret = makeMutClosure(arg0, arg1, 239, __wbg_adapter_22);
|
|
988
919
|
return addHeapObject(ret);
|
|
989
920
|
};
|
|
990
921
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|