@aztec/noir-acvm_js 0.0.1-commit.e6bd8901 → 0.0.1-commit.ec5f612
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 +49 -49
- package/nodejs/acvm_js.js +124 -123
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +10 -10
- package/package.json +4 -4
- package/web/acvm_js.d.ts +59 -59
- package/web/acvm_js.js +123 -122
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +10 -10
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
-
*/
|
|
7
|
-
export function buildInfo(): BuildInfo;
|
|
8
3
|
/**
|
|
9
4
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
10
5
|
*
|
|
@@ -34,30 +29,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
34
29
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
35
30
|
*/
|
|
36
31
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
37
|
-
/**
|
|
38
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
39
|
-
*/
|
|
40
|
-
export function and(lhs: string, rhs: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
43
|
-
*/
|
|
44
|
-
export function xor(lhs: string, rhs: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* Sha256 compression function
|
|
47
|
-
*/
|
|
48
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
49
|
-
/**
|
|
50
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
51
|
-
*/
|
|
52
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
53
|
-
/**
|
|
54
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
55
|
-
*/
|
|
56
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
59
|
-
*/
|
|
60
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
61
32
|
/**
|
|
62
33
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
34
|
*
|
|
@@ -86,12 +57,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
86
57
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
87
58
|
*/
|
|
88
59
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
89
|
-
/**
|
|
90
|
-
* Sets the package's logging level.
|
|
91
|
-
*
|
|
92
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
93
|
-
*/
|
|
94
|
-
export function initLogLevel(filter: string): void;
|
|
95
60
|
/**
|
|
96
61
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
97
62
|
*
|
|
@@ -116,6 +81,55 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
116
81
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
117
82
|
*/
|
|
118
83
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
84
|
+
/**
|
|
85
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
86
|
+
*/
|
|
87
|
+
export function and(lhs: string, rhs: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
90
|
+
*/
|
|
91
|
+
export function xor(lhs: string, rhs: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Sha256 compression function
|
|
94
|
+
*/
|
|
95
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
96
|
+
/**
|
|
97
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
98
|
+
*/
|
|
99
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
100
|
+
/**
|
|
101
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
102
|
+
*/
|
|
103
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
106
|
+
*/
|
|
107
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
110
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
111
|
+
*/
|
|
112
|
+
export function buildInfo(): BuildInfo;
|
|
113
|
+
/**
|
|
114
|
+
* Sets the package's logging level.
|
|
115
|
+
*
|
|
116
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
117
|
+
*/
|
|
118
|
+
export function initLogLevel(filter: string): void;
|
|
119
|
+
|
|
120
|
+
export type RawAssertionPayload = {
|
|
121
|
+
selector: string;
|
|
122
|
+
data: string[];
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type ExecutionError = Error & {
|
|
126
|
+
callStack?: string[];
|
|
127
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
128
|
+
acirFunctionId?: number;
|
|
129
|
+
brilligFunctionId?: number;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
export type StackItem = {
|
|
121
135
|
index: number;
|
|
@@ -140,20 +154,6 @@ export type BuildInfo = {
|
|
|
140
154
|
|
|
141
155
|
|
|
142
156
|
|
|
143
|
-
export type RawAssertionPayload = {
|
|
144
|
-
selector: string;
|
|
145
|
-
data: string[];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export type ExecutionError = Error & {
|
|
149
|
-
callStack?: string[];
|
|
150
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
151
|
-
acirFunctionId?: number;
|
|
152
|
-
brilligFunctionId?: number;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
157
|
// Map from witness index to hex string value of witness.
|
|
158
158
|
export type WitnessMap = Map<number, string>;
|
|
159
159
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,14 +201,6 @@ function debugString(val) {
|
|
|
201
201
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
202
202
|
return className;
|
|
203
203
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
206
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
207
|
-
*/
|
|
208
|
-
module.exports.buildInfo = function() {
|
|
209
|
-
const ret = wasm.buildInfo();
|
|
210
|
-
return ret;
|
|
211
|
-
};
|
|
212
204
|
|
|
213
205
|
function takeFromExternrefTable0(idx) {
|
|
214
206
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
@@ -291,6 +283,112 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
291
283
|
return takeFromExternrefTable0(ret[0]);
|
|
292
284
|
};
|
|
293
285
|
|
|
286
|
+
/**
|
|
287
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
288
|
+
*
|
|
289
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
290
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
291
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
292
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
293
|
+
*/
|
|
294
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
295
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
296
|
+
const len0 = WASM_VECTOR_LEN;
|
|
297
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
298
|
+
return ret;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
303
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
304
|
+
*
|
|
305
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
306
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
307
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
308
|
+
* @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.
|
|
309
|
+
*/
|
|
310
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
311
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
312
|
+
const len0 = WASM_VECTOR_LEN;
|
|
313
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
314
|
+
return ret;
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
319
|
+
*
|
|
320
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
321
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
322
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
323
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
324
|
+
*/
|
|
325
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
326
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
327
|
+
const len0 = WASM_VECTOR_LEN;
|
|
328
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
329
|
+
return ret;
|
|
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
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
344
|
+
const len0 = WASM_VECTOR_LEN;
|
|
345
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
346
|
+
if (ret[2]) {
|
|
347
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
348
|
+
}
|
|
349
|
+
return takeFromExternrefTable0(ret[0]);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
354
|
+
*
|
|
355
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
356
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
357
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
358
|
+
* @param {Uint8Array} program
|
|
359
|
+
* @param {WitnessMap} solved_witness
|
|
360
|
+
* @returns {WitnessMap}
|
|
361
|
+
*/
|
|
362
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
363
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
364
|
+
const len0 = WASM_VECTOR_LEN;
|
|
365
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
366
|
+
if (ret[2]) {
|
|
367
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
368
|
+
}
|
|
369
|
+
return takeFromExternrefTable0(ret[0]);
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
374
|
+
*
|
|
375
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
376
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
377
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
378
|
+
* @param {Uint8Array} program
|
|
379
|
+
* @param {WitnessMap} solved_witness
|
|
380
|
+
* @returns {WitnessMap}
|
|
381
|
+
*/
|
|
382
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
383
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
384
|
+
const len0 = WASM_VECTOR_LEN;
|
|
385
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
386
|
+
if (ret[2]) {
|
|
387
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
388
|
+
}
|
|
389
|
+
return takeFromExternrefTable0(ret[0]);
|
|
390
|
+
};
|
|
391
|
+
|
|
294
392
|
/**
|
|
295
393
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
296
394
|
* @param {string} lhs
|
|
@@ -407,48 +505,11 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
407
505
|
};
|
|
408
506
|
|
|
409
507
|
/**
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
413
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
414
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
415
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
416
|
-
*/
|
|
417
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
418
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
419
|
-
const len0 = WASM_VECTOR_LEN;
|
|
420
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
421
|
-
return ret;
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
426
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
427
|
-
*
|
|
428
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
429
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
430
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
431
|
-
* @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.
|
|
432
|
-
*/
|
|
433
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
434
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
435
|
-
const len0 = WASM_VECTOR_LEN;
|
|
436
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
437
|
-
return ret;
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
442
|
-
*
|
|
443
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
444
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
445
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
446
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
508
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
509
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
447
510
|
*/
|
|
448
|
-
module.exports.
|
|
449
|
-
const
|
|
450
|
-
const len0 = WASM_VECTOR_LEN;
|
|
451
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
511
|
+
module.exports.buildInfo = function() {
|
|
512
|
+
const ret = wasm.buildInfo();
|
|
452
513
|
return ret;
|
|
453
514
|
};
|
|
454
515
|
|
|
@@ -466,76 +527,16 @@ module.exports.initLogLevel = function(filter) {
|
|
|
466
527
|
}
|
|
467
528
|
};
|
|
468
529
|
|
|
469
|
-
/**
|
|
470
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
471
|
-
*
|
|
472
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
473
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
474
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
475
|
-
* @param {Uint8Array} program
|
|
476
|
-
* @param {WitnessMap} witness_map
|
|
477
|
-
* @returns {WitnessMap}
|
|
478
|
-
*/
|
|
479
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
480
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
481
|
-
const len0 = WASM_VECTOR_LEN;
|
|
482
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
483
|
-
if (ret[2]) {
|
|
484
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
485
|
-
}
|
|
486
|
-
return takeFromExternrefTable0(ret[0]);
|
|
487
|
-
};
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
491
|
-
*
|
|
492
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
493
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
494
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
495
|
-
* @param {Uint8Array} program
|
|
496
|
-
* @param {WitnessMap} solved_witness
|
|
497
|
-
* @returns {WitnessMap}
|
|
498
|
-
*/
|
|
499
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
500
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
501
|
-
const len0 = WASM_VECTOR_LEN;
|
|
502
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
503
|
-
if (ret[2]) {
|
|
504
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
505
|
-
}
|
|
506
|
-
return takeFromExternrefTable0(ret[0]);
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
511
|
-
*
|
|
512
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
513
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
514
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
515
|
-
* @param {Uint8Array} program
|
|
516
|
-
* @param {WitnessMap} solved_witness
|
|
517
|
-
* @returns {WitnessMap}
|
|
518
|
-
*/
|
|
519
|
-
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
520
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
521
|
-
const len0 = WASM_VECTOR_LEN;
|
|
522
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
523
|
-
if (ret[2]) {
|
|
524
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
525
|
-
}
|
|
526
|
-
return takeFromExternrefTable0(ret[0]);
|
|
527
|
-
};
|
|
528
|
-
|
|
529
530
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
530
|
-
wasm.
|
|
531
|
+
wasm.closure445_externref_shim(arg0, arg1, arg2);
|
|
531
532
|
}
|
|
532
533
|
|
|
533
534
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
534
|
-
wasm.
|
|
535
|
+
wasm.closure924_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
535
536
|
}
|
|
536
537
|
|
|
537
538
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
538
|
-
wasm.
|
|
539
|
+
wasm.closure928_externref_shim(arg0, arg1, arg2, arg3);
|
|
539
540
|
}
|
|
540
541
|
|
|
541
542
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -553,12 +554,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
|
|
|
553
554
|
return ret;
|
|
554
555
|
}, arguments) };
|
|
555
556
|
|
|
556
|
-
module.exports.
|
|
557
|
+
module.exports.__wbg_constructor_2b49e4454d172081 = function(arg0) {
|
|
557
558
|
const ret = new Error(arg0);
|
|
558
559
|
return ret;
|
|
559
560
|
};
|
|
560
561
|
|
|
561
|
-
module.exports.
|
|
562
|
+
module.exports.__wbg_constructor_dddf0209b25406fd = function(arg0) {
|
|
562
563
|
const ret = new Error(arg0);
|
|
563
564
|
return ret;
|
|
564
565
|
};
|
|
@@ -674,6 +675,11 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
674
675
|
}
|
|
675
676
|
};
|
|
676
677
|
|
|
678
|
+
module.exports.__wbg_new_2812f5f6a6bd8bcf = function() {
|
|
679
|
+
const ret = new Array();
|
|
680
|
+
return ret;
|
|
681
|
+
};
|
|
682
|
+
|
|
677
683
|
module.exports.__wbg_new_5e0be73521bc8c17 = function() {
|
|
678
684
|
const ret = new Map();
|
|
679
685
|
return ret;
|
|
@@ -689,8 +695,8 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
|
689
695
|
return ret;
|
|
690
696
|
};
|
|
691
697
|
|
|
692
|
-
module.exports.
|
|
693
|
-
const ret = new
|
|
698
|
+
module.exports.__wbg_new_b110592360513189 = function() {
|
|
699
|
+
const ret = new Map();
|
|
694
700
|
return ret;
|
|
695
701
|
};
|
|
696
702
|
|
|
@@ -699,11 +705,6 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
|
699
705
|
return ret;
|
|
700
706
|
};
|
|
701
707
|
|
|
702
|
-
module.exports.__wbg_new_ec40611a7805f1f0 = function() {
|
|
703
|
-
const ret = new Map();
|
|
704
|
-
return ret;
|
|
705
|
-
};
|
|
706
|
-
|
|
707
708
|
module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
708
709
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
709
710
|
return ret;
|
|
@@ -813,8 +814,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
813
814
|
return ret;
|
|
814
815
|
};
|
|
815
816
|
|
|
816
|
-
module.exports.
|
|
817
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
817
|
+
module.exports.__wbindgen_closure_wrapper1366 = function(arg0, arg1, arg2) {
|
|
818
|
+
const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
|
|
818
819
|
return ret;
|
|
819
820
|
};
|
|
820
821
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const buildInfo: () => any;
|
|
5
4
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
5
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
6
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
8
7
|
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
8
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
9
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
10
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
11
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
12
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
14
|
export const and: (a: any, b: any) => any;
|
|
10
15
|
export const xor: (a: any, b: any) => any;
|
|
11
16
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
12
17
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
13
18
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
14
19
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
15
|
-
export const
|
|
16
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
17
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
20
|
+
export const buildInfo: () => any;
|
|
18
21
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
19
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure445_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure928_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/noir-acvm_js",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.ec5f612",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
41
|
-
"@web/dev-server-esbuild": "^1.0.
|
|
41
|
+
"@web/dev-server-esbuild": "^1.0.5",
|
|
42
42
|
"@web/test-runner": "^0.20.2",
|
|
43
43
|
"@web/test-runner-playwright": "^0.11.1",
|
|
44
44
|
"chai": "^6.2.2",
|
|
45
|
-
"eslint": "^
|
|
45
|
+
"eslint": "^10.0.0",
|
|
46
46
|
"eslint-plugin-prettier": "^5.5.5",
|
|
47
47
|
"mocha": "^11.7.5",
|
|
48
|
-
"prettier": "3.8.
|
|
48
|
+
"prettier": "3.8.1",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
50
|
"typescript": "^5.8.3"
|
|
51
51
|
}
|
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
-
*/
|
|
7
|
-
export function buildInfo(): BuildInfo;
|
|
8
3
|
/**
|
|
9
4
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
10
5
|
*
|
|
@@ -34,30 +29,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
34
29
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
35
30
|
*/
|
|
36
31
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
37
|
-
/**
|
|
38
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
39
|
-
*/
|
|
40
|
-
export function and(lhs: string, rhs: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
43
|
-
*/
|
|
44
|
-
export function xor(lhs: string, rhs: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* Sha256 compression function
|
|
47
|
-
*/
|
|
48
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
49
|
-
/**
|
|
50
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
51
|
-
*/
|
|
52
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
53
|
-
/**
|
|
54
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
55
|
-
*/
|
|
56
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
59
|
-
*/
|
|
60
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
61
32
|
/**
|
|
62
33
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
34
|
*
|
|
@@ -86,12 +57,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
86
57
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
87
58
|
*/
|
|
88
59
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
89
|
-
/**
|
|
90
|
-
* Sets the package's logging level.
|
|
91
|
-
*
|
|
92
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
93
|
-
*/
|
|
94
|
-
export function initLogLevel(filter: string): void;
|
|
95
60
|
/**
|
|
96
61
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
97
62
|
*
|
|
@@ -116,6 +81,55 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
116
81
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
117
82
|
*/
|
|
118
83
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
84
|
+
/**
|
|
85
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
86
|
+
*/
|
|
87
|
+
export function and(lhs: string, rhs: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
90
|
+
*/
|
|
91
|
+
export function xor(lhs: string, rhs: string): string;
|
|
92
|
+
/**
|
|
93
|
+
* Sha256 compression function
|
|
94
|
+
*/
|
|
95
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
96
|
+
/**
|
|
97
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
98
|
+
*/
|
|
99
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
100
|
+
/**
|
|
101
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
102
|
+
*/
|
|
103
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
106
|
+
*/
|
|
107
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
110
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
111
|
+
*/
|
|
112
|
+
export function buildInfo(): BuildInfo;
|
|
113
|
+
/**
|
|
114
|
+
* Sets the package's logging level.
|
|
115
|
+
*
|
|
116
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
117
|
+
*/
|
|
118
|
+
export function initLogLevel(filter: string): void;
|
|
119
|
+
|
|
120
|
+
export type RawAssertionPayload = {
|
|
121
|
+
selector: string;
|
|
122
|
+
data: string[];
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export type ExecutionError = Error & {
|
|
126
|
+
callStack?: string[];
|
|
127
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
128
|
+
acirFunctionId?: number;
|
|
129
|
+
brilligFunctionId?: number;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
export type StackItem = {
|
|
121
135
|
index: number;
|
|
@@ -140,20 +154,6 @@ export type BuildInfo = {
|
|
|
140
154
|
|
|
141
155
|
|
|
142
156
|
|
|
143
|
-
export type RawAssertionPayload = {
|
|
144
|
-
selector: string;
|
|
145
|
-
data: string[];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export type ExecutionError = Error & {
|
|
149
|
-
callStack?: string[];
|
|
150
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
151
|
-
acirFunctionId?: number;
|
|
152
|
-
brilligFunctionId?: number;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
157
|
// Map from witness index to hex string value of witness.
|
|
158
158
|
export type WitnessMap = Map<number, string>;
|
|
159
159
|
|
|
@@ -187,24 +187,24 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
-
readonly buildInfo: () => any;
|
|
191
190
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
192
191
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
193
192
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
194
193
|
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
194
|
+
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
195
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
196
|
+
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
197
|
+
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
198
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
199
|
+
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
195
200
|
readonly and: (a: any, b: any) => any;
|
|
196
201
|
readonly xor: (a: any, b: any) => any;
|
|
197
202
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
198
203
|
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
199
204
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
200
205
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
201
|
-
readonly
|
|
202
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
203
|
-
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
206
|
+
readonly buildInfo: () => any;
|
|
204
207
|
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
205
|
-
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
206
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
207
|
-
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
208
208
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
209
209
|
readonly __externref_table_alloc: () => number;
|
|
210
210
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -213,9 +213,9 @@ export interface InitOutput {
|
|
|
213
213
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
214
214
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
215
215
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
218
|
-
readonly
|
|
216
|
+
readonly closure445_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure928_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
219
219
|
readonly __wbindgen_start: () => void;
|
|
220
220
|
}
|
|
221
221
|
|
package/web/acvm_js.js
CHANGED
|
@@ -197,14 +197,6 @@ function debugString(val) {
|
|
|
197
197
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
198
198
|
return className;
|
|
199
199
|
}
|
|
200
|
-
/**
|
|
201
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
202
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
203
|
-
*/
|
|
204
|
-
export function buildInfo() {
|
|
205
|
-
const ret = wasm.buildInfo();
|
|
206
|
-
return ret;
|
|
207
|
-
}
|
|
208
200
|
|
|
209
201
|
function takeFromExternrefTable0(idx) {
|
|
210
202
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
@@ -287,6 +279,112 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
287
279
|
return takeFromExternrefTable0(ret[0]);
|
|
288
280
|
}
|
|
289
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
284
|
+
*
|
|
285
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
286
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
287
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
288
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
289
|
+
*/
|
|
290
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
291
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
292
|
+
const len0 = WASM_VECTOR_LEN;
|
|
293
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
294
|
+
return ret;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
299
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
300
|
+
*
|
|
301
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
302
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
303
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
304
|
+
* @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.
|
|
305
|
+
*/
|
|
306
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
307
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
308
|
+
const len0 = WASM_VECTOR_LEN;
|
|
309
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
310
|
+
return ret;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
315
|
+
*
|
|
316
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
317
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
318
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
319
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
320
|
+
*/
|
|
321
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
322
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
323
|
+
const len0 = WASM_VECTOR_LEN;
|
|
324
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
325
|
+
return ret;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
330
|
+
*
|
|
331
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
332
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
333
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
334
|
+
* @param {Uint8Array} program
|
|
335
|
+
* @param {WitnessMap} witness_map
|
|
336
|
+
* @returns {WitnessMap}
|
|
337
|
+
*/
|
|
338
|
+
export function getReturnWitness(program, witness_map) {
|
|
339
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
342
|
+
if (ret[2]) {
|
|
343
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
344
|
+
}
|
|
345
|
+
return takeFromExternrefTable0(ret[0]);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
350
|
+
*
|
|
351
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
352
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
353
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
354
|
+
* @param {Uint8Array} program
|
|
355
|
+
* @param {WitnessMap} solved_witness
|
|
356
|
+
* @returns {WitnessMap}
|
|
357
|
+
*/
|
|
358
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
359
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
360
|
+
const len0 = WASM_VECTOR_LEN;
|
|
361
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
362
|
+
if (ret[2]) {
|
|
363
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
364
|
+
}
|
|
365
|
+
return takeFromExternrefTable0(ret[0]);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
370
|
+
*
|
|
371
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
372
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
373
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
374
|
+
* @param {Uint8Array} program
|
|
375
|
+
* @param {WitnessMap} solved_witness
|
|
376
|
+
* @returns {WitnessMap}
|
|
377
|
+
*/
|
|
378
|
+
export function getPublicWitness(program, solved_witness) {
|
|
379
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
380
|
+
const len0 = WASM_VECTOR_LEN;
|
|
381
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
382
|
+
if (ret[2]) {
|
|
383
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
384
|
+
}
|
|
385
|
+
return takeFromExternrefTable0(ret[0]);
|
|
386
|
+
}
|
|
387
|
+
|
|
290
388
|
/**
|
|
291
389
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
292
390
|
* @param {string} lhs
|
|
@@ -403,48 +501,11 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
403
501
|
}
|
|
404
502
|
|
|
405
503
|
/**
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
409
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
410
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
411
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
412
|
-
*/
|
|
413
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
414
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
415
|
-
const len0 = WASM_VECTOR_LEN;
|
|
416
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
417
|
-
return ret;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
422
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
423
|
-
*
|
|
424
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
425
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
426
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
427
|
-
* @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.
|
|
428
|
-
*/
|
|
429
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
430
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
431
|
-
const len0 = WASM_VECTOR_LEN;
|
|
432
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
433
|
-
return ret;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
438
|
-
*
|
|
439
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
440
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
441
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
442
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
504
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
505
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
443
506
|
*/
|
|
444
|
-
export function
|
|
445
|
-
const
|
|
446
|
-
const len0 = WASM_VECTOR_LEN;
|
|
447
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
507
|
+
export function buildInfo() {
|
|
508
|
+
const ret = wasm.buildInfo();
|
|
448
509
|
return ret;
|
|
449
510
|
}
|
|
450
511
|
|
|
@@ -462,76 +523,16 @@ export function initLogLevel(filter) {
|
|
|
462
523
|
}
|
|
463
524
|
}
|
|
464
525
|
|
|
465
|
-
/**
|
|
466
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
467
|
-
*
|
|
468
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
469
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
470
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
471
|
-
* @param {Uint8Array} program
|
|
472
|
-
* @param {WitnessMap} witness_map
|
|
473
|
-
* @returns {WitnessMap}
|
|
474
|
-
*/
|
|
475
|
-
export function getReturnWitness(program, witness_map) {
|
|
476
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
477
|
-
const len0 = WASM_VECTOR_LEN;
|
|
478
|
-
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
479
|
-
if (ret[2]) {
|
|
480
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
481
|
-
}
|
|
482
|
-
return takeFromExternrefTable0(ret[0]);
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
487
|
-
*
|
|
488
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
489
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
490
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
491
|
-
* @param {Uint8Array} program
|
|
492
|
-
* @param {WitnessMap} solved_witness
|
|
493
|
-
* @returns {WitnessMap}
|
|
494
|
-
*/
|
|
495
|
-
export function getPublicParametersWitness(program, solved_witness) {
|
|
496
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
497
|
-
const len0 = WASM_VECTOR_LEN;
|
|
498
|
-
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
499
|
-
if (ret[2]) {
|
|
500
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
501
|
-
}
|
|
502
|
-
return takeFromExternrefTable0(ret[0]);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
507
|
-
*
|
|
508
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
509
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
510
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
511
|
-
* @param {Uint8Array} program
|
|
512
|
-
* @param {WitnessMap} solved_witness
|
|
513
|
-
* @returns {WitnessMap}
|
|
514
|
-
*/
|
|
515
|
-
export function getPublicWitness(program, solved_witness) {
|
|
516
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
517
|
-
const len0 = WASM_VECTOR_LEN;
|
|
518
|
-
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
519
|
-
if (ret[2]) {
|
|
520
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
521
|
-
}
|
|
522
|
-
return takeFromExternrefTable0(ret[0]);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
526
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
|
-
wasm.
|
|
527
|
+
wasm.closure445_externref_shim(arg0, arg1, arg2);
|
|
527
528
|
}
|
|
528
529
|
|
|
529
530
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
531
|
+
wasm.closure924_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
531
532
|
}
|
|
532
533
|
|
|
533
534
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
534
|
-
wasm.
|
|
535
|
+
wasm.closure928_externref_shim(arg0, arg1, arg2, arg3);
|
|
535
536
|
}
|
|
536
537
|
|
|
537
538
|
async function __wbg_load(module, imports) {
|
|
@@ -580,11 +581,11 @@ function __wbg_get_imports() {
|
|
|
580
581
|
const ret = arg0.call(arg1, arg2, arg3);
|
|
581
582
|
return ret;
|
|
582
583
|
}, arguments) };
|
|
583
|
-
imports.wbg.
|
|
584
|
+
imports.wbg.__wbg_constructor_2b49e4454d172081 = function(arg0) {
|
|
584
585
|
const ret = new Error(arg0);
|
|
585
586
|
return ret;
|
|
586
587
|
};
|
|
587
|
-
imports.wbg.
|
|
588
|
+
imports.wbg.__wbg_constructor_dddf0209b25406fd = function(arg0) {
|
|
588
589
|
const ret = new Error(arg0);
|
|
589
590
|
return ret;
|
|
590
591
|
};
|
|
@@ -685,6 +686,10 @@ function __wbg_get_imports() {
|
|
|
685
686
|
state0.a = state0.b = 0;
|
|
686
687
|
}
|
|
687
688
|
};
|
|
689
|
+
imports.wbg.__wbg_new_2812f5f6a6bd8bcf = function() {
|
|
690
|
+
const ret = new Array();
|
|
691
|
+
return ret;
|
|
692
|
+
};
|
|
688
693
|
imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
|
|
689
694
|
const ret = new Map();
|
|
690
695
|
return ret;
|
|
@@ -697,18 +702,14 @@ function __wbg_get_imports() {
|
|
|
697
702
|
const ret = new Error();
|
|
698
703
|
return ret;
|
|
699
704
|
};
|
|
700
|
-
imports.wbg.
|
|
701
|
-
const ret = new
|
|
705
|
+
imports.wbg.__wbg_new_b110592360513189 = function() {
|
|
706
|
+
const ret = new Map();
|
|
702
707
|
return ret;
|
|
703
708
|
};
|
|
704
709
|
imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
705
710
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
706
711
|
return ret;
|
|
707
712
|
};
|
|
708
|
-
imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
|
|
709
|
-
const ret = new Map();
|
|
710
|
-
return ret;
|
|
711
|
-
};
|
|
712
713
|
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
713
714
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
714
715
|
return ret;
|
|
@@ -797,8 +798,8 @@ function __wbg_get_imports() {
|
|
|
797
798
|
const ret = false;
|
|
798
799
|
return ret;
|
|
799
800
|
};
|
|
800
|
-
imports.wbg.
|
|
801
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
801
|
+
imports.wbg.__wbindgen_closure_wrapper1366 = function(arg0, arg1, arg2) {
|
|
802
|
+
const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
|
|
802
803
|
return ret;
|
|
803
804
|
};
|
|
804
805
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const buildInfo: () => any;
|
|
5
4
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
5
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
6
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
8
7
|
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
8
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
9
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
10
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
11
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
12
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
14
|
export const and: (a: any, b: any) => any;
|
|
10
15
|
export const xor: (a: any, b: any) => any;
|
|
11
16
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
12
17
|
export const blake2s256: (a: number, b: number) => [number, number];
|
|
13
18
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
14
19
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
15
|
-
export const
|
|
16
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
17
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
20
|
+
export const buildInfo: () => any;
|
|
18
21
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
19
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure445_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure928_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|