Skip to content

Commit 3b72388

Browse files
authored
apollo_consensus: small fixes (#11076)
1 parent 168c013 commit 3b72388

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

crates/apollo_consensus/src/manager.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
474474
CONSENSUS_BLOCK_NUMBER.set_lossy(height.0);
475475
self.cache.report_max_cached_block_number_metric(height);
476476

477-
if let Some(sync_result) = self.check_and_wait_for_sync(context, height).await? {
477+
if let Some(sync_result) = self.check_and_wait_for_sync(context, height).await {
478478
return Ok(sync_result);
479479
}
480480

@@ -501,12 +501,12 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
501501
}
502502

503503
/// Check if we need to sync and wait if necessary.
504-
/// Returns Some(RunHeightRes::Sync) if sync is needed, None otherwise.
504+
/// Returns Some(RunHeightRes::Sync) if sync height was learned via sync, None otherwise.
505505
async fn check_and_wait_for_sync(
506506
&mut self,
507507
context: &mut ContextT,
508508
height: BlockNumber,
509-
) -> Result<Option<RunHeightRes>, ConsensusError> {
509+
) -> Option<RunHeightRes> {
510510
// If we already voted for this height, do not proceed until we sync to this height.
511511
// Otherwise, just check if we can sync to this height, immediately. If not, proceed with
512512
// consensus.
@@ -522,11 +522,11 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
522522
self.last_voted_height_at_initialization.unwrap().0
523523
);
524524
self.wait_until_sync_reaches_height(height, context).await;
525-
return Ok(Some(RunHeightRes::Sync));
525+
return Some(RunHeightRes::Sync);
526526
} else if context.try_sync(height).await {
527-
return Ok(Some(RunHeightRes::Sync));
527+
return Some(RunHeightRes::Sync);
528528
}
529-
Ok(None)
529+
None
530530
}
531531

532532
/// Initialize consensus for a height: get validators, create SHC, and set up events.

crates/apollo_consensus_orchestrator/src/sequencer_consensus_context.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,9 @@ impl SequencerConsensusContext {
891891
async fn interrupt_active_proposal(&mut self) {
892892
if let Some((token, handle)) = self.active_proposal.take() {
893893
token.cancel();
894-
handle.await.expect("Proposal task failed, propagating panic");
894+
if let Err(e) = handle.await {
895+
warn!("Proposal task finished unexpectedly: {e:?}");
896+
}
895897
}
896898
}
897899
}

0 commit comments

Comments
 (0)