@noir-lang/acvm_js 0.54.0 → 0.55.0-68c32b4.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,44 +1,62 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
4
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
5
5
  *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
6
+ * @param {WitnessMap} witness_map - A witness map.
7
+ * @returns {Uint8Array} A compressed witness map
7
8
  */
8
- export function initLogLevel(filter: string): void;
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
9
10
  /**
10
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
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.
11
13
  *
12
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
13
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
14
- * @returns {WitnessMap} A witness map containing the circuit's return values.
15
- * @param {Uint8Array} program
16
- * @param {WitnessMap} witness_map
17
- * @returns {WitnessMap}
14
+ * @param {Uint8Array} compressed_witness - A compressed witness.
15
+ * @returns {WitnessMap} The decompressed witness map.
18
16
  */
19
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
20
18
  /**
21
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
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
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
22
34
  *
23
35
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
24
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
25
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
26
- * @param {Uint8Array} program
27
- * @param {WitnessMap} solved_witness
28
- * @returns {WitnessMap}
36
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
37
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
38
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
29
39
  */
30
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
40
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
31
41
  /**
32
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
42
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
43
+ * This method also extracts the public return values from the solved witness into its own return witness.
33
44
  *
34
45
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
35
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
36
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
37
- * @param {Uint8Array} program
38
- * @param {WitnessMap} solved_witness
39
- * @returns {WitnessMap}
46
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
47
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
48
+ * @returns {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.
40
49
  */
41
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
50
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
51
+ /**
52
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
53
+ *
54
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
55
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
56
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
57
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
58
+ */
59
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
42
60
  /**
43
61
  * Performs a bitwise AND operation between `lhs` and `rhs`
44
62
  * @param {string} lhs
@@ -90,73 +108,56 @@ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_byte
90
108
  */
91
109
  export function buildInfo(): BuildInfo;
92
110
  /**
93
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
111
+ * Sets the package's logging level.
94
112
  *
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.
113
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
99
114
  */
100
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
115
+ export function initLogLevel(filter: string): void;
101
116
  /**
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.
117
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
104
118
  *
105
119
  * @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
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
122
- *
123
- * @param {WitnessMap} witness_map - A witness map.
124
- * @returns {Uint8Array} A compressed witness map
125
- */
126
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
127
- /**
128
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
129
- * This should be used to only fetch the witness map for the main function.
130
- *
131
- * @param {Uint8Array} compressed_witness - A compressed witness.
132
- * @returns {WitnessMap} The decompressed witness map.
120
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
121
+ * @returns {WitnessMap} A witness map containing the circuit's return values.
122
+ * @param {Uint8Array} program
123
+ * @param {WitnessMap} witness_map
124
+ * @returns {WitnessMap}
133
125
  */
134
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
126
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
135
127
  /**
136
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
128
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
137
129
  *
138
- * @param {WitnessStack} witness_stack - A witness stack.
139
- * @returns {Uint8Array} A compressed witness stack
130
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
131
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
132
+ * @returns {WitnessMap} A witness map containing the circuit's public parameters.
133
+ * @param {Uint8Array} program
134
+ * @param {WitnessMap} solved_witness
135
+ * @returns {WitnessMap}
140
136
  */
141
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
137
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
142
138
  /**
143
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
139
+ * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
144
140
  *
145
- * @param {Uint8Array} compressed_witness - A compressed witness.
146
- * @returns {WitnessStack} The decompressed witness stack.
141
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
142
+ * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
143
+ * @returns {WitnessMap} A witness map containing the circuit's public inputs.
144
+ * @param {Uint8Array} program
145
+ * @param {WitnessMap} solved_witness
146
+ * @returns {WitnessMap}
147
147
  */
148
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
148
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
149
149
 
150
- export type RawAssertionPayload = {
151
- selector: string;
152
- data: string[];
153
- };
150
+ export type ForeignCallInput = string[]
151
+ export type ForeignCallOutput = string | string[]
154
152
 
155
- export type ExecutionError = Error & {
156
- callStack?: string[];
157
- rawAssertionPayload?: RawAssertionPayload;
158
- brilligFunctionId?: number;
159
- };
153
+ /**
154
+ * A callback which performs an foreign call and returns the response.
155
+ * @callback ForeignCallHandler
156
+ * @param {string} name - The identifier for the type of foreign call being performed.
157
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
158
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
159
+ */
160
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
160
161
 
161
162
 
162
163
 
@@ -183,17 +184,16 @@ export type BuildInfo = {
183
184
 
184
185
 
185
186
 
186
- export type ForeignCallInput = string[]
187
- export type ForeignCallOutput = string | string[]
187
+ export type RawAssertionPayload = {
188
+ selector: string;
189
+ data: string[];
190
+ };
188
191
 
189
- /**
190
- * A callback which performs an foreign call and returns the response.
191
- * @callback ForeignCallHandler
192
- * @param {string} name - The identifier for the type of foreign call being performed.
193
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
194
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
195
- */
196
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
192
+ export type ExecutionError = Error & {
193
+ callStack?: string[];
194
+ rawAssertionPayload?: RawAssertionPayload;
195
+ brilligFunctionId?: number;
196
+ };
197
197
 
198
198
 
199
199