@noir-lang/acvm_js 0.47.0-ec728dd.nightly → 0.47.0-ee8b0cd.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 +79 -79
- package/nodejs/acvm_js.js +198 -198
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +7 -7
- package/package.json +1 -1
- package/web/acvm_js.d.ts +86 -86
- package/web/acvm_js.js +196 -196
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +7 -7
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Sets the package's logging level.
|
|
5
|
-
*
|
|
6
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
7
|
-
*/
|
|
8
|
-
export function initLogLevel(filter: string): void;
|
|
9
|
-
/**
|
|
10
4
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
11
5
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
12
6
|
*/
|
|
@@ -41,56 +35,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
41
35
|
*/
|
|
42
36
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
43
37
|
/**
|
|
44
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
45
|
-
* @param {string} lhs
|
|
46
|
-
* @param {string} rhs
|
|
47
|
-
* @returns {string}
|
|
48
|
-
*/
|
|
49
|
-
export function and(lhs: string, rhs: string): string;
|
|
50
|
-
/**
|
|
51
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
52
|
-
* @param {string} lhs
|
|
53
|
-
* @param {string} rhs
|
|
54
|
-
* @returns {string}
|
|
55
|
-
*/
|
|
56
|
-
export function xor(lhs: string, rhs: string): string;
|
|
57
|
-
/**
|
|
58
|
-
* Calculates the SHA256 hash of the input bytes
|
|
59
|
-
* @param {Uint8Array} inputs
|
|
60
|
-
* @returns {Uint8Array}
|
|
61
|
-
*/
|
|
62
|
-
export function sha256(inputs: Uint8Array): Uint8Array;
|
|
63
|
-
/**
|
|
64
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
65
|
-
* @param {Uint8Array} inputs
|
|
66
|
-
* @returns {Uint8Array}
|
|
67
|
-
*/
|
|
68
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
69
|
-
/**
|
|
70
|
-
* Calculates the Keccak256 hash of the input bytes
|
|
71
|
-
* @param {Uint8Array} inputs
|
|
72
|
-
* @returns {Uint8Array}
|
|
73
|
-
*/
|
|
74
|
-
export function keccak256(inputs: Uint8Array): Uint8Array;
|
|
75
|
-
/**
|
|
76
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
77
|
-
* @param {Uint8Array} hashed_msg
|
|
78
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
79
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
80
|
-
* @param {Uint8Array} signature
|
|
81
|
-
* @returns {boolean}
|
|
82
|
-
*/
|
|
83
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
84
|
-
/**
|
|
85
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
86
|
-
* @param {Uint8Array} hashed_msg
|
|
87
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
88
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
89
|
-
* @param {Uint8Array} signature
|
|
90
|
-
* @returns {boolean}
|
|
91
|
-
*/
|
|
92
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
93
|
-
/**
|
|
94
38
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
95
39
|
*
|
|
96
40
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
@@ -151,6 +95,62 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
151
95
|
* @returns {WitnessMap}
|
|
152
96
|
*/
|
|
153
97
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
98
|
+
/**
|
|
99
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
100
|
+
* @param {string} lhs
|
|
101
|
+
* @param {string} rhs
|
|
102
|
+
* @returns {string}
|
|
103
|
+
*/
|
|
104
|
+
export function and(lhs: string, rhs: string): string;
|
|
105
|
+
/**
|
|
106
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
107
|
+
* @param {string} lhs
|
|
108
|
+
* @param {string} rhs
|
|
109
|
+
* @returns {string}
|
|
110
|
+
*/
|
|
111
|
+
export function xor(lhs: string, rhs: string): string;
|
|
112
|
+
/**
|
|
113
|
+
* Calculates the SHA256 hash of the input bytes
|
|
114
|
+
* @param {Uint8Array} inputs
|
|
115
|
+
* @returns {Uint8Array}
|
|
116
|
+
*/
|
|
117
|
+
export function sha256(inputs: Uint8Array): Uint8Array;
|
|
118
|
+
/**
|
|
119
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
120
|
+
* @param {Uint8Array} inputs
|
|
121
|
+
* @returns {Uint8Array}
|
|
122
|
+
*/
|
|
123
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
124
|
+
/**
|
|
125
|
+
* Calculates the Keccak256 hash of the input bytes
|
|
126
|
+
* @param {Uint8Array} inputs
|
|
127
|
+
* @returns {Uint8Array}
|
|
128
|
+
*/
|
|
129
|
+
export function keccak256(inputs: Uint8Array): Uint8Array;
|
|
130
|
+
/**
|
|
131
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
132
|
+
* @param {Uint8Array} hashed_msg
|
|
133
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
134
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
135
|
+
* @param {Uint8Array} signature
|
|
136
|
+
* @returns {boolean}
|
|
137
|
+
*/
|
|
138
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
141
|
+
* @param {Uint8Array} hashed_msg
|
|
142
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
143
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
144
|
+
* @param {Uint8Array} signature
|
|
145
|
+
* @returns {boolean}
|
|
146
|
+
*/
|
|
147
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Sets the package's logging level.
|
|
150
|
+
*
|
|
151
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
152
|
+
*/
|
|
153
|
+
export function initLogLevel(filter: string): void;
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -166,29 +166,6 @@ export type BuildInfo = {
|
|
|
166
166
|
|
|
167
167
|
|
|
168
168
|
|
|
169
|
-
export type StackItem = {
|
|
170
|
-
index: number;
|
|
171
|
-
witness: WitnessMap;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export type WitnessStack = Array<StackItem>;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
export type ForeignCallInput = string[]
|
|
179
|
-
export type ForeignCallOutput = string | string[]
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* A callback which performs an foreign call and returns the response.
|
|
183
|
-
* @callback ForeignCallHandler
|
|
184
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
185
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
186
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
187
|
-
*/
|
|
188
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
169
|
export type RawAssertionPayload = {
|
|
193
170
|
selector: string;
|
|
194
171
|
data: string[];
|
|
@@ -214,3 +191,26 @@ export type SolvedAndReturnWitness = {
|
|
|
214
191
|
}
|
|
215
192
|
|
|
216
193
|
|
|
194
|
+
|
|
195
|
+
export type StackItem = {
|
|
196
|
+
index: number;
|
|
197
|
+
witness: WitnessMap;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export type WitnessStack = Array<StackItem>;
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
export type ForeignCallInput = string[]
|
|
205
|
+
export type ForeignCallOutput = string | string[]
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A callback which performs an foreign call and returns the response.
|
|
209
|
+
* @callback ForeignCallHandler
|
|
210
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
211
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
212
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
213
|
+
*/
|
|
214
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
215
|
+
|
|
216
|
+
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -23,15 +23,6 @@ function takeObject(idx) {
|
|
|
23
23
|
return ret;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
function addHeapObject(obj) {
|
|
27
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
28
|
-
const idx = heap_next;
|
|
29
|
-
heap_next = heap[idx];
|
|
30
|
-
|
|
31
|
-
heap[idx] = obj;
|
|
32
|
-
return idx;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
26
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
36
27
|
|
|
37
28
|
cachedTextDecoder.decode();
|
|
@@ -50,26 +41,13 @@ function getStringFromWasm0(ptr, len) {
|
|
|
50
41
|
return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
|
|
51
42
|
}
|
|
52
43
|
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
let cachedFloat64Memory0 = null;
|
|
58
|
-
|
|
59
|
-
function getFloat64Memory0() {
|
|
60
|
-
if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) {
|
|
61
|
-
cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer);
|
|
62
|
-
}
|
|
63
|
-
return cachedFloat64Memory0;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let cachedInt32Memory0 = null;
|
|
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];
|
|
67
48
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
|
|
71
|
-
}
|
|
72
|
-
return cachedInt32Memory0;
|
|
49
|
+
heap[idx] = obj;
|
|
50
|
+
return idx;
|
|
73
51
|
}
|
|
74
52
|
|
|
75
53
|
let WASM_VECTOR_LEN = 0;
|
|
@@ -127,6 +105,28 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
127
105
|
return ptr;
|
|
128
106
|
}
|
|
129
107
|
|
|
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,27 +220,6 @@ 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
|
-
|
|
244
223
|
/**
|
|
245
224
|
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
246
225
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
@@ -359,6 +338,136 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
359
338
|
}
|
|
360
339
|
};
|
|
361
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
343
|
+
*
|
|
344
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
345
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
346
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
347
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
348
|
+
*/
|
|
349
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
350
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
351
|
+
const len0 = WASM_VECTOR_LEN;
|
|
352
|
+
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
353
|
+
return takeObject(ret);
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
358
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
359
|
+
*
|
|
360
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
361
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
362
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
363
|
+
* @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.
|
|
364
|
+
*/
|
|
365
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
366
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
367
|
+
const len0 = WASM_VECTOR_LEN;
|
|
368
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
369
|
+
return takeObject(ret);
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
374
|
+
*
|
|
375
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
376
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
377
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
378
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
379
|
+
*/
|
|
380
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
381
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
382
|
+
const len0 = WASM_VECTOR_LEN;
|
|
383
|
+
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
384
|
+
return takeObject(ret);
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
389
|
+
*
|
|
390
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
391
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
392
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
393
|
+
* @param {Uint8Array} program
|
|
394
|
+
* @param {WitnessMap} witness_map
|
|
395
|
+
* @returns {WitnessMap}
|
|
396
|
+
*/
|
|
397
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
398
|
+
try {
|
|
399
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
400
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
401
|
+
const len0 = WASM_VECTOR_LEN;
|
|
402
|
+
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
403
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
404
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
405
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
406
|
+
if (r2) {
|
|
407
|
+
throw takeObject(r1);
|
|
408
|
+
}
|
|
409
|
+
return takeObject(r0);
|
|
410
|
+
} finally {
|
|
411
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
417
|
+
*
|
|
418
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
419
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
420
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
421
|
+
* @param {Uint8Array} program
|
|
422
|
+
* @param {WitnessMap} solved_witness
|
|
423
|
+
* @returns {WitnessMap}
|
|
424
|
+
*/
|
|
425
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
426
|
+
try {
|
|
427
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
428
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
429
|
+
const len0 = WASM_VECTOR_LEN;
|
|
430
|
+
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
431
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
432
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
433
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
434
|
+
if (r2) {
|
|
435
|
+
throw takeObject(r1);
|
|
436
|
+
}
|
|
437
|
+
return takeObject(r0);
|
|
438
|
+
} finally {
|
|
439
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
445
|
+
*
|
|
446
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
447
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
448
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
449
|
+
* @param {Uint8Array} program
|
|
450
|
+
* @param {WitnessMap} solved_witness
|
|
451
|
+
* @returns {WitnessMap}
|
|
452
|
+
*/
|
|
453
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
454
|
+
try {
|
|
455
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
456
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
457
|
+
const len0 = WASM_VECTOR_LEN;
|
|
458
|
+
wasm.getPublicWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
459
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
460
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
461
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
462
|
+
if (r2) {
|
|
463
|
+
throw takeObject(r1);
|
|
464
|
+
}
|
|
465
|
+
return takeObject(r0);
|
|
466
|
+
} finally {
|
|
467
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
|
|
362
471
|
/**
|
|
363
472
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
364
473
|
* @param {string} lhs
|
|
@@ -487,130 +596,21 @@ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes,
|
|
|
487
596
|
};
|
|
488
597
|
|
|
489
598
|
/**
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
493
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
494
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
495
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
496
|
-
*/
|
|
497
|
-
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
498
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
499
|
-
const len0 = WASM_VECTOR_LEN;
|
|
500
|
-
const ret = wasm.executeCircuit(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
501
|
-
return takeObject(ret);
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
506
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
507
|
-
*
|
|
508
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
509
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
510
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
511
|
-
* @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.
|
|
512
|
-
*/
|
|
513
|
-
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
514
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
515
|
-
const len0 = WASM_VECTOR_LEN;
|
|
516
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
517
|
-
return takeObject(ret);
|
|
518
|
-
};
|
|
519
|
-
|
|
520
|
-
/**
|
|
521
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
522
|
-
*
|
|
523
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
524
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
525
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
526
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
527
|
-
*/
|
|
528
|
-
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
529
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
530
|
-
const len0 = WASM_VECTOR_LEN;
|
|
531
|
-
const ret = wasm.executeProgram(ptr0, len0, addHeapObject(initial_witness), addHeapObject(foreign_call_handler));
|
|
532
|
-
return takeObject(ret);
|
|
533
|
-
};
|
|
534
|
-
|
|
535
|
-
/**
|
|
536
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
537
|
-
*
|
|
538
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
539
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
540
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
541
|
-
* @param {Uint8Array} program
|
|
542
|
-
* @param {WitnessMap} witness_map
|
|
543
|
-
* @returns {WitnessMap}
|
|
544
|
-
*/
|
|
545
|
-
module.exports.getReturnWitness = function(program, witness_map) {
|
|
546
|
-
try {
|
|
547
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
548
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
549
|
-
const len0 = WASM_VECTOR_LEN;
|
|
550
|
-
wasm.getReturnWitness(retptr, ptr0, len0, addHeapObject(witness_map));
|
|
551
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
552
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
553
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
554
|
-
if (r2) {
|
|
555
|
-
throw takeObject(r1);
|
|
556
|
-
}
|
|
557
|
-
return takeObject(r0);
|
|
558
|
-
} finally {
|
|
559
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
565
|
-
*
|
|
566
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
567
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
568
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
569
|
-
* @param {Uint8Array} program
|
|
570
|
-
* @param {WitnessMap} solved_witness
|
|
571
|
-
* @returns {WitnessMap}
|
|
572
|
-
*/
|
|
573
|
-
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
574
|
-
try {
|
|
575
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
576
|
-
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
577
|
-
const len0 = WASM_VECTOR_LEN;
|
|
578
|
-
wasm.getPublicParametersWitness(retptr, ptr0, len0, addHeapObject(solved_witness));
|
|
579
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
580
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
581
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
582
|
-
if (r2) {
|
|
583
|
-
throw takeObject(r1);
|
|
584
|
-
}
|
|
585
|
-
return takeObject(r0);
|
|
586
|
-
} finally {
|
|
587
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
588
|
-
}
|
|
589
|
-
};
|
|
590
|
-
|
|
591
|
-
/**
|
|
592
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
599
|
+
* Sets the package's logging level.
|
|
593
600
|
*
|
|
594
|
-
* @param {
|
|
595
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
596
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
597
|
-
* @param {Uint8Array} program
|
|
598
|
-
* @param {WitnessMap} solved_witness
|
|
599
|
-
* @returns {WitnessMap}
|
|
601
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
600
602
|
*/
|
|
601
|
-
module.exports.
|
|
603
|
+
module.exports.initLogLevel = function(filter) {
|
|
602
604
|
try {
|
|
603
605
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
604
|
-
const ptr0 =
|
|
606
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
605
607
|
const len0 = WASM_VECTOR_LEN;
|
|
606
|
-
wasm.
|
|
608
|
+
wasm.initLogLevel(retptr, ptr0, len0);
|
|
607
609
|
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
608
610
|
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
throw takeObject(r1);
|
|
611
|
+
if (r1) {
|
|
612
|
+
throw takeObject(r0);
|
|
612
613
|
}
|
|
613
|
-
return takeObject(r0);
|
|
614
614
|
} finally {
|
|
615
615
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
616
616
|
}
|
|
@@ -635,33 +635,23 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
|
|
|
635
635
|
takeObject(arg0);
|
|
636
636
|
};
|
|
637
637
|
|
|
638
|
-
module.exports.
|
|
639
|
-
const
|
|
640
|
-
if (obj.cnt-- == 1) {
|
|
641
|
-
obj.a = 0;
|
|
642
|
-
return true;
|
|
643
|
-
}
|
|
644
|
-
const ret = false;
|
|
645
|
-
return ret;
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
module.exports.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
649
|
-
const ret = new Error(takeObject(arg0));
|
|
638
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
639
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
650
640
|
return addHeapObject(ret);
|
|
651
641
|
};
|
|
652
642
|
|
|
653
|
-
module.exports.__wbindgen_is_string = function(arg0) {
|
|
654
|
-
const ret = typeof(getObject(arg0)) === 'string';
|
|
655
|
-
return ret;
|
|
656
|
-
};
|
|
657
|
-
|
|
658
643
|
module.exports.__wbindgen_is_array = function(arg0) {
|
|
659
644
|
const ret = Array.isArray(getObject(arg0));
|
|
660
645
|
return ret;
|
|
661
646
|
};
|
|
662
647
|
|
|
663
|
-
module.exports.
|
|
664
|
-
const ret = new
|
|
648
|
+
module.exports.__wbg_constructor_971e67e66cc5bd6a = function(arg0) {
|
|
649
|
+
const ret = new Error(takeObject(arg0));
|
|
650
|
+
return addHeapObject(ret);
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
module.exports.__wbg_new_193bac1dd2be232d = function() {
|
|
654
|
+
const ret = new Map();
|
|
665
655
|
return addHeapObject(ret);
|
|
666
656
|
};
|
|
667
657
|
|
|
@@ -670,9 +660,13 @@ module.exports.__wbindgen_number_new = function(arg0) {
|
|
|
670
660
|
return addHeapObject(ret);
|
|
671
661
|
};
|
|
672
662
|
|
|
673
|
-
module.exports.
|
|
674
|
-
const
|
|
675
|
-
|
|
663
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
664
|
+
const obj = getObject(arg1);
|
|
665
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
666
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
667
|
+
var len1 = WASM_VECTOR_LEN;
|
|
668
|
+
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
669
|
+
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
676
670
|
};
|
|
677
671
|
|
|
678
672
|
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
@@ -682,18 +676,24 @@ module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
|
682
676
|
getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret);
|
|
683
677
|
};
|
|
684
678
|
|
|
685
|
-
module.exports.
|
|
686
|
-
const
|
|
679
|
+
module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
680
|
+
const obj = takeObject(arg0).original;
|
|
681
|
+
if (obj.cnt-- == 1) {
|
|
682
|
+
obj.a = 0;
|
|
683
|
+
return true;
|
|
684
|
+
}
|
|
685
|
+
const ret = false;
|
|
686
|
+
return ret;
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
module.exports.__wbg_new_f139361aad331bd0 = function() {
|
|
690
|
+
const ret = new Array();
|
|
687
691
|
return addHeapObject(ret);
|
|
688
692
|
};
|
|
689
693
|
|
|
690
|
-
module.exports.
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
694
|
-
var len1 = WASM_VECTOR_LEN;
|
|
695
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
696
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
694
|
+
module.exports.__wbindgen_is_string = function(arg0) {
|
|
695
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
696
|
+
return ret;
|
|
697
697
|
};
|
|
698
698
|
|
|
699
699
|
module.exports.__wbg_new_abda76e883ba8a5f = function() {
|
|
@@ -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_wrapper748 = function(arg0, arg1, arg2) {
|
|
918
|
+
const ret = makeMutClosure(arg0, arg1, 246, __wbg_adapter_22);
|
|
919
919
|
return addHeapObject(ret);
|
|
920
920
|
};
|
|
921
921
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|