Skip to content

Commit

Permalink
Address Akosh's comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mb1896 committed Mar 28, 2024
1 parent 6c9a93e commit a46a84b
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions ipc/provider/src/checkpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::config::Subnet;
use crate::manager::{BottomUpCheckpointRelayer, EthSubnetManager};
use anyhow::{anyhow, Result};
use futures_util::future::join_all;
use futures_util::future::try_join_all;
use fvm_shared::address::Address;
use fvm_shared::clock::ChainEpoch;
use ipc_api::checkpoint::{BottomUpCheckpointBundle, QuorumReachedEvent};
Expand Down Expand Up @@ -190,29 +190,30 @@ impl<T: BottomUpCheckpointRelayer + Send + Sync + 'static> BottomUpCheckpointMan
.await
.unwrap();
all_submit_tasks.push(tokio::task::spawn(async move {
match Self::submit_checkpoint(parent_handler_clone, submitter, bundle, event)
.await
let height = event.height;
if let Err(e) =
Self::submit_checkpoint(parent_handler_clone, submitter, bundle, event)
.await
{
Ok(()) => {
log::debug!("Successfully submitted checkpoint");
}
Err(_err) => {
log::debug!("Failed to submit checkpoint");
}
log::error!("Fail to submit checkpoint at height {height}: {e}");
drop(submission_permit);
Err(e)
} else {
drop(submission_permit);
Ok(())
}
drop(submission_permit);
}));

count += 1;
log::debug!(
"This round has asynchronously submitted {:} checkpoints",
count
"This round has asynchronously submitted {count} checkpoints",
);
}
}

log::debug!("Waiting for all submissions to finish");
join_all(all_submit_tasks).await;
// Return error if any of the submit task failed.
try_join_all(all_submit_tasks).await?;

Ok(())
}
Expand All @@ -233,7 +234,7 @@ impl<T: BottomUpCheckpointRelayer + Send + Sync + 'static> BottomUpCheckpointMan
.await
.map_err(|e| {
anyhow!(
"cannot submit bottom up checkpoint at height {} due to: {e:}",
"cannot submit bottom up checkpoint at height {} due to: {e}",
event.height
)
})?;
Expand Down

0 comments on commit a46a84b

Please sign in to comment.