Skip to content

Commit 5c72ded

Browse files
committed
WIP outer proof
1 parent ebb3ed1 commit 5c72ded

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

how-to/recursive-proofs/circuits/recurseNode/src/main.nr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use dep::std;
22

33
fn main(
44
verification_key: [Field; 114],
5-
public_inputs: pub [Field; 6],
5+
public_inputs: pub [Field; 2],
66
key_hash: Field,
77
proof: [Field; 109]
88
) -> pub u64 {
@@ -13,5 +13,5 @@ fn main(
1313
public_inputs.as_slice(),
1414
key_hash
1515
);
16-
public_inputs[5] as u64
16+
public_inputs[1] as u64
1717
}

how-to/recursive-proofs/main.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ type FullNoir = {
3636

3737
async function start() {
3838
const leaf: FullNoir = await fullNoirFromCircuit('sum');
39+
const recurseLeaf: FullNoir = await fullNoirFromCircuit('recurseLeaf');
40+
const recurseNode: FullNoir = await fullNoirFromCircuit('recurseNode');
3941

4042
const leafParams = { a: 1, b: 3 };
4143
let numPubInputs = 2;
@@ -50,14 +52,11 @@ async function start() {
5052
numPubInputs + 1 // +1 for public return
5153
);
5254

53-
5455
let pub_inputs: string[] = [
5556
...(Object.values(leafParams).map(n => Number(n).toString())),
5657
Number(returnValue).toString()
5758
];
5859

59-
let recurseLeaf: FullNoir = await fullNoirFromCircuit('recurseLeaf');
60-
6160
const a = returnValue;
6261
const b = 5;
6362

@@ -78,17 +77,16 @@ async function start() {
7877
innerProof2,
7978
numPubInputs + 1 + 16 // +1 for public return +16 for hidden aggregation object
8079
);
81-
console.log("artifacts2 generated.");
8280

8381
// Generate and verify outer proof
8482
const outerParams = {
8583
verification_key: artifacts2.vkAsFields,
86-
public_inputs: [1, 3, 4, returnValue].map.toString(), // returns proven sum
84+
public_inputs: [pub_inputs.map.toString(), returnValue.toString()], // returns proven sum
8785
key_hash: artifacts2.vkHash,
8886
proof: artifacts2.proofAsFields
8987
};
9088

91-
const recurseNode: FullNoir = await fullNoirFromCircuit('recurseNode');
89+
console.log("Executing...");
9290
({ witness, returnValue } = await recurseNode.noir.execute(outerParams));
9391
console.log("Generating outer proof...");
9492
const outerProof: ProofData = await recurseNode.backend.generateProof(witness);

0 commit comments

Comments
 (0)