@@ -466,82 +466,6 @@ impl<N: Network> StackProgramTypes<N> for Stack<N> {
466466 }
467467}
468468
469- impl < N : Network > Stack < N > {
470- /// Returns `true` if the proving key for the given function name exists.
471- #[ inline]
472- pub fn contains_proving_key ( & self , function_name : & Identifier < N > ) -> bool {
473- self . proving_keys . read ( ) . contains_key ( function_name)
474- }
475-
476- /// Returns `true` if the verifying key for the given function name exists.
477- #[ inline]
478- pub fn contains_verifying_key ( & self , function_name : & Identifier < N > ) -> bool {
479- self . verifying_keys . read ( ) . contains_key ( function_name)
480- }
481-
482- /// Returns the proving key for the given function name.
483- #[ inline]
484- pub fn get_proving_key ( & self , function_name : & Identifier < N > ) -> Result < ProvingKey < N > > {
485- // If the program is 'credits.aleo', try to load the proving key, if it does not exist.
486- self . try_insert_credits_function_proving_key ( function_name) ?;
487- // Return the proving key, if it exists.
488- match self . proving_keys . read ( ) . get ( function_name) {
489- Some ( proving_key) => Ok ( proving_key. clone ( ) ) ,
490- None => bail ! ( "Proving key not found for: {}/{function_name}" , self . program. id( ) ) ,
491- }
492- }
493-
494- /// Returns the verifying key for the given function name.
495- #[ inline]
496- pub fn get_verifying_key ( & self , function_name : & Identifier < N > ) -> Result < VerifyingKey < N > > {
497- // Return the verifying key, if it exists.
498- match self . verifying_keys . read ( ) . get ( function_name) {
499- Some ( verifying_key) => Ok ( verifying_key. clone ( ) ) ,
500- None => bail ! ( "Verifying key not found for: {}/{function_name}" , self . program. id( ) ) ,
501- }
502- }
503-
504- /// Inserts the given proving key for the given function name.
505- #[ inline]
506- pub fn insert_proving_key ( & self , function_name : & Identifier < N > , proving_key : ProvingKey < N > ) -> Result < ( ) > {
507- // Ensure the function name exists in the program.
508- ensure ! (
509- self . program. contains_function( function_name) ,
510- "Function '{function_name}' does not exist in program '{}'." ,
511- self . program. id( )
512- ) ;
513- // Insert the proving key.
514- self . proving_keys . write ( ) . insert ( * function_name, proving_key) ;
515- Ok ( ( ) )
516- }
517-
518- /// Inserts the given verifying key for the given function name.
519- #[ inline]
520- pub fn insert_verifying_key ( & self , function_name : & Identifier < N > , verifying_key : VerifyingKey < N > ) -> Result < ( ) > {
521- // Ensure the function name exists in the program.
522- ensure ! (
523- self . program. contains_function( function_name) ,
524- "Function '{function_name}' does not exist in program '{}'." ,
525- self . program. id( )
526- ) ;
527- // Insert the verifying key.
528- self . verifying_keys . write ( ) . insert ( * function_name, verifying_key) ;
529- Ok ( ( ) )
530- }
531-
532- /// Removes the proving key for the given function name.
533- #[ inline]
534- pub fn remove_proving_key ( & self , function_name : & Identifier < N > ) {
535- self . proving_keys . write ( ) . shift_remove ( function_name) ;
536- }
537-
538- /// Removes the verifying key for the given function name.
539- #[ inline]
540- pub fn remove_verifying_key ( & self , function_name : & Identifier < N > ) {
541- self . verifying_keys . write ( ) . shift_remove ( function_name) ;
542- }
543- }
544-
545469impl < N : Network > Stack < N > {
546470 /// Inserts the proving key if the program ID is 'credits.aleo'.
547471 fn try_insert_credits_function_proving_key ( & self , function_name : & Identifier < N > ) -> Result < ( ) > {
0 commit comments