@@ -26,7 +26,6 @@ use merkle_tree::compute_proofs_merkle_root;
2626use risc0_ethereum_contracts:: encode_seal;
2727use std:: thread:: sleep;
2828use std:: { str:: FromStr , time:: Duration } ;
29- use tokio:: time:: Instant ;
3029use tracing:: { error, info, warn} ;
3130use types:: { AlignedProofAggregationService , AlignedProofAggregationServiceContract } ;
3231
@@ -142,8 +141,7 @@ impl ProofAggregator {
142141 ) ;
143142
144143 // Iterate until we can send the proof on-chain
145- let mut time_elapsed: Duration =
146- Instant :: now ( ) . duration_since ( start_time) + Duration :: from_secs ( 24 * 3600 ) ;
144+ let mut time_elapsed: Duration = Duration :: from_secs ( 24 * 3600 ) ;
147145
148146 loop {
149147 // We add 24 hours because the proof aggregator runs once a day, so the time elapsed
@@ -156,15 +154,6 @@ impl ProofAggregator {
156154 self . config . monthly_budget_eth ,
157155 gas_price. into ( ) ,
158156 ) {
159- info ! ( "Sending proof to ProofAggregationService contract..." ) ;
160- let receipt = self
161- . send_proof_to_verify_on_chain ( & blob, blob_versioned_hash, & aggregated_proof)
162- . await ?;
163- info ! (
164- "Proof sent and verified, tx hash {:?}" ,
165- receipt. transaction_hash
166- ) ;
167-
168157 break ;
169158 } else {
170159 info ! ( "Skipping sending proof to ProofAggregationService contract due to budget/time constraints." ) ;
@@ -176,6 +165,15 @@ impl ProofAggregator {
176165 sleep ( time_to_sleep) ;
177166 }
178167
168+ info ! ( "Sending proof to ProofAggregationService contract..." ) ;
169+ let receipt = self
170+ . send_proof_to_verify_on_chain ( blob, blob_versioned_hash, aggregated_proof)
171+ . await ?;
172+ info ! (
173+ "Proof sent and verified, tx hash {:?}" ,
174+ receipt. transaction_hash
175+ ) ;
176+
179177 Ok ( ( ) )
180178 }
181179
@@ -220,9 +218,9 @@ impl ProofAggregator {
220218
221219 async fn send_proof_to_verify_on_chain (
222220 & self ,
223- blob : & BlobTransactionSidecar ,
221+ blob : BlobTransactionSidecar ,
224222 blob_versioned_hash : [ u8 ; 32 ] ,
225- aggregated_proof : & AlignedProof ,
223+ aggregated_proof : AlignedProof ,
226224 ) -> Result < TransactionReceipt , AggregatedProofSubmissionError > {
227225 let tx_req = match aggregated_proof {
228226 AlignedProof :: SP1 ( proof) => self
@@ -232,7 +230,7 @@ impl ProofAggregator {
232230 proof. proof_with_pub_values . public_values . to_vec ( ) . into ( ) ,
233231 proof. proof_with_pub_values . bytes ( ) . into ( ) ,
234232 )
235- . sidecar ( blob. clone ( ) )
233+ . sidecar ( blob)
236234 . into_transaction_request ( ) ,
237235 AlignedProof :: Risc0 ( proof) => {
238236 let encoded_seal = encode_seal ( & proof. receipt ) . map_err ( |e| {
@@ -242,9 +240,9 @@ impl ProofAggregator {
242240 . verifyRisc0 (
243241 blob_versioned_hash. into ( ) ,
244242 encoded_seal. into ( ) ,
245- proof. receipt . journal . bytes . clone ( ) . into ( ) ,
243+ proof. receipt . journal . bytes . into ( ) ,
246244 )
247- . sidecar ( blob. clone ( ) )
245+ . sidecar ( blob)
248246 . into_transaction_request ( )
249247 }
250248 } ;
0 commit comments