Skip to content

Commit 5828919

Browse files
Move the wait part to a separate function
1 parent bca9ee1 commit 5828919

File tree

1 file changed

+18
-8
lines changed
  • aggregation_mode/proof_aggregator/src/backend

1 file changed

+18
-8
lines changed

aggregation_mode/proof_aggregator/src/backend/mod.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ impl ProofAggregator {
224224
) -> Result<TransactionReceipt, AggregatedProofSubmissionError> {
225225
retry_function(
226226
|| {
227-
bump_and_send_proof_to_verify_on_chain(
227+
wait_and_send_proof_to_verify_on_chain(
228228
blob.clone(),
229229
blob_versioned_hash,
230230
aggregated_proof.clone(),
@@ -319,15 +319,10 @@ impl ProofAggregator {
319319
}
320320
}
321321

322-
async fn bump_and_send_proof_to_verify_on_chain(
323-
blob: BlobTransactionSidecar,
324-
blob_versioned_hash: [u8; 32],
325-
aggregated_proof: AlignedProof,
322+
async fn wait_until_can_submit_aggregated_proof(
326323
proof_aggregation_service: AlignedProofAggregationServiceContract,
327-
sp1_chunk_aggregator_vk_hash_bytes: [u8; 32],
328-
risc0_chunk_aggregator_image_id_bytes: [u8; 32],
329324
monthly_budget_eth: f64,
330-
) -> Result<TransactionReceipt, RetryError<AggregatedProofSubmissionError>> {
325+
) -> Result<(), RetryError<AggregatedProofSubmissionError>> {
331326
// We start on 24 hours because the proof aggregator runs once a day, so the time elapsed
332327
// should be considered over a 24h period.
333328
let mut time_elapsed = Duration::from_secs(24 * 3600);
@@ -359,6 +354,21 @@ async fn bump_and_send_proof_to_verify_on_chain(
359354
sleep(time_to_sleep);
360355
}
361356

357+
Ok(())
358+
}
359+
360+
async fn wait_and_send_proof_to_verify_on_chain(
361+
blob: BlobTransactionSidecar,
362+
blob_versioned_hash: [u8; 32],
363+
aggregated_proof: AlignedProof,
364+
proof_aggregation_service: AlignedProofAggregationServiceContract,
365+
sp1_chunk_aggregator_vk_hash_bytes: [u8; 32],
366+
risc0_chunk_aggregator_image_id_bytes: [u8; 32],
367+
monthly_budget_eth: f64,
368+
) -> Result<TransactionReceipt, RetryError<AggregatedProofSubmissionError>> {
369+
wait_until_can_submit_aggregated_proof(proof_aggregation_service.clone(), monthly_budget_eth)
370+
.await?;
371+
362372
info!("Sending proof to ProofAggregationService contract...");
363373

364374
let tx_req = match aggregated_proof {

0 commit comments

Comments
 (0)