@@ -32,7 +32,7 @@ enum AggregatedProofSubmissionError {
3232 Aggregation ( ProofAggregationError ) ,
3333 SendBlobTransaction ,
3434 SendVerifyAggregatedProofTransaction ( alloy:: contract:: Error ) ,
35- GettingReceiptVerifyAggregatedProofTransaction ( PendingTransactionError ) ,
35+ ReceiptError ( PendingTransactionError ) ,
3636}
3737
3838pub struct ProofAggregator {
@@ -48,6 +48,7 @@ pub struct Config {
4848 pub private_key : String ,
4949 pub submit_proofs_every_secs : u64 ,
5050 pub max_proofs_in_queue : u16 ,
51+ pub proof_aggregation_service_address : String ,
5152}
5253
5354impl ProofAggregator {
@@ -56,8 +57,11 @@ impl ProofAggregator {
5657 let signer = PrivateKeySigner :: from_str ( & config. private_key ) . expect ( "valid string" ) ;
5758 let wallet = EthereumWallet :: from ( signer) ;
5859 let provider = ProviderBuilder :: new ( ) . wallet ( wallet) . on_http ( rpc_url) ;
59- let proof_aggregation_service =
60- AlignedProofAggregationService :: new ( Address :: default ( ) , provider) ;
60+ let proof_aggregation_service = AlignedProofAggregationService :: new (
61+ Address :: from_str ( & config. proof_aggregation_service_address )
62+ . expect ( "Address to be correct" ) ,
63+ provider,
64+ ) ;
6165
6266 Self {
6367 engine : ZKVMEngine :: SP1 ,
@@ -84,7 +88,9 @@ impl ProofAggregator {
8488 }
8589 Err ( err) => {
8690 error ! ( "Error while aggregating and submitting proofs: {:?}" , err) ;
87- self . set_aggregated_proof_as_missed ( ) . await ;
91+ if let Err ( err) = self . set_aggregated_proof_as_missed ( ) . await {
92+ error ! ( "Error while marking proof as failed: {:?}" , err) ;
93+ } ;
8894 }
8995 } ;
9096 }
@@ -165,15 +171,14 @@ impl ProofAggregator {
165171 proof. proof . bytes ( ) . into ( ) ,
166172 )
167173 . send ( )
168- // sign with aggregator wallet
169174 . await
170175 . map_err (
171176 AggregatedProofSubmissionError :: SendVerifyAggregatedProofTransaction ,
172177 ) ?;
173178
174- res. get_receipt ( ) . await . map_err (
175- AggregatedProofSubmissionError :: GettingReceiptVerifyAggregatedProofTransaction ,
176- )
179+ res. get_receipt ( )
180+ . await
181+ . map_err ( AggregatedProofSubmissionError :: ReceiptError )
177182 }
178183 }
179184 }
@@ -186,6 +191,18 @@ impl ProofAggregator {
186191 Ok ( [ 0u8 ; 32 ] )
187192 }
188193
189- // TODO
190- async fn set_aggregated_proof_as_missed ( & self ) { }
194+ async fn set_aggregated_proof_as_missed (
195+ & self ,
196+ ) -> Result < TransactionReceipt , AggregatedProofSubmissionError > {
197+ let res = self
198+ . proof_aggregation_service
199+ . markCurrentAggregatedProofAsMissed ( )
200+ . send ( )
201+ . await
202+ . map_err ( AggregatedProofSubmissionError :: SendVerifyAggregatedProofTransaction ) ?;
203+
204+ res. get_receipt ( )
205+ . await
206+ . map_err ( AggregatedProofSubmissionError :: ReceiptError )
207+ }
191208}
0 commit comments