@noir-lang/acvm_js 0.46.0-e4eb5f5.nightly → 0.46.0-e73cdbb.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.
@@ -1,6 +1,13 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export function compressWitness(a: number, b: number): void;
5
+ export function decompressWitness(a: number, b: number, c: number): void;
6
+ export function compressWitnessStack(a: number, b: number): void;
7
+ export function decompressWitnessStack(a: number, b: number, c: number): void;
8
+ export function getReturnWitness(a: number, b: number, c: number, d: number): void;
9
+ export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
10
+ export function getPublicWitness(a: number, b: number, c: number, d: number): void;
4
11
  export function and(a: number, b: number): number;
5
12
  export function xor(a: number, b: number): number;
6
13
  export function sha256(a: number, b: number, c: number): void;
@@ -8,22 +15,11 @@ export function blake2s256(a: number, b: number, c: number): void;
8
15
  export function keccak256(a: number, b: number, c: number): void;
9
16
  export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
10
17
  export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
11
- export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
12
- export function createBlackBoxSolver(): number;
18
+ export function buildInfo(): number;
13
19
  export function executeCircuit(a: number, b: number, c: number, d: number): number;
14
- export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number, e: number): number;
15
- export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
20
+ export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
16
21
  export function executeProgram(a: number, b: number, c: number, d: number): number;
17
- export function executeProgramWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
18
22
  export function initLogLevel(a: number, b: number, c: number): void;
19
- export function buildInfo(): number;
20
- export function compressWitness(a: number, b: number): void;
21
- export function decompressWitness(a: number, b: number, c: number): void;
22
- export function compressWitnessStack(a: number, b: number): void;
23
- export function decompressWitnessStack(a: number, b: number, c: number): void;
24
- export function getReturnWitness(a: number, b: number, c: number, d: number): void;
25
- export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
26
- export function getPublicWitness(a: number, b: number, c: number, d: number): void;
27
23
  export function __wbindgen_malloc(a: number): number;
28
24
  export function __wbindgen_realloc(a: number, b: number, c: number): number;
29
25
  export const __wbindgen_export_2: WebAssembly.Table;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.46.0-e4eb5f5.nightly",
3
+ "version": "0.46.0-e73cdbb.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,6 +1,68 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
+ *
6
+ * @param {WitnessMap} witness_map - A witness map.
7
+ * @returns {Uint8Array} A compressed witness map
8
+ */
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
10
+ /**
11
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
12
+ * This should be used to only fetch the witness map for the main function.
13
+ *
14
+ * @param {Uint8Array} compressed_witness - A compressed witness.
15
+ * @returns {WitnessMap} The decompressed witness map.
16
+ */
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
18
+ /**
19
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
20
+ *
21
+ * @param {WitnessStack} witness_stack - A witness stack.
22
+ * @returns {Uint8Array} A compressed witness stack
23
+ */
24
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
25
+ /**
26
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
27
+ *
28
+ * @param {Uint8Array} compressed_witness - A compressed witness.
29
+ * @returns {WitnessStack} The decompressed witness stack.
30
+ */
31
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
32
+ /**
33
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
34
+ *
35
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
36
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
37
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
38
+ * @param {Uint8Array} program
39
+ * @param {WitnessMap} witness_map
40
+ * @returns {WitnessMap}
41
+ */
42
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
43
+ /**
44
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
45
+ *
46
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
47
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
48
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
49
+ * @param {Uint8Array} program
50
+ * @param {WitnessMap} solved_witness
51
+ * @returns {WitnessMap}
52
+ */
53
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
54
+ /**
55
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
56
+ *
57
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
58
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
59
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
60
+ * @param {Uint8Array} program
61
+ * @param {WitnessMap} solved_witness
62
+ * @returns {WitnessMap}
63
+ */
64
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
65
+ /**
4
66
  * Performs a bitwise AND operation between `lhs` and `rhs`
5
67
  * @param {string} lhs
6
68
  * @param {string} rhs
@@ -51,9 +113,10 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
51
113
  */
52
114
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
53
115
  /**
54
- * @returns {Promise<WasmBlackBoxFunctionSolver>}
116
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
117
+ * @returns {BuildInfo} - Information on how the installed package was built.
55
118
  */
56
- export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
119
+ export function buildInfo(): BuildInfo;
57
120
  /**
58
121
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
59
122
  *
@@ -67,102 +130,27 @@ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap,
67
130
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
68
131
  * This method also extracts the public return values from the solved witness into its own return witness.
69
132
  *
70
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
71
133
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
72
134
  * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
73
135
  * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
74
136
  * @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.
75
137
  */
