Skip to content

Commit 2558dc9

Browse files
committed
minor updates to recursive howto script (exception)
1 parent 53a91e0 commit 2558dc9

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

how-to/recursive-proofs/main.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ async function getCircuit(name: string) {
1919
return compiled.program;
2020
}
2121

22+
const cores = 12;
23+
2224
async function fullNoirFromCircuit(circuitName: string): Promise<FullNoir> {
2325
const circuit: CompiledCircuit = await getCircuit(circuitName);
24-
const backend: BarretenbergBackend = new BarretenbergBackend(circuit, { threads: 8 });
26+
const backend: BarretenbergBackend = new BarretenbergBackend(circuit, { threads: cores });
2527
const noir: Noir = new Noir(circuit, backend);
2628
return { circuit, backend, noir };
2729
}
@@ -50,7 +52,6 @@ async function start() {
5052
simple.backend.destroy();
5153

5254
// Generate and verify outer proof
53-
console.log("Generating outer proof...");
5455
const outerInput = {
5556
verification_key: artifacts1.vkAsFields,
5657
public_inputs: ["1"], // expect output of inner call to be "true"
@@ -61,11 +62,16 @@ async function start() {
6162
const outerWitness = (await outer.noir.execute(
6263
outerInput
6364
)).witness;
64-
const outerProof: ProofData = await outer.backend.generateProof(outerWitness);
65-
66-
console.log("Verifying outer proof...");
67-
const res: boolean = await outer.backend.verifyProof(outerProof);
68-
console.log("Verification", res ? "PASSED" : "failed");
65+
try {
66+
console.log("Generating outer proof...");
67+
const outerProof: ProofData = await outer.backend.generateProof(outerWitness);
68+
console.log("Verifying outer proof...");
69+
const res: boolean = await outer.backend.verifyProof(outerProof);
70+
console.log("Verification", res ? "PASSED" : "failed");
71+
}
72+
catch (e) {
73+
console.log(e);
74+
}
6975

7076
outer.backend.destroy();
7177
}

0 commit comments

Comments
 (0)