@noir-lang/noir_js 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/program.cjs CHANGED
@@ -74,9 +74,10 @@ class Noir {
74
74
  */
75
75
  async execute(inputs, foreignCallHandler) {
76
76
  await this.init();
77
- const witness = await (0, witness_generation_js_1.generateWitness)(this.circuit, inputs, foreignCallHandler);
78
- const { return_value: returnValue } = (0, noirc_abi_1.abiDecode)(this.circuit.abi, witness);
79
- return { witness: (0, acvm_js_1.compressWitness)(witness), returnValue };
77
+ const witness_stack = await (0, witness_generation_js_1.generateWitness)(this.circuit, inputs, foreignCallHandler);
78
+ const main_witness = witness_stack[0].witness;
79
+ const { return_value: returnValue } = (0, noirc_abi_1.abiDecode)(this.circuit.abi, main_witness);
80
+ return { witness: (0, acvm_js_1.compressWitnessStack)(witness_stack), returnValue };
80
81
  }
81
82
  /**
82
83
  *
package/lib/program.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { generateWitness } from "./witness_generation.mjs";
2
2
  import initAbi, { abiDecode } from '@noir-lang/noirc_abi';
3
- import initACVM, { compressWitness } from '@noir-lang/acvm_js';
3
+ import initACVM, { compressWitnessStack } from '@noir-lang/acvm_js';
4
4
  export class Noir {
5
5
  circuit;
6
6
  backend;
@@ -48,9 +48,10 @@ export class Noir {
48
48
  */
49
49
  async execute(inputs, foreignCallHandler) {
50
50
  await this.init();
51
- const witness = await generateWitness(this.circuit, inputs, foreignCallHandler);
52
- const { return_value: returnValue } = abiDecode(this.circuit.abi, witness);
53
- return { witness: compressWitness(witness), returnValue };
51
+ const witness_stack = await generateWitness(this.circuit, inputs, foreignCallHandler);
52
+ const main_witness = witness_stack[0].witness;
53
+ const { return_value: returnValue } = abiDecode(this.circuit.abi, main_witness);
54
+ return { witness: compressWitnessStack(witness_stack), returnValue };
54
55
  }
55
56
  /**
56
57
  *
@@ -35,7 +35,7 @@ async function generateWitness(compiledProgram, inputs, foreignCallHandler = def
35
35
  // Execute the circuit to generate the rest of the witnesses and serialize
36
36
  // them into a Uint8Array.
37
37
  try {
38
- const solvedWitness = await (0, acvm_js_1.executeCircuitWithBlackBoxSolver)(await getSolver(), (0, base64_decode_js_1.base64Decode)(compiledProgram.bytecode), witnessMap, foreignCallHandler);
38
+ const solvedWitness = await (0, acvm_js_1.executeProgramWithBlackBoxSolver)(await getSolver(), (0, base64_decode_js_1.base64Decode)(compiledProgram.bytecode), witnessMap, foreignCallHandler);
39
39
  return solvedWitness;
40
40
  }
41
41
  catch (err) {
@@ -1,4 +1,4 @@
1
1
  import { InputMap } from '@noir-lang/noirc_abi';
2
- import { WitnessMap, ForeignCallHandler } from '@noir-lang/acvm_js';
2
+ import { WitnessStack, ForeignCallHandler } from '@noir-lang/acvm_js';
3
3
  import { CompiledCircuit } from '@noir-lang/types';
4
- export declare function generateWitness(compiledProgram: CompiledCircuit, inputs: InputMap, foreignCallHandler?: ForeignCallHandler): Promise<WitnessMap>;
4
+ export declare function generateWitness(compiledProgram: CompiledCircuit, inputs: InputMap, foreignCallHandler?: ForeignCallHandler): Promise<WitnessStack>;
@@ -1,6 +1,6 @@
1
1
  import { abiEncode } from '@noir-lang/noirc_abi';
2
2
  import { base64Decode } from "./base64_decode.mjs";
3
- import { createBlackBoxSolver, executeCircuitWithBlackBoxSolver, } from '@noir-lang/acvm_js';
3
+ import { createBlackBoxSolver, executeProgramWithBlackBoxSolver, } from '@noir-lang/acvm_js';
4
4
  let solver;
5
5
  const getSolver = () => {
6
6
  if (!solver) {
@@ -32,7 +32,7 @@ export async function generateWitness(compiledProgram, inputs, foreignCallHandle
32
32
  // Execute the circuit to generate the rest of the witnesses and serialize
33
33
  // them into a Uint8Array.
34
34
  try {
35
- const solvedWitness = await executeCircuitWithBlackBoxSolver(await getSolver(), base64Decode(compiledProgram.bytecode), witnessMap, foreignCallHandler);
35
+ const solvedWitness = await executeProgramWithBlackBoxSolver(await getSolver(), base64Decode(compiledProgram.bytecode), witnessMap, foreignCallHandler);
36
36
  return solvedWitness;
37
37
  }
38
38
  catch (err) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "contributors": [
4
4
  "The Noir Team <team@noir-lang.org>"
5
5
  ],
6
- "version": "0.28.0",
6
+ "version": "0.29.0",
7
7
  "packageManager": "yarn@3.5.1",
8
8
  "license": "(MIT OR Apache-2.0)",
9
9
  "type": "module",
@@ -17,9 +17,9 @@
17
17
  "url": "https://github.com/noir-lang/noir/issues"
18
18
  },
19
19
  "dependencies": {
20
- "@noir-lang/acvm_js": "0.44.0",
21
- "@noir-lang/noirc_abi": "0.28.0",
22
- "@noir-lang/types": "0.28.0"
20
+ "@noir-lang/acvm_js": "0.45.0",
21
+ "@noir-lang/noirc_abi": "0.29.0",
22
+ "@noir-lang/types": "0.29.0"
23
23
  },
24
24
  "files": [
25
25
  "lib",