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