11pub mod config;
22pub mod fetcher;
33mod merkle_tree;
4- pub mod queue;
54mod s3;
65mod types;
76
@@ -18,28 +17,27 @@ use alloy::{
1817 signers:: local:: LocalSigner ,
1918} ;
2019use config:: Config ;
21- use fetcher:: ProofsFetcher ;
20+ use fetcher:: { ProofsFetcher , ProofsFetcherError } ;
2221use merkle_tree:: compute_proofs_merkle_root;
23- use queue:: ProofsQueue ;
2422use sp1_sdk:: HashableKey ;
2523use std:: { str:: FromStr , time:: Duration } ;
2624use tracing:: { error, info, warn} ;
2725use types:: { AlignedProofAggregationService , AlignedProofAggregationServiceContract } ;
2826
2927#[ derive( Debug ) ]
30- enum AggregatedProofSubmissionError {
28+ pub enum AggregatedProofSubmissionError {
3129 Aggregation ( ProofAggregationError ) ,
3230 SendBlobTransaction ,
3331 SendVerifyAggregatedProofTransaction ( alloy:: contract:: Error ) ,
3432 ReceiptError ( PendingTransactionError ) ,
33+ FetchingProofs ( ProofsFetcherError ) ,
3534}
3635
3736pub struct ProofAggregator {
3837 engine : ZKVMEngine ,
3938 submit_proof_every_secs : u64 ,
4039 proof_aggregation_service : AlignedProofAggregationServiceContract ,
4140 fetcher : ProofsFetcher ,
42- queue : ProofsQueue ,
4341}
4442
4543impl ProofAggregator {
@@ -63,7 +61,6 @@ impl ProofAggregator {
6361 engine : ZKVMEngine :: SP1 ,
6462 submit_proof_every_secs : config. submit_proofs_every_secs ,
6563 proof_aggregation_service,
66- queue : ProofsQueue :: new ( config. max_proofs_in_queue ) ,
6764 fetcher,
6865 }
6966 }
@@ -99,8 +96,11 @@ impl ProofAggregator {
9996 async fn aggregate_and_submit_proofs_on_chain (
10097 & mut self ,
10198 ) -> Result < ( ) , AggregatedProofSubmissionError > {
102- self . fetcher . fetch ( & mut self . queue ) . await ;
103- let proofs = self . queue . clear ( ) ;
99+ let proofs = self
100+ . fetcher
101+ . fetch ( )
102+ . await
103+ . map_err ( AggregatedProofSubmissionError :: FetchingProofs ) ?;
104104
105105 if proofs. len ( ) == 0 {
106106 warn ! ( "No proofs in queue, skipping iteration..." ) ;
@@ -130,14 +130,14 @@ impl ProofAggregator {
130130
131131 info ! ( "Sending blob transaction..." ) ;
132132 let blob_tx_hash = self . send_blob_transaction ( leaves) . await ?;
133- info ! ( "Blob transaction sen , hash: {:?}" , blob_tx_hash) ;
133+ info ! ( "Blob transaction sent , hash: {:?}" , blob_tx_hash) ;
134134
135135 info ! ( "Sending proof to ProofAggregationService contract..." ) ;
136136 let receipt = self
137137 . send_proof_to_verify_on_chain ( & blob_tx_hash, output. proof )
138138 . await ?;
139139 info ! (
140- "Proof sent anv verified, tx hash {:?}" ,
140+ "Proof sent and verified, tx hash {:?}" ,
141141 receipt. transaction_hash
142142 ) ;
143143
@@ -175,7 +175,7 @@ impl ProofAggregator {
175175 // TODO
176176 async fn send_blob_transaction (
177177 & self ,
178- leaves : Vec < [ u8 ; 32 ] > ,
178+ _leaves : Vec < [ u8 ; 32 ] > ,
179179 ) -> Result < [ u8 ; 32 ] , AggregatedProofSubmissionError > {
180180 Ok ( [ 0u8 ; 32 ] )
181181 }
0 commit comments