@provablehq/wasm 0.11.10 → 0.12.0
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/dist/mainnet/aleo_wasm.d.ts +16 -14
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +65 -63
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +65 -63
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +65 -63
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +16 -14
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +54 -52
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +54 -52
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +54 -52
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,18 +9,6 @@ export function runRayonThread(receiver: number): void;
|
|
|
9
9
|
*/
|
|
10
10
|
export function setWasmLogLevel(level: number): void;
|
|
11
11
|
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* Verify a SNARK proof against a verifying key and public inputs.
|
|
14
|
-
*
|
|
15
|
-
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
16
|
-
* It directly invokes the Varuna proof verification from snarkVM.
|
|
17
|
-
*
|
|
18
|
-
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
19
|
-
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
20
|
-
* @param {Proof} proof The proof to verify
|
|
21
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
22
|
-
*/
|
|
23
|
-
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
24
12
|
/**
|
|
25
13
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
26
14
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -47,7 +35,20 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
|
|
|
47
35
|
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
48
36
|
*/
|
|
49
37
|
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
50
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
40
|
+
*
|
|
41
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
42
|
+
* It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
|
|
43
|
+
* by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
|
|
44
|
+
* an older Varuna version will fail verification.
|
|
45
|
+
*
|
|
46
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
47
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
48
|
+
* @param {Proof} proof The proof to verify
|
|
49
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
50
|
+
*/
|
|
51
|
+
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
51
52
|
/**
|
|
52
53
|
* Set test consensus version heights for testing.
|
|
53
54
|
*
|
|
@@ -57,7 +58,7 @@ export function stringToField(string: string): Field;
|
|
|
57
58
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
58
59
|
*
|
|
59
60
|
* Set the consensus version heights.
|
|
60
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
|
|
61
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
|
|
61
62
|
*/
|
|
62
63
|
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
63
64
|
/**
|
|
@@ -72,6 +73,7 @@ export function getOrInitConsensusVersionTestHeights(heights?: string | null): A
|
|
|
72
73
|
* const maxImports = getMaxProgramImports();
|
|
73
74
|
*/
|
|
74
75
|
export function getMaxProgramImports(): number;
|
|
76
|
+
export function stringToField(string: string): Field;
|
|
75
77
|
/**
|
|
76
78
|
* Public address of an Aleo account
|
|
77
79
|
*/
|
|
Binary file
|
package/dist/mainnet/index.cjs
CHANGED
|
@@ -320,39 +320,6 @@ function addBorrowedObject(obj) {
|
|
|
320
320
|
heap[--stack_pointer] = obj;
|
|
321
321
|
return stack_pointer;
|
|
322
322
|
}
|
|
323
|
-
/**
|
|
324
|
-
* Verify a SNARK proof against a verifying key and public inputs.
|
|
325
|
-
*
|
|
326
|
-
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
327
|
-
* It directly invokes the Varuna proof verification from snarkVM.
|
|
328
|
-
*
|
|
329
|
-
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
330
|
-
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
331
|
-
* @param {Proof} proof The proof to verify
|
|
332
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
333
|
-
* @param {VerifyingKey} verifying_key
|
|
334
|
-
* @param {Array<any>} inputs
|
|
335
|
-
* @param {Proof} proof
|
|
336
|
-
* @returns {boolean}
|
|
337
|
-
*/
|
|
338
|
-
function snarkVerify(verifying_key, inputs, proof) {
|
|
339
|
-
try {
|
|
340
|
-
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
341
|
-
_assertClass(verifying_key, VerifyingKey);
|
|
342
|
-
_assertClass(proof, Proof);
|
|
343
|
-
wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
344
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
345
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
346
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
347
|
-
if (r2) {
|
|
348
|
-
throw takeObject(r1);
|
|
349
|
-
}
|
|
350
|
-
return r0 !== 0;
|
|
351
|
-
} finally {
|
|
352
|
-
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
323
|
/**
|
|
357
324
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
358
325
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -434,22 +401,35 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
|
434
401
|
}
|
|
435
402
|
|
|
436
403
|
/**
|
|
437
|
-
*
|
|
438
|
-
*
|
|
404
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
405
|
+
*
|
|
406
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
407
|
+
* It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
|
|
408
|
+
* by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
|
|
409
|
+
* an older Varuna version will fail verification.
|
|
410
|
+
*
|
|
411
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
412
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
413
|
+
* @param {Proof} proof The proof to verify
|
|
414
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
415
|
+
* @param {VerifyingKey} verifying_key
|
|
416
|
+
* @param {Array<any>} inputs
|
|
417
|
+
* @param {Proof} proof
|
|
418
|
+
* @returns {boolean}
|
|
439
419
|
*/
|
|
440
|
-
function
|
|
420
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
441
421
|
try {
|
|
442
422
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
wasm$1.
|
|
423
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
424
|
+
_assertClass(proof, Proof);
|
|
425
|
+
wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
446
426
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
447
427
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
448
428
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
449
429
|
if (r2) {
|
|
450
430
|
throw takeObject(r1);
|
|
451
431
|
}
|
|
452
|
-
return
|
|
432
|
+
return r0 !== 0;
|
|
453
433
|
} finally {
|
|
454
434
|
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
455
435
|
}
|
|
@@ -464,7 +444,7 @@ function stringToField(string) {
|
|
|
464
444
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
465
445
|
*
|
|
466
446
|
* Set the consensus version heights.
|
|
467
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18");
|
|
447
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
|
|
468
448
|
* @param {string | null} [heights]
|
|
469
449
|
* @returns {Array<any>}
|
|
470
450
|
*/
|
|
@@ -492,6 +472,28 @@ function getMaxProgramImports() {
|
|
|
492
472
|
return ret >>> 0;
|
|
493
473
|
}
|
|
494
474
|
|
|
475
|
+
/**
|
|
476
|
+
* @param {string} string
|
|
477
|
+
* @returns {Field}
|
|
478
|
+
*/
|
|
479
|
+
function stringToField(string) {
|
|
480
|
+
try {
|
|
481
|
+
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
482
|
+
const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
483
|
+
const len0 = WASM_VECTOR_LEN;
|
|
484
|
+
wasm$1.stringToField(retptr, ptr0, len0);
|
|
485
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
486
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
487
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
488
|
+
if (r2) {
|
|
489
|
+
throw takeObject(r1);
|
|
490
|
+
}
|
|
491
|
+
return Field.__wrap(r0);
|
|
492
|
+
} finally {
|
|
493
|
+
wasm$1.__wbindgen_add_to_stack_pointer(16);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
495
497
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
496
498
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
497
499
|
const mem = getDataViewMemory0();
|
|
@@ -511,16 +513,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
511
513
|
}
|
|
512
514
|
return result;
|
|
513
515
|
}
|
|
514
|
-
function
|
|
515
|
-
wasm$1.
|
|
516
|
+
function __wasm_bindgen_func_elem_9005(arg0, arg1, arg2) {
|
|
517
|
+
wasm$1.__wasm_bindgen_func_elem_9005(arg0, arg1, addHeapObject(arg2));
|
|
516
518
|
}
|
|
517
519
|
|
|
518
|
-
function
|
|
519
|
-
wasm$1.
|
|
520
|
+
function __wasm_bindgen_func_elem_7568(arg0, arg1) {
|
|
521
|
+
wasm$1.__wasm_bindgen_func_elem_7568(arg0, arg1);
|
|
520
522
|
}
|
|
521
523
|
|
|
522
|
-
function
|
|
523
|
-
wasm$1.
|
|
524
|
+
function __wasm_bindgen_func_elem_7840(arg0, arg1, arg2, arg3) {
|
|
525
|
+
wasm$1.__wasm_bindgen_func_elem_7840(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
524
526
|
}
|
|
525
527
|
|
|
526
528
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -19325,7 +19327,7 @@ function __wbg_get_imports(memory) {
|
|
|
19325
19327
|
const ret = getObject(arg0).length;
|
|
19326
19328
|
return ret;
|
|
19327
19329
|
};
|
|
19328
|
-
imports.wbg.
|
|
19330
|
+
imports.wbg.__wbg_log_c2eca570a6157825 = function(arg0, arg1) {
|
|
19329
19331
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19330
19332
|
};
|
|
19331
19333
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19343,7 +19345,7 @@ function __wbg_get_imports(memory) {
|
|
|
19343
19345
|
const a = state0.a;
|
|
19344
19346
|
state0.a = 0;
|
|
19345
19347
|
try {
|
|
19346
|
-
return
|
|
19348
|
+
return __wasm_bindgen_func_elem_7840(a, state0.b, arg0, arg1);
|
|
19347
19349
|
} finally {
|
|
19348
19350
|
state0.a = a;
|
|
19349
19351
|
}
|
|
@@ -19515,7 +19517,7 @@ function __wbg_get_imports(memory) {
|
|
|
19515
19517
|
const ret = Signature.__wrap(arg0);
|
|
19516
19518
|
return addHeapObject(ret);
|
|
19517
19519
|
};
|
|
19518
|
-
imports.wbg.
|
|
19520
|
+
imports.wbg.__wbg_spawnWorker_0d7c58b5ba9ab046 = function(arg0, arg1, arg2, arg3) {
|
|
19519
19521
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19520
19522
|
return addHeapObject(ret);
|
|
19521
19523
|
};
|
|
@@ -19597,16 +19599,16 @@ function __wbg_get_imports(memory) {
|
|
|
19597
19599
|
const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
|
|
19598
19600
|
return addHeapObject(ret);
|
|
19599
19601
|
};
|
|
19602
|
+
imports.wbg.__wbindgen_cast_201f5d8c51d6c49f = function(arg0, arg1) {
|
|
19603
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 396, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 397, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19604
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_9005);
|
|
19605
|
+
return addHeapObject(ret);
|
|
19606
|
+
};
|
|
19600
19607
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
19601
19608
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
19602
19609
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
19603
19610
|
return addHeapObject(ret);
|
|
19604
19611
|
};
|
|
19605
|
-
imports.wbg.__wbindgen_cast_2adca60326a83a78 = function(arg0, arg1) {
|
|
19606
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [], shim_idx: 528, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19607
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_7504);
|
|
19608
|
-
return addHeapObject(ret);
|
|
19609
|
-
};
|
|
19610
19612
|
imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
|
|
19611
19613
|
// Cast intrinsic for `I128 -> Externref`.
|
|
19612
19614
|
const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
|
|
@@ -19617,9 +19619,9 @@ function __wbg_get_imports(memory) {
|
|
|
19617
19619
|
const ret = BigInt.asUintN(64, arg0);
|
|
19618
19620
|
return addHeapObject(ret);
|
|
19619
19621
|
};
|
|
19620
|
-
imports.wbg.
|
|
19621
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
19622
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19622
|
+
imports.wbg.__wbindgen_cast_81f27860ba10fea8 = function(arg0, arg1) {
|
|
19623
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 396, function: Function { arguments: [Externref], shim_idx: 397, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19624
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_9005);
|
|
19623
19625
|
return addHeapObject(ret);
|
|
19624
19626
|
};
|
|
19625
19627
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19627,16 +19629,16 @@ function __wbg_get_imports(memory) {
|
|
|
19627
19629
|
const ret = arg0;
|
|
19628
19630
|
return addHeapObject(ret);
|
|
19629
19631
|
};
|
|
19630
|
-
imports.wbg.__wbindgen_cast_c048d24de4cf58bb = function(arg0, arg1) {
|
|
19631
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 395, function: Function { arguments: [Externref], shim_idx: 396, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19632
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7503, __wasm_bindgen_func_elem_8946);
|
|
19633
|
-
return addHeapObject(ret);
|
|
19634
|
-
};
|
|
19635
19632
|
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
19636
19633
|
// Cast intrinsic for `F64 -> Externref`.
|
|
19637
19634
|
const ret = arg0;
|
|
19638
19635
|
return addHeapObject(ret);
|
|
19639
19636
|
};
|
|
19637
|
+
imports.wbg.__wbindgen_cast_df4137fc329f9ddc = function(arg0, arg1) {
|
|
19638
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 396, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19639
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7567, __wasm_bindgen_func_elem_7568);
|
|
19640
|
+
return addHeapObject(ret);
|
|
19641
|
+
};
|
|
19640
19642
|
imports.wbg.__wbindgen_cast_e7b45dd881f38ce3 = function(arg0, arg1) {
|
|
19641
19643
|
// Cast intrinsic for `U128 -> Externref`.
|
|
19642
19644
|
const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
|