|
1 | 1 | import type { ProofData } from "@aztec/bb.js"; |
2 | 2 | import type { CompiledCircuit } from "@noir-lang/noir_js"; |
3 | | -import { chunk } from "lodash-es"; |
4 | 3 | import { spawn } from "node:child_process"; |
5 | 4 | import fs from "node:fs"; |
6 | 5 | import path from "node:path"; |
7 | | -import { Hex } from "ox"; |
8 | | -import { assert } from "ts-essentials"; |
| 6 | +import { readNativeHonkProof } from "./utils.js"; |
9 | 7 |
|
10 | 8 | export class NativeUltraHonkBackend { |
11 | 9 | constructor( |
@@ -62,22 +60,7 @@ export class NativeUltraHonkBackend { |
62 | 60 | reject(new Error(`Process exited with code ${code}`)); |
63 | 61 | return; |
64 | 62 | } |
65 | | - |
66 | | - const proof = fs.readFileSync(path.join(proofOutputPath, "proof")); |
67 | | - const publicInputs = fs.readFileSync( |
68 | | - path.join(proofOutputPath, "public_inputs"), |
69 | | - ); |
70 | | - assert( |
71 | | - publicInputs.length % 32 === 0, |
72 | | - "publicInputs length must be divisible by 32", |
73 | | - ); |
74 | | - resolve({ |
75 | | - proof, |
76 | | - // TODO: not sure if this publicInputs decoding is correct |
77 | | - publicInputs: chunk(Array.from(publicInputs), 32).map((x) => |
78 | | - Hex.fromBytes(Uint8Array.from(x)), |
79 | | - ), |
80 | | - }); |
| 63 | + resolve(readNativeHonkProof(proofOutputPath)); |
81 | 64 | }); |
82 | 65 |
|
83 | 66 | bbProcess.on("error", (err) => { |
|
0 commit comments