@aztec/noir-acvm_js 0.0.1-commit.7d4e6cd → 0.0.1-commit.9372f48
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 +82 -82
- package/nodejs/acvm_js.js +139 -139
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +15 -15
- package/package.json +3 -3
- package/web/acvm_js.d.ts +97 -97
- package/web/acvm_js.js +139 -139
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +15 -15
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,11 +1,63 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
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
|
+
/**
|
|
9
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
10
|
*
|
|
6
|
-
* @param {
|
|
11
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
12
|
+
* @returns {Uint8Array} A compressed witness map
|
|
7
13
|
*/
|
|
8
|
-
export function
|
|
14
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
17
|
+
* This should be used to only fetch the witness map for the main function.
|
|
18
|
+
*
|
|
19
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
20
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
21
|
+
*/
|
|
22
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
23
|
+
/**
|
|
24
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
25
|
+
*
|
|
26
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
27
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
28
|
+
*/
|
|
29
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
32
|
+
*
|
|
33
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
34
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
35
|
+
*/
|
|
36
|
+
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;
|
|
9
61
|
/**
|
|
10
62
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
63
|
*
|
|
@@ -34,6 +86,12 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
34
86
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
35
87
|
*/
|
|
36
88
|
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;
|
|
37
95
|
/**
|
|
38
96
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
39
97
|
*
|
|
@@ -58,64 +116,29 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
58
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
59
117
|
*/
|
|
60
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
119
|
+
|
|
120
|
+
export type StackItem = {
|
|
121
|
+
index: number;
|
|
122
|
+
witness: WitnessMap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type WitnessStack = Array<StackItem>;
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
61
129
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
67
|
-
*/
|
|
68
|
-
export function xor(lhs: string, rhs: string): string;
|
|
69
|
-
/**
|
|
70
|
-
* Sha256 compression function
|
|
71
|
-
*/
|
|
72
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
73
|
-
/**
|
|
74
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
75
|
-
*/
|
|
76
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
77
|
-
/**
|
|
78
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
79
|
-
*/
|
|
80
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
83
|
-
*/
|
|
84
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
87
|
-
*
|
|
88
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
89
|
-
* @returns {Uint8Array} A compressed witness map
|
|
90
|
-
*/
|
|
91
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
92
|
-
/**
|
|
93
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
94
|
-
* This should be used to only fetch the witness map for the main function.
|
|
95
|
-
*
|
|
96
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
97
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
98
|
-
*/
|
|
99
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
100
|
-
/**
|
|
101
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
102
|
-
*
|
|
103
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
104
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
105
|
-
*/
|
|
106
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
107
|
-
/**
|
|
108
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
109
|
-
*
|
|
110
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
111
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
112
|
-
*/
|
|
113
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
114
|
-
/**
|
|
115
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
116
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
130
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
131
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
132
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
133
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
117
134
|
*/
|
|
118
|
-
export
|
|
135
|
+
export type BuildInfo = {
|
|
136
|
+
gitHash: string;
|
|
137
|
+
version: string;
|
|
138
|
+
dirty: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
119
142
|
|
|
120
143
|
export type RawAssertionPayload = {
|
|
121
144
|
selector: string;
|
|
@@ -160,51 +183,28 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
160
183
|
|
|
161
184
|
|
|
162
185
|
|
|
163
|
-
export type StackItem = {
|
|
164
|
-
index: number;
|
|
165
|
-
witness: WitnessMap;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export type WitnessStack = Array<StackItem>;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
174
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
175
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
176
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
177
|
-
*/
|
|
178
|
-
export type BuildInfo = {
|
|
179
|
-
gitHash: string;
|
|
180
|
-
version: string;
|
|
181
|
-
dirty: string;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
186
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
-
readonly
|
|
191
|
-
readonly
|
|
192
|
-
readonly
|
|
193
|
-
readonly
|
|
194
|
-
readonly
|
|
195
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
196
|
-
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
190
|
+
readonly buildInfo: () => any;
|
|
191
|
+
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
192
|
+
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
193
|
+
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
194
|
+
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
197
195
|
readonly and: (a: any, b: any) => any;
|
|
198
196
|
readonly xor: (a: any, b: any) => any;
|
|
199
197
|
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
200
198
|
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
201
199
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
202
200
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
203
|
-
readonly
|
|
204
|
-
readonly
|
|
205
|
-
readonly
|
|
206
|
-
readonly
|
|
207
|
-
readonly
|
|
201
|
+
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
202
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
203
|
+
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
204
|
+
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 closure448_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure936_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,24 +197,39 @@ 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
|
+
}
|
|
200
208
|
|
|
201
209
|
function takeFromExternrefTable0(idx) {
|
|
202
210
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
203
211
|
wasm.__externref_table_dealloc(idx);
|
|
204
212
|
return value;
|
|
205
213
|
}
|
|
214
|
+
|
|
215
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
216
|
+
ptr = ptr >>> 0;
|
|
217
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
218
|
+
}
|
|
206
219
|
/**
|
|
207
|
-
*
|
|
220
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
208
221
|
*
|
|
209
|
-
* @param {
|
|
222
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
223
|
+
* @returns {Uint8Array} A compressed witness map
|
|
210
224
|
*/
|
|
211
|
-
export function
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
if (ret[1]) {
|
|
216
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
225
|
+
export function compressWitness(witness_map) {
|
|
226
|
+
const ret = wasm.compressWitness(witness_map);
|
|
227
|
+
if (ret[3]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
217
229
|
}
|
|
230
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
231
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
232
|
+
return v1;
|
|
218
233
|
}
|
|
219
234
|
|
|
220
235
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -224,65 +239,16 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
224
239
|
return ptr;
|
|
225
240
|
}
|
|
226
241
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
230
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
231
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
232
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
233
|
-
*/
|
|
234
|
-
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
235
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
236
|
-
const len0 = WASM_VECTOR_LEN;
|
|
237
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
238
|
-
return ret;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
243
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
244
|
-
*
|
|
245
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
246
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
247
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
248
|
-
* @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.
|
|
249
|
-
*/
|
|
250
|
-
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
251
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
252
|
-
const len0 = WASM_VECTOR_LEN;
|
|
253
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
254
|
-
return ret;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
259
|
-
*
|
|
260
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
261
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
262
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
263
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
264
|
-
*/
|
|
265
|
-
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
266
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
267
|
-
const len0 = WASM_VECTOR_LEN;
|
|
268
|
-
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
269
|
-
return ret;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
242
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
243
|
+
* This should be used to only fetch the witness map for the main function.
|
|
274
244
|
*
|
|
275
|
-
* @param {Uint8Array}
|
|
276
|
-
* @
|
|
277
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
278
|
-
* @param {Uint8Array} program
|
|
279
|
-
* @param {WitnessMap} witness_map
|
|
280
|
-
* @returns {WitnessMap}
|
|
245
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
246
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
281
247
|
*/
|
|
282
|
-
export function
|
|
283
|
-
const ptr0 = passArray8ToWasm0(
|
|
248
|
+
export function decompressWitness(compressed_witness) {
|
|
249
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
284
250
|
const len0 = WASM_VECTOR_LEN;
|
|
285
|
-
const ret = wasm.
|
|
251
|
+
const ret = wasm.decompressWitness(ptr0, len0);
|
|
286
252
|
if (ret[2]) {
|
|
287
253
|
throw takeFromExternrefTable0(ret[1]);
|
|
288
254
|
}
|
|
@@ -290,39 +256,31 @@ export function getReturnWitness(program, witness_map) {
|
|
|
290
256
|
}
|
|
291
257
|
|
|
292
258
|
/**
|
|
293
|
-
*
|
|
259
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
294
260
|
*
|
|
295
|
-
* @param {
|
|
296
|
-
* @
|
|
297
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
298
|
-
* @param {Uint8Array} program
|
|
299
|
-
* @param {WitnessMap} solved_witness
|
|
300
|
-
* @returns {WitnessMap}
|
|
261
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
262
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
301
263
|
*/
|
|
302
|
-
export function
|
|
303
|
-
const
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
if (ret[2]) {
|
|
307
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
264
|
+
export function compressWitnessStack(witness_stack) {
|
|
265
|
+
const ret = wasm.compressWitnessStack(witness_stack);
|
|
266
|
+
if (ret[3]) {
|
|
267
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
308
268
|
}
|
|
309
|
-
|
|
269
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
270
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
271
|
+
return v1;
|
|
310
272
|
}
|
|
311
273
|
|
|
312
274
|
/**
|
|
313
|
-
*
|
|
275
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
314
276
|
*
|
|
315
|
-
* @param {Uint8Array}
|
|
316
|
-
* @
|
|
317
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
318
|
-
* @param {Uint8Array} program
|
|
319
|
-
* @param {WitnessMap} solved_witness
|
|
320
|
-
* @returns {WitnessMap}
|
|
277
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
278
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
321
279
|
*/
|
|
322
|
-
export function
|
|
323
|
-
const ptr0 = passArray8ToWasm0(
|
|
280
|
+
export function decompressWitnessStack(compressed_witness) {
|
|
281
|
+
const ptr0 = passArray8ToWasm0(compressed_witness, wasm.__wbindgen_malloc);
|
|
324
282
|
const len0 = WASM_VECTOR_LEN;
|
|
325
|
-
const ret = wasm.
|
|
283
|
+
const ret = wasm.decompressWitnessStack(ptr0, len0);
|
|
326
284
|
if (ret[2]) {
|
|
327
285
|
throw takeFromExternrefTable0(ret[1]);
|
|
328
286
|
}
|
|
@@ -388,10 +346,6 @@ export function sha256_compression(inputs, state) {
|
|
|
388
346
|
return v3;
|
|
389
347
|
}
|
|
390
348
|
|
|
391
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
392
|
-
ptr = ptr >>> 0;
|
|
393
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
394
|
-
}
|
|
395
349
|
/**
|
|
396
350
|
* Calculates the Blake2s256 hash of the input bytes
|
|
397
351
|
* @param {Uint8Array} inputs
|
|
@@ -449,64 +403,99 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
449
403
|
}
|
|
450
404
|
|
|
451
405
|
/**
|
|
452
|
-
*
|
|
406
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
453
407
|
*
|
|
454
|
-
* @param {
|
|
455
|
-
* @
|
|
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.
|
|
456
412
|
*/
|
|
457
|
-
export function
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
463
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
464
|
-
return v1;
|
|
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;
|
|
465
418
|
}
|
|
466
419
|
|
|
467
420
|
/**
|
|
468
|
-
*
|
|
469
|
-
* This
|
|
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.
|
|
470
423
|
*
|
|
471
|
-
* @param {Uint8Array}
|
|
472
|
-
* @
|
|
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.
|
|
473
428
|
*/
|
|
474
|
-
export function
|
|
475
|
-
const ptr0 = passArray8ToWasm0(
|
|
429
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
430
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
476
431
|
const len0 = WASM_VECTOR_LEN;
|
|
477
|
-
const ret = wasm.
|
|
478
|
-
|
|
479
|
-
|
|
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.
|
|
443
|
+
*/
|
|
444
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
445
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
446
|
+
const len0 = WASM_VECTOR_LEN;
|
|
447
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
448
|
+
return ret;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Sets the package's logging level.
|
|
453
|
+
*
|
|
454
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
455
|
+
*/
|
|
456
|
+
export function initLogLevel(filter) {
|
|
457
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
458
|
+
const len0 = WASM_VECTOR_LEN;
|
|
459
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
460
|
+
if (ret[1]) {
|
|
461
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
480
462
|
}
|
|
481
|
-
return takeFromExternrefTable0(ret[0]);
|
|
482
463
|
}
|
|
483
464
|
|
|
484
465
|
/**
|
|
485
|
-
*
|
|
466
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
486
467
|
*
|
|
487
|
-
* @param {
|
|
488
|
-
* @
|
|
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}
|
|
489
474
|
*/
|
|
490
|
-
export function
|
|
491
|
-
const
|
|
492
|
-
|
|
493
|
-
|
|
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]);
|
|
494
481
|
}
|
|
495
|
-
|
|
496
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
497
|
-
return v1;
|
|
482
|
+
return takeFromExternrefTable0(ret[0]);
|
|
498
483
|
}
|
|
499
484
|
|
|
500
485
|
/**
|
|
501
|
-
*
|
|
486
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
502
487
|
*
|
|
503
|
-
* @param {Uint8Array}
|
|
504
|
-
* @
|
|
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}
|
|
505
494
|
*/
|
|
506
|
-
export function
|
|
507
|
-
const ptr0 = passArray8ToWasm0(
|
|
495
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
496
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
508
497
|
const len0 = WASM_VECTOR_LEN;
|
|
509
|
-
const ret = wasm.
|
|
498
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
510
499
|
if (ret[2]) {
|
|
511
500
|
throw takeFromExternrefTable0(ret[1]);
|
|
512
501
|
}
|
|
@@ -514,24 +503,35 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
514
503
|
}
|
|
515
504
|
|
|
516
505
|
/**
|
|
517
|
-
*
|
|
518
|
-
*
|
|
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}
|
|
519
514
|
*/
|
|
520
|
-
export function
|
|
521
|
-
const
|
|
522
|
-
|
|
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
523
|
}
|
|
524
524
|
|
|
525
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
|
-
wasm.
|
|
526
|
+
wasm.closure448_externref_shim(arg0, arg1, arg2);
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
async function __wbg_load(module, imports) {
|
|
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
|
|
|
797
797
|
const ret = false;
|
|
798
798
|
return ret;
|
|
799
799
|
};
|
|
800
|
-
imports.wbg.
|
|
801
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
800
|
+
imports.wbg.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
|
|
801
|
+
const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
|
|
802
802
|
return ret;
|
|
803
803
|
};
|
|
804
804
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|