@noir-lang/acvm_js 0.47.0-e100017.nightly → 0.47.0-e59ff8c.nightly
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 +67 -67
- package/nodejs/acvm_js.js +124 -124
- 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 +71 -71
- package/web/acvm_js.js +121 -121
- 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,12 +40,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
62
40
|
*/
|
|
63
41
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
64
42
|
/**
|
|
65
|
-
* Sets the package's logging level.
|
|
66
|
-
*
|
|
67
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
68
|
-
*/
|
|
69
|
-
export function initLogLevel(filter: string): void;
|
|
70
|
-
/**
|
|
71
43
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
72
44
|
* @param {string} lhs
|
|
73
45
|
* @param {string} rhs
|
|
@@ -118,6 +90,34 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
118
90
|
*/
|
|
119
91
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
120
92
|
/**
|
|
93
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
94
|
+
*
|
|
95
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
96
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
97
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
98
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
99
|
+
*/
|
|
100
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
101
|
+
/**
|
|
102
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
103
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
104
|
+
*
|
|
105
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
106
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
107
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
108
|
+
* @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.
|
|
109
|
+
*/
|
|
110
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
111
|
+
/**
|
|
112
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
113
|
+
*
|
|
114
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
115
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
116
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
117
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
118
|
+
*/
|
|
119
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
120
|
+
/**
|
|
121
121
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
122
122
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
123
123
|
*/
|
|
@@ -152,14 +152,31 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
152
152
|
*/
|
|
153
153
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
/**
|
|
156
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
157
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
158
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
159
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
160
|
+
*/
|
|
161
|
+
export type BuildInfo = {
|
|
162
|
+
gitHash: string;
|
|
163
|
+
version: string;
|
|
164
|
+
dirty: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
export type ForeignCallInput = string[]
|
|
170
|
+
export type ForeignCallOutput = string | string[]
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* A callback which performs an foreign call and returns the response.
|
|
174
|
+
* @callback ForeignCallHandler
|
|
175
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
176
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
177
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
178
|
+
*/
|
|
179
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
163
180
|
|
|
164
181
|
|
|
165
182
|
|
|
@@ -178,6 +195,17 @@ export type SolvedAndReturnWitness = {
|
|
|
178
195
|
|
|
179
196
|
|
|
180
197
|
|
|
198
|
+
export type RawAssertionPayload = {
|
|
199
|
+
selector: string;
|
|
200
|
+
data: string[];
|
|
201
|
+
};
|
|
202
|
+
export type ExecutionError = Error & {
|
|
203
|
+
callStack?: string[];
|
|
204
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
181
209
|
export type StackItem = {
|
|
182
210
|
index: number;
|
|
183
211
|
witness: WitnessMap;
|
|
@@ -186,31 +214,3 @@ export type StackItem = {
|
|
|
186
214
|
export type WitnessStack = Array<StackItem>;
|
|
187
215
|
|
|
188
216
|
|
|
189
|
-
|
|
190
|
-
export type ForeignCallInput = string[]
|
|
191
|
-
export type ForeignCallOutput = string | string[]
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* A callback which performs an foreign call and returns the response.
|
|
195
|
-
* @callback ForeignCallHandler
|
|
196
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
197
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
198
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
199
|
-
*/
|
|
200
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
206
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
207
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
208
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
209
|
-
*/
|
|
210
|
-
export type BuildInfo = {
|
|
211
|
-
gitHash: string;
|
|
212
|
-
version: string;
|
|
213
|
-
dirty: string;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -23,6 +23,37 @@ 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
|
+
|
|
48
|
+
function addHeapObject(obj) {
|
|
49
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
50
|
+
const idx = heap_next;
|
|
51
|
+
heap_next = heap[idx];
|
|
52
|
+
|
|
53
|
+
heap[idx] = obj;
|
|
54
|
+
return idx;
|
|
55
|
+
}
|
|
56
|
+
|
|
26
57
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
27
58
|
|
|
28
59
|
cachedTextDecoder.decode();
|
|
@@ -41,15 +72,6 @@ function getStringFromWasm0(ptr, len) {
|
|
|
41
72
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
42
73
|
}
|
|
43
74
|
|
|
44
|
-
function addHeapObject(obj) {
|
|
45
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
46
|
-
const idx = heap_next;
|
|
47
|
-
heap_next = heap[idx];
|
|
48
|
-
|
|
49
|
-
heap[idx] = obj;
|
|
50
|
-
return idx;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
75
|
let WASM_VECTOR_LEN = 0;
|
|
54
76
|
|
|
55
77
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
@@ -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
|
*
|
|
@@ -356,27 +331,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
356
331
|
}
|
|
357
332
|
};
|
|
358
333
|
|
|
359
|
-
/**
|
|
360
|
-
* Sets the package's logging level.
|
|
361
|
-
*
|
|
362
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
363
|
-
*/
|
|
364
|
-
module.exports.initLogLevel = function(filter) {
|
|
365
|
-
try {
|
|
366
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
367
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
368
|
-
const len0 = WASM_VECTOR_LEN;
|
|
369
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
370
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
371
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
372
|
-
if (r1) {
|
|
373
|
-
throw takeObject(r0);
|
|
374
|
-
}
|
|
375
|
-
} finally {
|
|
376
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
377
|
-
}
|
|
378
|
-
};
|
|
379
|
-
|
|
380
334
|
/**
|
|
381
335
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
382
336
|
* @param {string} lhs
|
|
@@ -508,6 +462,52 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
508
462
|
return ret !== 0;
|
|
509
463
|
};
|
|
510
464
|
|
|
465
|
+
/**
|
|
466
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
467
|
+
*
|
|
468
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
469
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
470
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
471
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
472
|
+
*/
|
|
473
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
474
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
475
|
+
const len0 = WASM_VECTOR_LEN;
|
|
476
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
477
|
+
return takeObject(ret);
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
482
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
483
|
+
*
|
|
484
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
485
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
486
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
487
|
+
* @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.
|
|
488
|
+
*/
|
|
489
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
490
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
491
|
+
const len0 = WASM_VECTOR_LEN;
|
|
492
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
493
|
+
return takeObject(ret);
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
498
|
+
*
|
|
499
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
500
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
501
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
502
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
503
|
+
*/
|
|
504
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
505
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
506
|
+
const len0 = WASM_VECTOR_LEN;
|
|
507
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
508
|
+
return takeObject(ret);
|
|
509
|
+
};
|
|
510
|
+
|
|
511
511
|
/**
|
|
512
512
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
513
513
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
@@ -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_971e67e66cc5bd6a = function(arg0) {
|
|
656
|
+
const ret = new Error(takeObject(arg0));
|
|
640
657
|
return addHeapObject(ret);
|
|
641
658
|
};
|
|
642
659
|
|
|
@@ -645,11 +662,6 @@ module.exports.__wbindgen_is_array = function(arg0) {
|
|
|
645
662
|
return ret;
|
|
646
663
|
};
|
|
647
664
|
|
|
648
|
-
module.exports.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
649
|
-
const ret = new Error(takeObject(arg0));
|
|
650
|
-
return addHeapObject(ret);
|
|
651
|
-
};
|
|
652
|
-
|
|
653
665
|
module.exports.__wbg_new_193bac1dd2be232d = function() {
|
|
654
666
|
const ret = new Map();
|
|
655
667
|
return addHeapObject(ret);
|
|
@@ -660,6 +672,11 @@ module.exports.__wbindgen_number_new = function(arg0) {
|
|
|
660
672
|
return addHeapObject(ret);
|
|
661
673
|
};
|
|
662
674
|
|
|
675
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
676
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
677
|
+
return addHeapObject(ret);
|
|
678
|
+
};
|
|
679
|
+
|
|
663
680
|
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
664
681
|
const obj = getObject(arg1);
|
|
665
682
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -669,28 +686,11 @@ module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
|
669
686
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
670
687
|
};
|
|
671
688
|
|
|
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
689
|
module.exports.__wbindgen_is_string = function(arg0) {
|
|
680
690
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
681
691
|
return ret;
|
|
682
692
|
};
|
|
683
693
|
|
|
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
694
|
module.exports.__wbg_new_f139361aad331bd0 = function() {
|
|
695
695
|
const ret = new Array();
|
|
696
696
|
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_wrapper760 = 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,10 @@
|
|
|
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 initLogLevel(a: number, b: number, c: number): void;
|
|
11
8
|
export function and(a: number, b: number): number;
|
|
12
9
|
export function xor(a: number, b: number): number;
|
|
13
10
|
export function sha256(a: number, b: number, c: number): void;
|
|
@@ -15,6 +12,9 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
15
12
|
export function keccak256(a: number, b: number, c: number): void;
|
|
16
13
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
14
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
15
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
16
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
17
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
18
18
|
export function buildInfo(): number;
|
|
19
19
|
export function compressWitness(a: number, b: number): void;
|
|
20
20
|
export function decompressWitness(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,12 +40,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
62
40
|
*/
|
|
63
41
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
64
42
|
/**
|
|
65
|
-
* Sets the package's logging level.
|
|
66
|
-
*
|
|
67
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
68
|
-
*/
|
|
69
|
-
export function initLogLevel(filter: string): void;
|
|
70
|
-
/**
|
|
71
43
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
72
44
|
* @param {string} lhs
|
|
73
45
|
* @param {string} rhs
|
|
@@ -118,6 +90,34 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
118
90
|
*/
|
|
119
91
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
120
92
|
/**
|
|
93
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
94
|
+
*
|
|
95
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
96
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
97
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
98
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
99
|
+
*/
|
|
100
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
101
|
+
/**
|
|
102
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
103
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
104
|
+
*
|
|
105
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
106
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
107
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
108
|
+
* @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.
|
|
109
|
+
*/
|
|
110
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
111
|
+
/**
|
|
112
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
113
|
+
*
|
|
114
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
115
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
116
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
117
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
118
|
+
*/
|
|
119
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
120
|
+
/**
|
|
121
121
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
122
122
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
123
123
|
*/
|
|
@@ -152,14 +152,31 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
152
152
|
*/
|
|
153
153
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
154
154
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
155
|
+
/**
|
|
156
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
157
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
158
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
159
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
160
|
+
*/
|
|
161
|
+
export type BuildInfo = {
|
|
162
|
+
gitHash: string;
|
|
163
|
+
version: string;
|
|
164
|
+
dirty: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
export type ForeignCallInput = string[]
|
|
170
|
+
export type ForeignCallOutput = string | string[]
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* A callback which performs an foreign call and returns the response.
|
|
174
|
+
* @callback ForeignCallHandler
|
|
175
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
176
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
177
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
178
|
+
*/
|
|
179
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
163
180
|
|
|
164
181
|
|
|
165
182
|
|
|
@@ -178,6 +195,17 @@ export type SolvedAndReturnWitness = {
|
|
|
178
195
|
|
|
179
196
|
|
|
180
197
|
|
|
198
|
+
export type RawAssertionPayload = {
|
|
199
|
+
selector: string;
|
|
200
|
+
data: string[];
|
|
201
|
+
};
|
|
202
|
+
export type ExecutionError = Error & {
|
|
203
|
+
callStack?: string[];
|
|
204
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
181
209
|
export type StackItem = {
|
|
182
210
|
index: number;
|
|
183
211
|
witness: WitnessMap;
|
|
@@ -187,45 +215,14 @@ export type WitnessStack = Array<StackItem>;
|
|
|
187
215
|
|
|
188
216
|
|
|
189
217
|
|
|
190
|
-
export type ForeignCallInput = string[]
|
|
191
|
-
export type ForeignCallOutput = string | string[]
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* A callback which performs an foreign call and returns the response.
|
|
195
|
-
* @callback ForeignCallHandler
|
|
196
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
197
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
198
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
199
|
-
*/
|
|
200
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
206
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
207
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
208
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
209
|
-
*/
|
|
210
|
-
export type BuildInfo = {
|
|
211
|
-
gitHash: string;
|
|
212
|
-
version: string;
|
|
213
|
-
dirty: string;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
218
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
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 initLogLevel: (a: number, b: number, c: number) => void;
|
|
229
226
|
readonly and: (a: number, b: number) => number;
|
|
230
227
|
readonly xor: (a: number, b: number) => number;
|
|
231
228
|
readonly sha256: (a: number, b: number, c: number) => void;
|
|
@@ -233,6 +230,9 @@ export interface InitOutput {
|
|
|
233
230
|
readonly keccak256: (a: number, b: number, c: number) => void;
|
|
234
231
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
235
232
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
233
|
+
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
234
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
235
|
+
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
236
236
|
readonly buildInfo: () => number;
|
|
237
237
|
readonly compressWitness: (a: number, b: number) => void;
|
|
238
238
|
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
package/web/acvm_js.js
CHANGED
|
@@ -20,6 +20,37 @@ 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
|
+
|
|
45
|
+
function addHeapObject(obj) {
|
|
46
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
47
|
+
const idx = heap_next;
|
|
48
|
+
heap_next = heap[idx];
|
|
49
|
+
|
|
50
|
+
heap[idx] = obj;
|
|
51
|
+
return idx;
|
|
52
|
+
}
|
|
53
|
+
|
|
23
54
|
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
|
24
55
|
|
|
25
56
|
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
|
@@ -38,15 +69,6 @@ function getStringFromWasm0(ptr, len) {
|
|
|
38
69
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
39
70
|
}
|
|
40
71
|
|
|
41
|
-
function addHeapObject(obj) {
|
|
42
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
43
|
-
const idx = heap_next;
|
|
44
|
-
heap_next = heap[idx];
|
|
45
|
-
|
|
46
|
-
heap[idx] = obj;
|
|
47
|
-
return idx;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
72
|
let WASM_VECTOR_LEN = 0;
|
|
51
73
|
|
|
52
74
|
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
|
@@ -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
|
*
|
|
@@ -353,27 +328,6 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
353
328
|
}
|
|
354
329
|
}
|
|
355
330
|
|
|
356
|
-
/**
|
|
357
|
-
* Sets the package's logging level.
|
|
358
|
-
*
|
|
359
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
360
|
-
*/
|
|
361
|
-
export function initLogLevel(filter) {
|
|
362
|
-
try {
|
|
363
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
364
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
365
|
-
const len0 = WASM_VECTOR_LEN;
|
|
366
|
-
wasm.initLogLevel(retptr, ptr0, len0);
|
|
367
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
368
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
369
|
-
if (r1) {
|
|
370
|
-
throw takeObject(r0);
|
|
371
|
-
}
|
|
372
|
-
} finally {
|
|
373
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
331
|
/**
|
|
378
332
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
379
333
|
* @param {string} lhs
|
|
@@ -505,6 +459,52 @@ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_ke
|
|
|
505
459
|
return ret !== 0;
|
|
506
460
|
}
|
|
507
461
|
|
|
462
|
+
/**
|
|
463
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
464
|
+
*
|
|
465
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
466
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
467
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
468
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
469
|
+
*/
|
|
470
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
471
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
472
|
+
const len0 = WASM_VECTOR_LEN;
|
|
473
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
474
|
+
return takeObject(ret);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
479
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
480
|
+
*
|
|
481
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
482
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
483
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
484
|
+
* @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.
|
|
485
|
+
*/
|
|
486
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
487
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
488
|
+
const len0 = WASM_VECTOR_LEN;
|
|
489
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
490
|
+
return takeObject(ret);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
495
|
+
*
|
|
496
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
497
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
498
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
499
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
500
|
+
*/
|
|
501
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
502
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
503
|
+
const len0 = WASM_VECTOR_LEN;
|
|
504
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
505
|
+
return takeObject(ret);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
508
|
/**
|
|
509
509
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
510
510
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
@@ -662,21 +662,32 @@ 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_971e67e66cc5bd6a = 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.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
677
|
-
const ret = new Error(takeObject(arg0));
|
|
678
|
-
return addHeapObject(ret);
|
|
679
|
-
};
|
|
680
691
|
imports.wbg.__wbg_new_193bac1dd2be232d = function() {
|
|
681
692
|
const ret = new Map();
|
|
682
693
|
return addHeapObject(ret);
|
|
@@ -685,6 +696,10 @@ function __wbg_get_imports() {
|
|
|
685
696
|
const ret = arg0;
|
|
686
697
|
return addHeapObject(ret);
|
|
687
698
|
};
|
|
699
|
+
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
|
|
700
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
701
|
+
return addHeapObject(ret);
|
|
702
|
+
};
|
|
688
703
|
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
|
|
689
704
|
const obj = getObject(arg1);
|
|
690
705
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
@@ -693,25 +708,10 @@ function __wbg_get_imports() {
|
|
|
693
708
|
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
694
709
|
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
695
710
|
};
|
|
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
711
|
imports.wbg.__wbindgen_is_string = function(arg0) {
|
|
703
712
|
const ret = typeof(getObject(arg0)) === 'string';
|
|
704
713
|
return ret;
|
|
705
714
|
};
|
|
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
715
|
imports.wbg.__wbg_new_f139361aad331bd0 = function() {
|
|
716
716
|
const ret = new Array();
|
|
717
717
|
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_wrapper760 = 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,10 @@
|
|
|
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 initLogLevel(a: number, b: number, c: number): void;
|
|
11
8
|
export function and(a: number, b: number): number;
|
|
12
9
|
export function xor(a: number, b: number): number;
|
|
13
10
|
export function sha256(a: number, b: number, c: number): void;
|
|
@@ -15,6 +12,9 @@ export function blake2s256(a: number, b: number, c: number): void;
|
|
|
15
12
|
export function keccak256(a: number, b: number, c: number): void;
|
|
16
13
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
17
14
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
15
|
+
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
16
|
+
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
17
|
+
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
18
18
|
export function buildInfo(): number;
|
|
19
19
|
export function compressWitness(a: number, b: number): void;
|
|
20
20
|
export function decompressWitness(a: number, b: number, c: number): void;
|