@@ -44,16 +44,41 @@ export class NargoProver {
4444 return path . join ( this . circuit . root , 'target' , `${ this . circuit . name } .json` ) ;
4545 }
4646
47+ // Paths relative to workspace root (for use when cwd is set to workspace root)
48+ private get workspaceRelativeProofPath ( ) : string {
49+ return path . join ( 'proofs' , `${ this . circuit . name } .proof` ) ;
50+ }
51+
52+ private get workspaceRelativeWitnessPath ( ) : string {
53+ return path . join ( 'target' , `${ this . proverName } .gz` ) ;
54+ }
55+
56+ private get workspaceRelativeBytecodePath ( ) : string {
57+ return path . join ( 'target' , `${ this . circuit . name } .json` ) ;
58+ }
59+
60+ private get workspaceRelativeVkPath ( ) : string {
61+ return path . join ( 'target' , `${ this . circuit . name } .vk.bin` ) ;
62+ }
63+
4764 public async executeProveCommand ( ) : Promise < void > {
65+ // Both nargo and bb run from the workspace root
66+ // All paths are relative to the workspace root
67+ const workspaceRoot = path . resolve ( this . circuit . root ) ;
68+
4869 // Generate witness using nargo execute
49- // Run from the workspace root (circuit.root) where nargo can find the packages
50- // The witness name is specified as a positional argument and will be written to workspace target/
51- await $ ( { cwd : this . circuit . root } ) `nargo execute --package ${ this . circuit . name } --oracle-resolver http://localhost:5555 -p ${ this . proverName } ${ this . proverName } ` ;
70+ await $ ( { cwd : workspaceRoot } ) `nargo execute --package ${ this . circuit . name } --oracle-resolver http://localhost:5555 -p ${ this . proverName } ${ this . proverName } ` ;
5271
5372 // Generate proof from witness using bb
54- // Also run from workspace root so relative paths work correctly
73+ // Pass paths relative to workspace root since we're running from there
5574 const bb = await Barretenberg . create ( ) ;
56- await bb . prove ( this . bytecodePath , this . witnessPath , this . proofPath , this . circuit . vkPath ( ) , this . circuit . root ) ;
75+ await bb . prove (
76+ this . workspaceRelativeBytecodePath ,
77+ this . workspaceRelativeWitnessPath ,
78+ this . workspaceRelativeProofPath ,
79+ this . workspaceRelativeVkPath ,
80+ workspaceRoot
81+ ) ;
5782 }
5883
5984 public async prove ( inputs : InputMap ) : Promise < Hex > {
0 commit comments