@noir-lang/acvm_js 0.47.0 → 0.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nodejs/acvm_js.d.ts +51 -51
- package/nodejs/acvm_js.js +119 -119
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +4 -4
- package/package.json +1 -1
- package/web/acvm_js.d.ts +55 -55
- package/web/acvm_js.js +115 -115
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +4 -4
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
10
|
-
*/
|
|
11
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
12
|
-
/**
|
|
13
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
15
|
-
*
|
|
16
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
-
* @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.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
22
|
-
/**
|
|
23
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
4
|
+
* Sets the package's logging level.
|
|
24
5
|
*
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
6
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
29
7
|
*/
|
|
30
|
-
export function
|
|
8
|
+
export function initLogLevel(filter: string): void;
|
|
31
9
|
/**
|
|
32
10
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
33
11
|
*
|
|
@@ -62,11 +40,33 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
62
40
|
*/
|
|
63
41
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
64
42
|
/**
|
|
65
|
-
*
|
|
43
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
66
44
|
*
|
|
67
|
-
* @param {
|
|
45
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
46
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
47
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
48
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
68
49
|
*/
|
|
69
|
-
export function
|
|
50
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
54
|
+
*
|
|
55
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
57
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
58
|
+
* @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.
|
|
59
|
+
*/
|
|
60
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
61
|
+
/**
|
|
62
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
|
+
*
|
|
64
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
65
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
66
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
67
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
68
|
+
*/
|
|
69
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
70
70
|
/**
|
|
71
71
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
72
72
|
* @param {string} lhs
|
|
@@ -163,21 +163,6 @@ export type ExecutionError = Error & {
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
// Map from witness index to hex string value of witness.
|
|
167
|
-
export type WitnessMap = Map<number, string>;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* An execution result containing two witnesses.
|
|
171
|
-
* 1. The full solved witness of the execution.
|
|
172
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
173
|
-
*/
|
|
174
|
-
export type SolvedAndReturnWitness = {
|
|
175
|
-
solvedWitness: WitnessMap;
|
|
176
|
-
returnWitness: WitnessMap;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
166
|
export type StackItem = {
|
|
182
167
|
index: number;
|
|
183
168
|
witness: WitnessMap;
|
|
@@ -187,6 +172,20 @@ export type WitnessStack = Array<StackItem>;
|
|
|
187
172
|
|
|
188
173
|
|
|
189
174
|
|
|
175
|
+
/**
|
|
176
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
177
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
178
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
179
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
180
|
+
*/
|
|
181
|
+
export type BuildInfo = {
|
|
182
|
+
gitHash: string;
|
|
183
|
+
version: string;
|
|
184
|
+
dirty: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
190
189
|
export type ForeignCallInput = string[]
|
|
191
190
|
export type ForeignCallOutput = string | string[]
|
|
192
191
|
|
|
@@ -201,16 +200,17 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
201
200
|
|
|
202
201
|
|
|
203
202
|
|
|
203
|
+
// Map from witness index to hex string value of witness.
|
|
204
|
+
export type WitnessMap = Map<number, string>;
|
|
205
|
+
|
|
204
206
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
207
|
+
* An execution result containing two witnesses.
|
|
208
|
+
* 1. The full solved witness of the execution.
|
|
209
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
209
210
|
*/
|
|
210
|
-
export type
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
dirty: string;
|
|
211
|
+
export type SolvedAndReturnWitness = {
|
|
212
|
+
solvedWitness: WitnessMap;
|
|
213
|
+
returnWitness: WitnessMap;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -23,6 +23,28 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
function isLikeNone(x) {
|
|
27
|
+
return x === undefined || x === null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
let cachedFloat64Memory0 = null;
|
|
31
|
+
|
|
32
|
+
function getFloat64Memory0() {
|
|
33
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
34
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
35
|
+
}
|
|
36
|
+
return cachedFloat64Memory0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let cachedInt32Memory0 = null;
|
|
40
|
+
|
|
41
|
+
function getInt32Memory0() {
|
|
42
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
43
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
44
|
+
}
|
|
45
|
+
return cachedInt32Memory0;
|
|
46
|
+
}
|
|
47
|
+
|
|
26
48
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
27
49
|
|
|
28
50
|
cachedTextDecoder.decode();
|
|
@@ -105,28 +127,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
105
127
|
return ptr;
|
|
106
128
|
}
|
|
107
129
|
|
|
108
|
-
function isLikeNone(x) {
|
|
109
|
-
return x === undefined || x === null;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
let cachedInt32Memory0 = null;
|
|
113
|
-
|
|
114
|
-
function getInt32Memory0() {
|
|
115
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
116
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
117
|
-
}
|
|
118
|
-
return cachedInt32Memory0;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
let cachedFloat64Memory0 = null;
|
|
122
|
-
|
|
123
|
-
function getFloat64Memory0() {
|
|
124
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
125
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
126
|
-
}
|
|
127
|
-
return cachedFloat64Memory0;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
130
|
function debugString(val) {
|
|
131
131
|
// primitive types
|
|
132
132
|
const type = typeof val;
|
|
@@ -220,58 +220,33 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
220
220
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Sets the package's logging level.
|
|
225
|
+
*
|
|
226
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
227
|
+
*/
|
|
228
|
+
module.exports.initLogLevel = function(filter) {
|
|
229
|
+
try {
|
|
230
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
231
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
232
|
+
const len0 = WASM_VECTOR_LEN;
|
|
233
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
234
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
235
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
236
|
+
if (r1) {
|
|
237
|
+
throw takeObject(r0);
|
|
238
|
+
}
|
|
239
|
+
} finally {
|
|
240
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
223
244
|
function passArray8ToWasm0(arg, malloc) {
|
|
224
245
|
const ptr = malloc(arg.length * 1) >>> 0;
|
|
225
246
|
getUint8Memory0().set(arg, ptr / 1);
|
|
226
247
|
WASM_VECTOR_LEN = arg.length;
|
|
227
248
|
return ptr;
|
|
228
249
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
231
|
-
*
|
|
232
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
233
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
234
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
235
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
236
|
-
*/
|
|
237
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
238
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
239
|
-
const len0 = WASM_VECTOR_LEN;
|
|
240
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
241
|
-
return takeObject(ret);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
246
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
247
|
-
*
|
|
248
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
249
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
250
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
251
|
-
* @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.
|
|
252
|
-
*/
|
|
253
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
254
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
255
|
-
const len0 = WASM_VECTOR_LEN;
|
|
256
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
257
|
-
return takeObject(ret);
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
262
|
-
*
|
|
263
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
264
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
265
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
266
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
267
|
-
*/
|
|
268
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
269
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
270
|
-
const len0 = WASM_VECTOR_LEN;
|
|
271
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
272
|
-
return takeObject(ret);
|
|
273
|
-
};
|
|
274
|
-
|
|
275
250
|
/**
|
|
276
251
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
277
252
|
*
|
|
@@ -357,24 +332,49 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
357
332
|
};
|
|
358
333
|
|
|
359
334
|
/**
|
|
360
|
-
*
|
|
335
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
361
336
|
*
|
|
362
|
-
* @param {
|
|
337
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
338
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
339
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
340
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
363
341
|
*/
|
|
364
|
-
module.exports.
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
342
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
343
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
344
|
+
const len0 = WASM_VECTOR_LEN;
|
|
345
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
346
|
+
return takeObject(ret);
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
351
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
352
|
+
*
|
|
353
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
354
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
355
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
356
|
+
* @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.
|
|
357
|
+
*/
|
|
358
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
359
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
360
|
+
const len0 = WASM_VECTOR_LEN;
|
|
361
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
362
|
+
return takeObject(ret);
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
367
|
+
*
|
|
368
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
369
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
370
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
371
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
372
|
+
*/
|
|
373
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
374
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
375
|
+
const len0 = WASM_VECTOR_LEN;
|
|
376
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
377
|
+
return takeObject(ret);
|
|
378
378
|
};
|
|
379
379
|
|
|
380
380
|
/**
|
|
@@ -631,12 +631,29 @@ function __wbg_adapter_93(arg0, arg1, arg2, arg3) {
|
|
|
631
631
|
wasm.wasm_bindgen__convert__closures__invoke2_mut__h4efdd1050cfb3ea7(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
632
632
|
}
|
|
633
633
|
|
|
634
|
+
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
635
|
+
const obj = takeObject(arg0).original;
|
|
636
|
+
if (obj.cnt-- == 1) {
|
|
637
|
+
obj.a = 0;
|
|
638
|
+
return true;
|
|
639
|
+
}
|
|
640
|
+
const ret = false;
|
|
641
|
+
return ret;
|
|
642
|
+
};
|
|
643
|
+
|
|
634
644
|
module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
635
645
|
takeObject(arg0);
|
|
636
646
|
};
|
|
637
647
|
|
|
638
|
-
module.exports.
|
|
639
|
-
const
|
|
648
|
+
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
649
|
+
const obj = getObject(arg1);
|
|
650
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
651
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
652
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
module.exports.__wbg_constructor_a4e1fbe49b64399a = function(arg0) {
|
|
656
|
+
const ret = new Error(takeObject(arg0));
|
|
640
657
|
return addHeapObject(ret);
|
|
641
658
|
};
|
|
642
659
|
|
|
@@ -645,13 +662,18 @@ module.exports.__wbindgen_is_array = function(arg0) {
|
|
|
645
662
|
return ret;
|
|
646
663
|
};
|
|
647
664
|
|
|
648
|
-
module.exports.
|
|
649
|
-
const ret =
|
|
665
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
666
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
667
|
+
return ret;
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
671
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
650
672
|
return addHeapObject(ret);
|
|
651
673
|
};
|
|
652
674
|
|
|
653
|
-
module.exports.
|
|
654
|
-
const ret = new
|
|
675
|
+
module.exports.__wbg_new_99fb929611321a93 = function() {
|
|
676
|
+
const ret = new Array();
|
|
655
677
|
return addHeapObject(ret);
|
|
656
678
|
};
|
|
657
679
|
|
|
@@ -660,6 +682,11 @@ module.exports.__wbindgen_number_new = function(arg0) {
|
|
|
660
682
|
return addHeapObject(ret);
|
|
661
683
|
};
|
|
662
684
|
|
|
685
|
+
module.exports.__wbg_new_237eb36a3bda602b = function() {
|
|
686
|
+
const ret = new Map();
|
|
687
|
+
return addHeapObject(ret);
|
|
688
|
+
};
|
|
689
|
+
|
|
663
690
|
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
664
691
|
const obj = getObject(arg1);
|
|
665
692
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -669,33 +696,6 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
|
669
696
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
670
697
|
};
|
|
671
698
|
|
|
672
|
-
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
673
|
-
const obj = getObject(arg1);
|
|
674
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
675
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
676
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
677
|
-
};
|
|
678
|
-
|
|
679
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
680
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
681
|
-
return ret;
|
|
682
|
-
};
|
|
683
|
-
|
|
684
|
-
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
685
|
-
const obj = takeObject(arg0).original;
|
|
686
|
-
if (obj.cnt-- == 1) {
|
|
687
|
-
obj.a = 0;
|
|
688
|
-
return true;
|
|
689
|
-
}
|
|
690
|
-
const ret = false;
|
|
691
|
-
return ret;
|
|
692
|
-
};
|
|
693
|
-
|
|
694
|
-
module.exports.__wbg_new_f139361aad331bd0 = function() {
|
|
695
|
-
const ret = new Array();
|
|
696
|
-
return addHeapObject(ret);
|
|
697
|
-
};
|
|
698
|
-
|
|
699
699
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
700
700
|
const ret = new Error();
|
|
701
701
|
return addHeapObject(ret);
|
|
@@ -914,8 +914,8 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
914
914
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
915
915
|
};
|
|
916
916
|
|
|
917
|
-
module.exports.
|
|
918
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
917
|
+
module.exports.__wbindgen_closure_wrapper759 = function(arg0, arg1, arg2) {
|
|
918
|
+
const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
|
|
919
919
|
return addHeapObject(ret);
|
|
920
920
|
};
|
|
921
921
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
5
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
4
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
7
5
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
8
6
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
9
7
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
10
|
-
export function
|
|
8
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
9
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
10
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
11
11
|
export function and(a: number, b: number): number;
|
|
12
12
|
export function xor(a: number, b: number): number;
|
|
13
13
|
export function sha256(a: number, b: number, c: number): void;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
7
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
8
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
9
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
10
|
-
*/
|
|
11
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
12
|
-
/**
|
|
13
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
14
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
15
|
-
*
|
|
16
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
17
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
18
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
19
|
-
* @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.
|
|
20
|
-
*/
|
|
21
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
22
|
-
/**
|
|
23
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
4
|
+
* Sets the package's logging level.
|
|
24
5
|
*
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
27
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
28
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
6
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
29
7
|
*/
|
|
30
|
-
export function
|
|
8
|
+
export function initLogLevel(filter: string): void;
|
|
31
9
|
/**
|
|
32
10
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
33
11
|
*
|
|
@@ -62,11 +40,33 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
62
40
|
*/
|
|
63
41
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
64
42
|
/**
|
|
65
|
-
*
|
|
43
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
66
44
|
*
|
|
67
|
-
* @param {
|
|
45
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
46
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
47
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
48
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
68
49
|
*/
|
|
69
|
-
export function
|
|
50
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
51
|
+
/**
|
|
52
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
54
|
+
*
|
|
55
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
57
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
58
|
+
* @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.
|
|
59
|
+
*/
|
|
60
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
61
|
+
/**
|
|
62
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
63
|
+
*
|
|
64
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
65
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
66
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
67
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
68
|
+
*/
|
|
69
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
70
70
|
/**
|
|
71
71
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
72
72
|
* @param {string} lhs
|
|
@@ -163,21 +163,6 @@ export type ExecutionError = Error & {
|
|
|
163
163
|
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
// Map from witness index to hex string value of witness.
|
|
167
|
-
export type WitnessMap = Map<number, string>;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* An execution result containing two witnesses.
|
|
171
|
-
* 1. The full solved witness of the execution.
|
|
172
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
173
|
-
*/
|
|
174
|
-
export type SolvedAndReturnWitness = {
|
|
175
|
-
solvedWitness: WitnessMap;
|
|
176
|
-
returnWitness: WitnessMap;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
166
|
export type StackItem = {
|
|
182
167
|
index: number;
|
|
183
168
|
witness: WitnessMap;
|
|
@@ -187,6 +172,20 @@ export type WitnessStack = Array<StackItem>;
|
|
|
187
172
|
|
|
188
173
|
|
|
189
174
|
|
|
175
|
+
/**
|
|
176
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
177
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
178
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
179
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
180
|
+
*/
|
|
181
|
+
export type BuildInfo = {
|
|
182
|
+
gitHash: string;
|
|
183
|
+
version: string;
|
|
184
|
+
dirty: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
190
189
|
export type ForeignCallInput = string[]
|
|
191
190
|
export type ForeignCallOutput = string | string[]
|
|
192
191
|
|
|
@@ -201,16 +200,17 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
201
200
|
|
|
202
201
|
|
|
203
202
|
|
|
203
|
+
// Map from witness index to hex string value of witness.
|
|
204
|
+
export type WitnessMap = Map<number, string>;
|
|
205
|
+
|
|
204
206
|
/**
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
207
|
+
* An execution result containing two witnesses.
|
|
208
|
+
* 1. The full solved witness of the execution.
|
|
209
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
209
210
|
*/
|
|
210
|
-
export type
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
dirty: string;
|
|
211
|
+
export type SolvedAndReturnWitness = {
|
|
212
|
+
solvedWitness: WitnessMap;
|
|
213
|
+
returnWitness: WitnessMap;
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
|
|
@@ -219,13 +219,13 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
219
219
|
|
|
220
220
|
export interface InitOutput {
|
|
221
221
|
readonly memory: WebAssembly.Memory;
|
|
222
|
-
readonly
|
|
223
|
-
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
224
|
-
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
222
|
+
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
225
223
|
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
226
224
|
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
227
225
|
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
228
|
-
readonly
|
|
226
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
227
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
228
|
+
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
229
229
|
readonly and: (a: number, b: number) => number;
|
|
230
230
|
readonly xor: (a: number, b: number) => number;
|
|
231
231
|
readonly sha256: (a: number, b: number, c: number) => void;
|
package/web/acvm_js.js
CHANGED
|
@@ -20,6 +20,28 @@ function takeObject(idx) {
|
|
|
20
20
|
return ret;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
function isLikeNone(x) {
|
|
24
|
+
return x === undefined || x === null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let cachedFloat64Memory0 = null;
|
|
28
|
+
|
|
29
|
+
function getFloat64Memory0() {
|
|
30
|
+
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
31
|
+
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
32
|
+
}
|
|
33
|
+
return cachedFloat64Memory0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let cachedInt32Memory0 = null;
|
|
37
|
+
|
|
38
|
+
function getInt32Memory0() {
|
|
39
|
+
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
40
|
+
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
41
|
+
}
|
|
42
|
+
return cachedInt32Memory0;
|
|
43
|
+
}
|
|
44
|
+
|
|
23
45
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
24
46
|
|
|
25
47
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
@@ -102,28 +124,6 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
102
124
|
return ptr;
|
|
103
125
|
}
|
|
104
126
|
|
|
105
|
-
function isLikeNone(x) {
|
|
106
|
-
return x === undefined || x === null;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
let cachedInt32Memory0 = null;
|
|
110
|
-
|
|
111
|
-
function getInt32Memory0() {
|
|
112
|
-
if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
|
|
113
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
114
|
-
}
|
|
115
|
-
return cachedInt32Memory0;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
let cachedFloat64Memory0 = null;
|
|
119
|
-
|
|
120
|
-
function getFloat64Memory0() {
|
|
121
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
122
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
123
|
-
}
|
|
124
|
-
return cachedFloat64Memory0;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
127
|
function debugString(val) {
|
|
128
128
|
// primitive types
|
|
129
129
|
const type = typeof val;
|
|
@@ -217,58 +217,33 @@ function __wbg_adapter_22(arg0, arg1, arg2) {
|
|
|
217
217
|
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h36bac5ff3ea3c380(arg0, arg1, addHeapObject(arg2));
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
221
|
-
const ptr = malloc(arg.length * 1) >>> 0;
|
|
222
|
-
getUint8Memory0().set(arg, ptr / 1);
|
|
223
|
-
WASM_VECTOR_LEN = arg.length;
|
|
224
|
-
return ptr;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
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, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
238
|
-
return takeObject(ret);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
220
|
/**
|
|
242
|
-
*
|
|
243
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
221
|
+
* Sets the package's logging level.
|
|
244
222
|
*
|
|
245
|
-
* @param {
|
|
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.
|
|
223
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
249
224
|
*/
|
|
250
|
-
export function
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
225
|
+
export function initLogLevel(filter) {
|
|
226
|
+
try {
|
|
227
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
228
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
230
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
231
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
232
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
233
|
+
if (r1) {
|
|
234
|
+
throw takeObject(r0);
|
|
235
|
+
}
|
|
236
|
+
} finally {
|
|
237
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
238
|
+
}
|
|
255
239
|
}
|
|
256
240
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
269
|
-
return takeObject(ret);
|
|
241
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
242
|
+
const ptr = malloc(arg.length * 1) >>> 0;
|
|
243
|
+
getUint8Memory0().set(arg, ptr / 1);
|
|
244
|
+
WASM_VECTOR_LEN = arg.length;
|
|
245
|
+
return ptr;
|
|
270
246
|
}
|
|
271
|
-
|
|
272
247
|
/**
|
|
273
248
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
274
249
|
*
|
|
@@ -354,24 +329,49 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
354
329
|
}
|
|
355
330
|
|
|
356
331
|
/**
|
|
357
|
-
*
|
|
332
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
358
333
|
*
|
|
359
|
-
* @param {
|
|
334
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
335
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
336
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
337
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
360
338
|
*/
|
|
361
|
-
export function
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
339
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
340
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
341
|
+
const len0 = WASM_VECTOR_LEN;
|
|
342
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
343
|
+
return takeObject(ret);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
348
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
349
|
+
*
|
|
350
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
351
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
352
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
353
|
+
* @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.
|
|
354
|
+
*/
|
|
355
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
356
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
357
|
+
const len0 = WASM_VECTOR_LEN;
|
|
358
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
359
|
+
return takeObject(ret);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
364
|
+
*
|
|
365
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
366
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
367
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
368
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
369
|
+
*/
|
|
370
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
371
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
372
|
+
const len0 = WASM_VECTOR_LEN;
|
|
373
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
374
|
+
return takeObject(ret);
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
/**
|
|
@@ -662,29 +662,52 @@ async function __wbg_load(module, imports) {
|
|
|
662
662
|
function __wbg_get_imports() {
|
|
663
663
|
const imports = {};
|
|
664
664
|
imports.wbg = {};
|
|
665
|
+
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
666
|
+
const obj = takeObject(arg0).original;
|
|
667
|
+
if (obj.cnt-- == 1) {
|
|
668
|
+
obj.a = 0;
|
|
669
|
+
return true;
|
|
670
|
+
}
|
|
671
|
+
const ret = false;
|
|
672
|
+
return ret;
|
|
673
|
+
};
|
|
665
674
|
imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
|
|
666
675
|
takeObject(arg0);
|
|
667
676
|
};
|
|
668
|
-
imports.wbg.
|
|
669
|
-
const
|
|
677
|
+
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
678
|
+
const obj = getObject(arg1);
|
|
679
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
680
|
+
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
681
|
+
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
682
|
+
};
|
|
683
|
+
imports.wbg.__wbg_constructor_a4e1fbe49b64399a = function(arg0) {
|
|
684
|
+
const ret = new Error(takeObject(arg0));
|
|
670
685
|
return addHeapObject(ret);
|
|
671
686
|
};
|
|
672
687
|
imports.wbg.__wbindgen_is_array = function(arg0) {
|
|
673
688
|
const ret = Array.isArray(getObject(arg0));
|
|
674
689
|
return ret;
|
|
675
690
|
};
|
|
676
|
-
imports.wbg.
|
|
677
|
-
const ret =
|
|
691
|
+
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
692
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
693
|
+
return ret;
|
|
694
|
+
};
|
|
695
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
696
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
678
697
|
return addHeapObject(ret);
|
|
679
698
|
};
|
|
680
|
-
imports.wbg.
|
|
681
|
-
const ret = new
|
|
699
|
+
imports.wbg.__wbg_new_99fb929611321a93 = function() {
|
|
700
|
+
const ret = new Array();
|
|
682
701
|
return addHeapObject(ret);
|
|
683
702
|
};
|
|
684
703
|
imports.wbg.__wbindgen_number_new = function(arg0) {
|
|
685
704
|
const ret = arg0;
|
|
686
705
|
return addHeapObject(ret);
|
|
687
706
|
};
|
|
707
|
+
imports.wbg.__wbg_new_237eb36a3bda602b = function() {
|
|
708
|
+
const ret = new Map();
|
|
709
|
+
return addHeapObject(ret);
|
|
710
|
+
};
|
|
688
711
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
689
712
|
const obj = getObject(arg1);
|
|
690
713
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -693,29 +716,6 @@ function __wbg_get_imports() {
|
|
|
693
716
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
694
717
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
695
718
|
};
|
|
696
|
-
imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
|
|
697
|
-
const obj = getObject(arg1);
|
|
698
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
699
|
-
getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret;
|
|
700
|
-
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
701
|
-
};
|
|
702
|
-
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
703
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
704
|
-
return ret;
|
|
705
|
-
};
|
|
706
|
-
imports.wbg.__wbindgen_cb_drop = function(arg0) {
|
|
707
|
-
const obj = takeObject(arg0).original;
|
|
708
|
-
if (obj.cnt-- == 1) {
|
|
709
|
-
obj.a = 0;
|
|
710
|
-
return true;
|
|
711
|
-
}
|
|
712
|
-
const ret = false;
|
|
713
|
-
return ret;
|
|
714
|
-
};
|
|
715
|
-
imports.wbg.__wbg_new_f139361aad331bd0 = function() {
|
|
716
|
-
const ret = new Array();
|
|
717
|
-
return addHeapObject(ret);
|
|
718
|
-
};
|
|
719
719
|
imports.wbg.__wbg_new_abda76e883ba8a5f = function() {
|
|
720
720
|
const ret = new Error();
|
|
721
721
|
return addHeapObject(ret);
|
|
@@ -899,8 +899,8 @@ function __wbg_get_imports() {
|
|
|
899
899
|
imports.wbg.__wbindgen_throw = function(arg0, arg1) {
|
|
900
900
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
901
901
|
};
|
|
902
|
-
imports.wbg.
|
|
903
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
902
|
+
imports.wbg.__wbindgen_closure_wrapper759 = function(arg0, arg1, arg2) {
|
|
903
|
+
const ret = makeMutClosure(arg0, arg1, 256, __wbg_adapter_22);
|
|
904
904
|
return addHeapObject(ret);
|
|
905
905
|
};
|
|
906
906
|
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
5
|
-
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
6
|
-
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
4
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
7
5
|
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
8
6
|
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
9
7
|
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
10
|
-
export function
|
|
8
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
9
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
10
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
11
11
|
export function and(a: number, b: number): number;
|
|
12
12
|
export function xor(a: number, b: number): number;
|
|
13
13
|
export function sha256(a: number, b: number, c: number): void;
|