@@ -13,7 +13,6 @@ async function getCircuit(name: string) {
13
13
const basePath = resolve ( join ( './circuits' , name ) ) ;
14
14
const fm = createFileManager ( basePath ) ;
15
15
const compiled = await compile ( fm , basePath ) ;
16
- console . log ( compiled . program . abi ) ;
17
16
if ( ! ( 'program' in compiled ) ) {
18
17
throw new Error ( 'Compilation failed' ) ;
19
18
}
@@ -23,21 +22,35 @@ async function getCircuit(name: string) {
23
22
const input1 = { n : 2 } ;
24
23
const input2 = { n : 4 } ;
25
24
25
+ async function fullNoirFromCircuit ( circuitName : string ) : Promise < FullNoir > {
26
+ const circuit : CompiledCircuit = await getCircuit ( 'not_odd' ) ;
27
+ const backend : BarretenbergBackend = new BarretenbergBackend ( circuit , { threads : 8 } ) ;
28
+ const noir : Noir = new Noir ( circuit , backend ) ;
29
+ return { circuit, backend, noir } ;
30
+ }
31
+
32
+ type FullNoir = {
33
+ circuit : CompiledCircuit ,
34
+ backend : BarretenbergBackend ,
35
+ noir : Noir
36
+ }
37
+
26
38
async function start ( ) {
27
- let simpleCircuit : CompiledCircuit = await getCircuit ( 'not_odd' ) ;
28
- let simpleBackend : BarretenbergBackend = new BarretenbergBackend ( simpleCircuit , { threads : 8 } ) ;
29
- let simpleNoir : Noir = new Noir ( simpleCircuit , simpleBackend ) ;
39
+ const simple : FullNoir = await fullNoirFromCircuit ( 'not_odd' ) ;
40
+
41
+ const witness1 = ( await simple . noir . execute ( input1 ) ) . witness ;
42
+ const proof1 : ProofData = await simple . backend . generateProof ( witness1 ) ;
30
43
31
- const witness1 = ( await simpleNoir . execute ( input1 ) ) . witness ;
32
- let proof1 : ProofData = await simpleBackend . generateProof ( witness1 ) ;
44
+ // const witness2 = (await simple.noir. execute(input2 )).witness;
45
+ // const proof2 : ProofData = await simple.backend. generateProof(witness2 );
33
46
34
- const witness2 = ( await simpleNoir . execute ( input2 ) ) . witness ;
35
- let proof2 : ProofData = await simpleBackend . generateProof ( witness2 ) ;
47
+ const { proofAsFields , vkAsFields , vkHash } = await simple . backend . generateRecursiveProofArtifacts ( proof1 , 1 ) ;
48
+ // console.log({ proofAsFields, vkAsFields, vkHash } );
36
49
37
- // let res = await main(/* intermediate proofs */ );
38
- // console.log(res);
50
+ let res = await main ( vkAsFields , proofAsFields , [ "7" ] , vkHash ) ;
51
+ console . log ( res ) ;
39
52
40
- simpleBackend . destroy ( ) ;
53
+ simple . backend . destroy ( ) ;
41
54
}
42
55
43
56
start ( ) ;
0 commit comments