@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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export function runRayonThread(receiver: number): void;
|
|
4
|
-
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
5
4
|
/**
|
|
6
5
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
7
6
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -9,6 +8,7 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
9
8
|
* Values above 4 are clamped to debug.
|
|
10
9
|
*/
|
|
11
10
|
export function setWasmLogLevel(level: number): void;
|
|
11
|
+
export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
14
14
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -23,6 +23,20 @@ export function setWasmLogLevel(level: number): void;
|
|
|
23
23
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
24
24
|
*/
|
|
25
25
|
export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number, program_imports?: ProgramImports | null): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
28
|
+
*
|
|
29
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
30
|
+
* It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
|
|
31
|
+
* by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
|
|
32
|
+
* an older Varuna version will fail verification.
|
|
33
|
+
*
|
|
34
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
35
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
36
|
+
* @param {Proof} proof The proof to verify
|
|
37
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
38
|
+
*/
|
|
39
|
+
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
26
40
|
/**
|
|
27
41
|
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
28
42
|
*
|
|
@@ -35,18 +49,6 @@ export function verifyFunctionExecution(execution: Execution, verifying_key: Ver
|
|
|
35
49
|
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
36
50
|
*/
|
|
37
51
|
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
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.
|
|
43
|
-
*
|
|
44
|
-
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
45
|
-
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
46
|
-
* @param {Proof} proof The proof to verify
|
|
47
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
48
|
-
*/
|
|
49
|
-
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
50
52
|
export function stringToField(string: string): Field;
|
|
51
53
|
/**
|
|
52
54
|
* Set test consensus version heights for testing.
|
|
@@ -57,7 +59,7 @@ export function stringToField(string: string): Field;
|
|
|
57
59
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
58
60
|
*
|
|
59
61
|
* 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");
|
|
62
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
|
|
61
63
|
*/
|
|
62
64
|
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
63
65
|
/**
|
|
Binary file
|
package/dist/testnet/index.cjs
CHANGED
|
@@ -292,16 +292,6 @@ function runRayonThread(receiver) {
|
|
|
292
292
|
wasm$1.runRayonThread(receiver);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
/**
|
|
296
|
-
* @param {URL} url
|
|
297
|
-
* @param {number} num_threads
|
|
298
|
-
* @returns {Promise<void>}
|
|
299
|
-
*/
|
|
300
|
-
function initThreadPool(url, num_threads) {
|
|
301
|
-
const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
|
|
302
|
-
return takeObject(ret);
|
|
303
|
-
}
|
|
304
|
-
|
|
305
295
|
/**
|
|
306
296
|
* Set the WASM log level from JS. Called automatically by the SDK's
|
|
307
297
|
* `setLogLevel(level)` to keep TS and WASM logging in sync.
|
|
@@ -313,6 +303,16 @@ function setWasmLogLevel(level) {
|
|
|
313
303
|
wasm$1.setWasmLogLevel(level);
|
|
314
304
|
}
|
|
315
305
|
|
|
306
|
+
/**
|
|
307
|
+
* @param {URL} url
|
|
308
|
+
* @param {number} num_threads
|
|
309
|
+
* @returns {Promise<void>}
|
|
310
|
+
*/
|
|
311
|
+
function initThreadPool(url, num_threads) {
|
|
312
|
+
const ret = wasm$1.initThreadPool(addHeapObject(url), num_threads);
|
|
313
|
+
return takeObject(ret);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
316
|
let stack_pointer = 128;
|
|
317
317
|
|
|
318
318
|
function addBorrowedObject(obj) {
|
|
@@ -369,25 +369,28 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
/**
|
|
372
|
-
* Verify a
|
|
372
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
373
373
|
*
|
|
374
|
-
* This function verifies a
|
|
375
|
-
*
|
|
374
|
+
* This function verifies a proof produced by an Aleo program that may not be deployed on chain.
|
|
375
|
+
* It directly invokes the Varuna proof verification from snarkVM, using the Varuna version required
|
|
376
|
+
* by the latest consensus version (Varuna V3 as of `ConsensusVersion::V21`). Proofs generated with
|
|
377
|
+
* an older Varuna version will fail verification.
|
|
376
378
|
*
|
|
377
|
-
* @param {
|
|
378
|
-
* @param {Array<
|
|
379
|
-
* @param {Proof} proof The
|
|
380
|
-
* @returns {boolean} True if the
|
|
381
|
-
* @param {
|
|
379
|
+
* @param {VerifyingKey} verifying_key The verifying key for the circuit
|
|
380
|
+
* @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
|
|
381
|
+
* @param {Proof} proof The proof to verify
|
|
382
|
+
* @returns {boolean} True if the proof is valid, false otherwise
|
|
383
|
+
* @param {VerifyingKey} verifying_key
|
|
382
384
|
* @param {Array<any>} inputs
|
|
383
385
|
* @param {Proof} proof
|
|
384
386
|
* @returns {boolean}
|
|
385
387
|
*/
|
|
386
|
-
function
|
|
388
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
387
389
|
try {
|
|
388
390
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
391
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
389
392
|
_assertClass(proof, Proof);
|
|
390
|
-
wasm$1.
|
|
393
|
+
wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
391
394
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
392
395
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
393
396
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -401,26 +404,25 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
|
401
404
|
}
|
|
402
405
|
|
|
403
406
|
/**
|
|
404
|
-
* Verify a SNARK proof against
|
|
407
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
405
408
|
*
|
|
406
|
-
* This function verifies a proof produced by
|
|
407
|
-
*
|
|
409
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
410
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
408
411
|
*
|
|
409
|
-
* @param {
|
|
410
|
-
* @param {Array<string
|
|
411
|
-
* @param {Proof} proof The proof to verify
|
|
412
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
413
|
-
* @param {
|
|
412
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
413
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
414
|
+
* @param {Proof} proof The batch proof to verify
|
|
415
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
416
|
+
* @param {Array<any>} verifying_keys
|
|
414
417
|
* @param {Array<any>} inputs
|
|
415
418
|
* @param {Proof} proof
|
|
416
419
|
* @returns {boolean}
|
|
417
420
|
*/
|
|
418
|
-
function
|
|
421
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
419
422
|
try {
|
|
420
423
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
421
|
-
_assertClass(verifying_key, VerifyingKey);
|
|
422
424
|
_assertClass(proof, Proof);
|
|
423
|
-
wasm$1.
|
|
425
|
+
wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
424
426
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
425
427
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
426
428
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -464,7 +466,7 @@ function stringToField(string) {
|
|
|
464
466
|
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
465
467
|
*
|
|
466
468
|
* 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");
|
|
469
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21");
|
|
468
470
|
* @param {string | null} [heights]
|
|
469
471
|
* @returns {Array<any>}
|
|
470
472
|
*/
|
|
@@ -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_7563(arg0, arg1) {
|
|
521
|
+
wasm$1.__wasm_bindgen_func_elem_7563(arg0, arg1);
|
|
520
522
|
}
|
|
521
523
|
|
|
522
|
-
function
|
|
523
|
-
wasm$1.
|
|
524
|
+
function __wasm_bindgen_func_elem_7835(arg0, arg1, arg2, arg3) {
|
|
525
|
+
wasm$1.__wasm_bindgen_func_elem_7835(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_7835(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,11 +19599,6 @@ function __wbg_get_imports(memory) {
|
|
|
19597
19599
|
const ret = Atomics.waitAsync(getObject(arg0), arg1 >>> 0, arg2);
|
|
19598
19600
|
return addHeapObject(ret);
|
|
19599
19601
|
};
|
|
19600
|
-
imports.wbg.__wbindgen_cast_19cdf6e41653eb6c = function(arg0, arg1) {
|
|
19601
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx: 397, function: Function { arguments: [Externref], shim_idx: 398, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19602
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7505, __wasm_bindgen_func_elem_8946);
|
|
19603
|
-
return addHeapObject(ret);
|
|
19604
|
-
};
|
|
19605
19602
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
19606
19603
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
19607
19604
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
@@ -19617,9 +19614,14 @@ function __wbg_get_imports(memory) {
|
|
|
19617
19614
|
const ret = BigInt.asUintN(64, arg0);
|
|
19618
19615
|
return addHeapObject(ret);
|
|
19619
19616
|
};
|
|
19620
|
-
imports.wbg.
|
|
19621
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
19622
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19617
|
+
imports.wbg.__wbindgen_cast_4a4bdde4030a89e7 = function(arg0, arg1) {
|
|
19618
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [], shim_idx: 533, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19619
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_7563);
|
|
19620
|
+
return addHeapObject(ret);
|
|
19621
|
+
};
|
|
19622
|
+
imports.wbg.__wbindgen_cast_994af091adc907b6 = function(arg0, arg1) {
|
|
19623
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [Externref], shim_idx: 399, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19624
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_9005);
|
|
19623
19625
|
return addHeapObject(ret);
|
|
19624
19626
|
};
|
|
19625
19627
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|
|
@@ -19637,9 +19639,9 @@ function __wbg_get_imports(memory) {
|
|
|
19637
19639
|
const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
|
|
19638
19640
|
return addHeapObject(ret);
|
|
19639
19641
|
};
|
|
19640
|
-
imports.wbg.
|
|
19641
|
-
// Cast intrinsic for `Closure(Closure { dtor_idx:
|
|
19642
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19642
|
+
imports.wbg.__wbindgen_cast_ffe78050edfd1435 = function(arg0, arg1) {
|
|
19643
|
+
// Cast intrinsic for `Closure(Closure { dtor_idx: 398, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 399, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19644
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7562, __wasm_bindgen_func_elem_9005);
|
|
19643
19645
|
return addHeapObject(ret);
|
|
19644
19646
|
};
|
|
19645
19647
|
imports.wbg.__wbindgen_link_b9f45ffe079ef2c1 = function(arg0) {
|