@provablehq/wasm 0.11.2 → 0.11.3
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 +17 -17
- package/dist/mainnet/aleo_wasm.wasm +0 -0
- package/dist/mainnet/index.cjs +53 -53
- package/dist/mainnet/index.cjs.map +1 -1
- package/dist/mainnet/index.js +53 -53
- package/dist/mainnet/index.js.map +1 -1
- package/dist/mainnet/worker.js +53 -53
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/aleo_wasm.d.ts +13 -13
- package/dist/testnet/aleo_wasm.wasm +0 -0
- package/dist/testnet/index.cjs +51 -51
- package/dist/testnet/index.cjs.map +1 -1
- package/dist/testnet/index.js +51 -51
- package/dist/testnet/index.js.map +1 -1
- package/dist/testnet/worker.js +51 -51
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,18 +9,6 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
|
|
|
9
9
|
* Values above 4 are clamped to debug.
|
|
10
10
|
*/
|
|
11
11
|
export function setWasmLogLevel(level: number): void;
|
|
12
|
-
/**
|
|
13
|
-
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
14
|
-
*
|
|
15
|
-
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
16
|
-
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
17
|
-
*
|
|
18
|
-
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
19
|
-
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
20
|
-
* @param {Proof} proof The batch proof to verify
|
|
21
|
-
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
22
|
-
*/
|
|
23
|
-
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
24
12
|
/**
|
|
25
13
|
* Verify a SNARK proof against a verifying key and public inputs.
|
|
26
14
|
*
|
|
@@ -33,6 +21,18 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
|
|
|
33
21
|
* @returns {boolean} True if the proof is valid, false otherwise
|
|
34
22
|
*/
|
|
35
23
|
export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
26
|
+
*
|
|
27
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
28
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
29
|
+
*
|
|
30
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
31
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
32
|
+
* @param {Proof} proof The batch proof to verify
|
|
33
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
34
|
+
*/
|
|
35
|
+
export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
|
|
36
36
|
/**
|
|
37
37
|
* Verify an execution. Executions with multiple transitions must have the program source code and
|
|
38
38
|
* verifying keys of imported functions supplied from outside to correctly verify. Also, this does
|
|
@@ -47,7 +47,6 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
|
|
|
47
47
|
* @returns {boolean} True if the execution is valid, false otherwise
|
|
48
48
|
*/
|
|
49
49
|
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;
|
|
50
|
-
export function stringToField(string: string): Field;
|
|
51
50
|
/**
|
|
52
51
|
* Set test consensus version heights for testing.
|
|
53
52
|
*
|
|
@@ -60,6 +59,7 @@ export function stringToField(string: string): Field;
|
|
|
60
59
|
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
|
|
61
60
|
*/
|
|
62
61
|
export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
|
|
62
|
+
export function stringToField(string: string): Field;
|
|
63
63
|
/**
|
|
64
64
|
* Public address of an Aleo account
|
|
65
65
|
*/
|
|
Binary file
|
package/dist/testnet/index.cjs
CHANGED
|
@@ -321,25 +321,26 @@ function addBorrowedObject(obj) {
|
|
|
321
321
|
return stack_pointer;
|
|
322
322
|
}
|
|
323
323
|
/**
|
|
324
|
-
* Verify a
|
|
324
|
+
* Verify a SNARK proof against a verifying key and public inputs.
|
|
325
325
|
*
|
|
326
|
-
* This function verifies a
|
|
327
|
-
*
|
|
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
328
|
*
|
|
329
|
-
* @param {
|
|
330
|
-
* @param {Array<
|
|
331
|
-
* @param {Proof} proof The
|
|
332
|
-
* @returns {boolean} True if the
|
|
333
|
-
* @param {
|
|
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
334
|
* @param {Array<any>} inputs
|
|
335
335
|
* @param {Proof} proof
|
|
336
336
|
* @returns {boolean}
|
|
337
337
|
*/
|
|
338
|
-
function
|
|
338
|
+
function snarkVerify(verifying_key, inputs, proof) {
|
|
339
339
|
try {
|
|
340
340
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
341
|
+
_assertClass(verifying_key, VerifyingKey);
|
|
341
342
|
_assertClass(proof, Proof);
|
|
342
|
-
wasm$1.
|
|
343
|
+
wasm$1.snarkVerify(retptr, verifying_key.__wbg_ptr, addHeapObject(inputs), proof.__wbg_ptr);
|
|
343
344
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
344
345
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
345
346
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -353,26 +354,25 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
|
353
354
|
}
|
|
354
355
|
|
|
355
356
|
/**
|
|
356
|
-
* Verify a SNARK proof against
|
|
357
|
+
* Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
|
|
357
358
|
*
|
|
358
|
-
* This function verifies a proof produced by
|
|
359
|
-
*
|
|
359
|
+
* This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
|
|
360
|
+
* Each verifying key is paired with one or more sets of public inputs (instances).
|
|
360
361
|
*
|
|
361
|
-
* @param {
|
|
362
|
-
* @param {Array<string
|
|
363
|
-
* @param {Proof} proof The proof to verify
|
|
364
|
-
* @returns {boolean} True if the proof is valid, false otherwise
|
|
365
|
-
* @param {
|
|
362
|
+
* @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
|
|
363
|
+
* @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
|
|
364
|
+
* @param {Proof} proof The batch proof to verify
|
|
365
|
+
* @returns {boolean} True if the batch proof is valid, false otherwise
|
|
366
|
+
* @param {Array<any>} verifying_keys
|
|
366
367
|
* @param {Array<any>} inputs
|
|
367
368
|
* @param {Proof} proof
|
|
368
369
|
* @returns {boolean}
|
|
369
370
|
*/
|
|
370
|
-
function
|
|
371
|
+
function snarkVerifyBatch(verifying_keys, inputs, proof) {
|
|
371
372
|
try {
|
|
372
373
|
const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
|
|
373
|
-
_assertClass(verifying_key, VerifyingKey);
|
|
374
374
|
_assertClass(proof, Proof);
|
|
375
|
-
wasm$1.
|
|
375
|
+
wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
|
|
376
376
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
377
377
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
378
378
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
@@ -433,6 +433,26 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
/**
|
|
437
|
+
* Set test consensus version heights for testing.
|
|
438
|
+
*
|
|
439
|
+
* @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
440
|
+
*
|
|
441
|
+
* @example
|
|
442
|
+
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
443
|
+
*
|
|
444
|
+
* Set the consensus version heights.
|
|
445
|
+
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
|
|
446
|
+
* @param {string | null} [heights]
|
|
447
|
+
* @returns {Array<any>}
|
|
448
|
+
*/
|
|
449
|
+
function getOrInitConsensusVersionTestHeights(heights) {
|
|
450
|
+
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
451
|
+
var len0 = WASM_VECTOR_LEN;
|
|
452
|
+
const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
453
|
+
return takeObject(ret);
|
|
454
|
+
}
|
|
455
|
+
|
|
436
456
|
/**
|
|
437
457
|
* @param {string} string
|
|
438
458
|
* @returns {Field}
|
|
@@ -455,26 +475,6 @@ function stringToField(string) {
|
|
|
455
475
|
}
|
|
456
476
|
}
|
|
457
477
|
|
|
458
|
-
/**
|
|
459
|
-
* Set test consensus version heights for testing.
|
|
460
|
-
*
|
|
461
|
-
* @param {string | undefined} heights The block heights at which each consensus version applies. This input should be a simple csv list of block heights and there should be one number for each consensus version. If left undefined, the default test heights will be applied.
|
|
462
|
-
*
|
|
463
|
-
* @example
|
|
464
|
-
* import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
|
|
465
|
-
*
|
|
466
|
-
* Set the consensus version heights.
|
|
467
|
-
* getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
|
|
468
|
-
* @param {string | null} [heights]
|
|
469
|
-
* @returns {Array<any>}
|
|
470
|
-
*/
|
|
471
|
-
function getOrInitConsensusVersionTestHeights(heights) {
|
|
472
|
-
var ptr0 = isLikeNone(heights) ? 0 : passStringToWasm0(heights, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
|
|
473
|
-
var len0 = WASM_VECTOR_LEN;
|
|
474
|
-
const ret = wasm$1.getOrInitConsensusVersionTestHeights(ptr0, len0);
|
|
475
|
-
return takeObject(ret);
|
|
476
|
-
}
|
|
477
|
-
|
|
478
478
|
function passArrayJsValueToWasm0(array, malloc) {
|
|
479
479
|
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
480
480
|
const mem = getDataViewMemory0();
|
|
@@ -494,16 +494,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
494
494
|
}
|
|
495
495
|
return result;
|
|
496
496
|
}
|
|
497
|
-
function
|
|
498
|
-
wasm$1.
|
|
497
|
+
function __wasm_bindgen_func_elem_7384(arg0, arg1) {
|
|
498
|
+
wasm$1.__wasm_bindgen_func_elem_7384(arg0, arg1);
|
|
499
499
|
}
|
|
500
500
|
|
|
501
501
|
function __wasm_bindgen_func_elem_8758(arg0, arg1, arg2) {
|
|
502
502
|
wasm$1.__wasm_bindgen_func_elem_8758(arg0, arg1, addHeapObject(arg2));
|
|
503
503
|
}
|
|
504
504
|
|
|
505
|
-
function
|
|
506
|
-
wasm$1.
|
|
505
|
+
function __wasm_bindgen_func_elem_7657(arg0, arg1, arg2, arg3) {
|
|
506
|
+
wasm$1.__wasm_bindgen_func_elem_7657(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
507
507
|
}
|
|
508
508
|
|
|
509
509
|
const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
|
|
@@ -19238,7 +19238,7 @@ function __wbg_get_imports(memory) {
|
|
|
19238
19238
|
const ret = getObject(arg0).length;
|
|
19239
19239
|
return ret;
|
|
19240
19240
|
};
|
|
19241
|
-
imports.wbg.
|
|
19241
|
+
imports.wbg.__wbg_log_0eaae399732a802e = function(arg0, arg1) {
|
|
19242
19242
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
19243
19243
|
};
|
|
19244
19244
|
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
@@ -19256,7 +19256,7 @@ function __wbg_get_imports(memory) {
|
|
|
19256
19256
|
const a = state0.a;
|
|
19257
19257
|
state0.a = 0;
|
|
19258
19258
|
try {
|
|
19259
|
-
return
|
|
19259
|
+
return __wasm_bindgen_func_elem_7657(a, state0.b, arg0, arg1);
|
|
19260
19260
|
} finally {
|
|
19261
19261
|
state0.a = a;
|
|
19262
19262
|
}
|
|
@@ -19428,7 +19428,7 @@ function __wbg_get_imports(memory) {
|
|
|
19428
19428
|
const ret = Signature.__wrap(arg0);
|
|
19429
19429
|
return addHeapObject(ret);
|
|
19430
19430
|
};
|
|
19431
|
-
imports.wbg.
|
|
19431
|
+
imports.wbg.__wbg_spawnWorker_3f95ae6c0630b765 = function(arg0, arg1, arg2, arg3) {
|
|
19432
19432
|
const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
|
|
19433
19433
|
return addHeapObject(ret);
|
|
19434
19434
|
};
|
|
@@ -19512,7 +19512,7 @@ function __wbg_get_imports(memory) {
|
|
|
19512
19512
|
};
|
|
19513
19513
|
imports.wbg.__wbindgen_cast_073ddd2b87fab8ab = function(arg0, arg1) {
|
|
19514
19514
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19515
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19515
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7383, __wasm_bindgen_func_elem_7384);
|
|
19516
19516
|
return addHeapObject(ret);
|
|
19517
19517
|
};
|
|
19518
19518
|
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
@@ -19522,7 +19522,7 @@ function __wbg_get_imports(memory) {
|
|
|
19522
19522
|
};
|
|
19523
19523
|
imports.wbg.__wbindgen_cast_263b62405be3c669 = function(arg0, arg1) {
|
|
19524
19524
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19525
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19525
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7383, __wasm_bindgen_func_elem_8758);
|
|
19526
19526
|
return addHeapObject(ret);
|
|
19527
19527
|
};
|
|
19528
19528
|
imports.wbg.__wbindgen_cast_2ddd8a25ff58642a = function(arg0, arg1) {
|
|
@@ -19537,7 +19537,7 @@ function __wbg_get_imports(memory) {
|
|
|
19537
19537
|
};
|
|
19538
19538
|
imports.wbg.__wbindgen_cast_5cd376b701f56c0e = function(arg0, arg1) {
|
|
19539
19539
|
// Cast intrinsic for `Closure(Closure { dtor_idx: 360, function: Function { arguments: [Externref], shim_idx: 361, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
19540
|
-
const ret = makeMutClosure(arg0, arg1, wasm$1.
|
|
19540
|
+
const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7383, __wasm_bindgen_func_elem_8758);
|
|
19541
19541
|
return addHeapObject(ret);
|
|
19542
19542
|
};
|
|
19543
19543
|
imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
|