76
- export function executeCircuitWithReturnWitness(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
138
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
77
139
  /**
78
140
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
79
141
  *
80
- * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
81
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
82
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
83
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
84
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
85
- */
86
- export function executeCircuitWithBlackBoxSolver(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
87
- /**
142
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
143
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
144
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
145
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
88
146
  */
89
147
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
90
148
  /**
91
- */
92
- export function executeProgramWithBlackBoxSolver(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
93
- /**
94
149
  * Sets the package's logging level.
95
150
  *
96
151
  * @param {LogLevel} level - The maximum level of logging to be emitted.
97
152
  */
98
153
  export function initLogLevel(filter: string): void;
99
- /**
100
- * Returns the `BuildInfo` object containing information about how the installed package was built.
101
- * @returns {BuildInfo} - Information on how the installed package was built.
102
- */
103
- export function buildInfo(): BuildInfo;
104
- /**
105
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
106
- *
107
- * @param {WitnessMap} witness_map - A witness map.
108
- * @returns {Uint8Array} A compressed witness map
109
- */
110
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
111
- /**
112
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
113
- * This should be used to only fetch the witness map for the main function.
114
- *
115
- * @param {Uint8Array} compressed_witness - A compressed witness.
116
- * @returns {WitnessMap} The decompressed witness map.
117
- */
118
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
119
- /**
120
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
121
- *
122
- * @param {WitnessStack} witness_stack - A witness stack.
123
- * @returns {Uint8Array} A compressed witness stack
124
- */
125
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
126
- /**
127
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
128
- *
129
- * @param {Uint8Array} compressed_witness - A compressed witness.
130
- * @returns {WitnessStack} The decompressed witness stack.
131
- */
132
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
133
- /**
134
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
135
- *
136
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
137
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
138
- * @returns {WitnessMap} A witness map containing the circuit's return values.
139
- * @param {Uint8Array} program
140
- * @param {WitnessMap} witness_map
141
- * @returns {WitnessMap}
142
- */
143
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
144
- /**
145
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
146
- *
147
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
148
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
149
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
150
- * @param {Uint8Array} program
151
- * @param {WitnessMap} solved_witness
152
- * @returns {WitnessMap}
153
- */
154
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
155
- /**
156
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
157
- *
158
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
159
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
160
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
161
- * @param {Uint8Array} program
162
- * @param {WitnessMap} solved_witness
163
- * @returns {WitnessMap}
164
- */
165
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
166
154
 
167
155
  export type RawAssertionPayload = {
168
156
  selector: string;
@@ -175,20 +163,6 @@ export type ExecutionError = Error & {
175
163
 
176
164
 
177
165
 
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
166
  /**
193
167
  * @typedef {Object} BuildInfo - Information about how the installed package was built
194
168
  * @property {string} gitHash - The hash of the git commit from which the package was built.
@@ -226,16 +200,32 @@ export type StackItem = {
226
200
  export type WitnessStack = Array<StackItem>;
227
201
 
228
202
 
203
+
204
+ export type ForeignCallInput = string[]
205
+ export type ForeignCallOutput = string | string[]
206
+
229
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.
230
213
  */
231
- export class WasmBlackBoxFunctionSolver {
232
- free(): void;
233
- }
214
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
215
+
216
+
234
217
 
235
218
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
236
219
 
237
220
  export interface InitOutput {
238
221
  readonly memory: WebAssembly.Memory;
222
+ readonly compressWitness: (a: number, b: number) => void;
223
+ readonly decompressWitness: (a: number, b: number, c: number) => void;
224
+ readonly compressWitnessStack: (a: number, b: number) => void;
225
+ readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
226
+ readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
227
+ readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
228
+ readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
239
229
  readonly and: (a: number, b: number) => number;
240
230
  readonly xor: (a: number, b: number) => number;
241
231
  readonly sha256: (a: number, b: number, c: number) => void;
@@ -243,22 +233,11 @@ export interface InitOutput {
243
233
  readonly keccak256: (a: number, b: number, c: number) => void;
244
234
  readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
245
235
  readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
246
- readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
247
- readonly createBlackBoxSolver: () => number;
236
+ readonly buildInfo: () => number;
248
237
  readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
249
- readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number, e: number) => number;
250
- readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
238
+ readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
251
239
  readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
252
- readonly executeProgramWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
253
240
  readonly initLogLevel: (a: number, b: number, c: number) => void;
254
- readonly buildInfo: () => number;
255
- readonly compressWitness: (a: number, b: number) => void;
256
- readonly decompressWitness: (a: number, b: number, c: number) => void;
257
- readonly compressWitnessStack: (a: number, b: number) => void;
258
- readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
259
- readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
260
- readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
261
- readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
262
241
  readonly __wbindgen_malloc: (a: number) => number;
263
242
  readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
264
243
  readonly __wbindgen_export_2: WebAssembly.Table;