@@ -20,7 +20,7 @@ use config::Config;
2020use fetcher:: { ProofsFetcher , ProofsFetcherError } ;
2121use merkle_tree:: compute_proofs_merkle_root;
2222use sp1_sdk:: HashableKey ;
23- use std:: { str:: FromStr , time :: Duration } ;
23+ use std:: str:: FromStr ;
2424use tracing:: { error, info, warn} ;
2525use types:: { AlignedProofAggregationService , AlignedProofAggregationServiceContract } ;
2626
@@ -35,7 +35,6 @@ pub enum AggregatedProofSubmissionError {
3535
3636pub struct ProofAggregator {
3737 engine : ZKVMEngine ,
38- submit_proof_every_secs : u64 ,
3938 proof_aggregation_service : AlignedProofAggregationServiceContract ,
4039 fetcher : ProofsFetcher ,
4140}
@@ -59,37 +58,29 @@ impl ProofAggregator {
5958
6059 Self {
6160 engine : ZKVMEngine :: SP1 ,
62- submit_proof_every_secs : config. submit_proofs_every_secs ,
6361 proof_aggregation_service,
6462 fetcher,
6563 }
6664 }
6765
6866 pub async fn start ( & mut self ) {
69- info ! (
70- "Starting proof aggregator service, configured to run every {}" ,
71- self . submit_proof_every_secs
72- ) ;
67+ info ! ( "Starting proof aggregator service" , ) ;
68+
69+ info ! ( "About to aggregate and submit proof to be verified on chain" ) ;
70+ let res = self . aggregate_and_submit_proofs_on_chain ( ) . await ;
7371
74- loop {
75- tokio:: time:: sleep ( Duration :: from_secs ( self . submit_proof_every_secs ) ) . await ;
76- info ! ( "About to aggregate and submit proof to be verified on chain" ) ;
77- let res = self . aggregate_and_submit_proofs_on_chain ( ) . await ;
78-
79- match res {
80- Ok ( ( ) ) => {
81- info ! (
82- "Finished iteration, next aggregated proof is in {} seconds" ,
83- self . submit_proof_every_secs
84- ) ;
85- }
86- Err ( err) => {
87- error ! ( "Error while aggregating and submitting proofs: {:?}" , err) ;
88- if let Err ( err) = self . set_aggregated_proof_as_missed ( ) . await {
89- error ! ( "Error while marking proof as failed: {:?}" , err) ;
90- } ;
91- }
92- } ;
72+ match res {
73+ Ok ( ( ) ) => {
74+ info ! ( "Process finished successfully" ) ;
75+ }
76+ Err ( err) => {
77+ error ! ( "Error while aggregating and submitting proofs: {:?}" , err) ;
78+ info ! ( "About to set aggregated proof as missed" ) ;
79+ if let Err ( err) = self . set_aggregated_proof_as_missed ( ) . await {
80+ error ! ( "Error while marking proof as failed: {:?}" , err) ;
81+ } ;
82+ info ! ( "Proofs set as missed" ) ;
83+ }
9384 }
9485 }
9586
@@ -103,7 +94,7 @@ impl ProofAggregator {
10394 . map_err ( AggregatedProofSubmissionError :: FetchingProofs ) ?;
10495
10596 if proofs. len ( ) == 0 {
106- warn ! ( "No proofs in queue , skipping iteration ..." ) ;
97+ warn ! ( "No proofs collected , skipping aggregation ..." ) ;
10798 return Ok ( ( ) ) ;
10899 }
109100
0 commit comments