Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(consensus): add timeout when waiting for first proposal message #2758

Open
wants to merge 1 commit into
base: guyn/streams/dont_send_until_id_zero
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion crates/sequencing/papyrus_consensus/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ use crate::types::{
/// messages.
/// - `proposal_receiver`: The channel to receive proposals from the network. Proposals are
/// represented as streams (ProposalInit, Content.*, ProposalFin).
const NEW_RECEIVER_TIMEOUT: Duration = Duration::from_millis(100);

// TODO(dvir): add test for this.
// TODO(Asmaa): Update documentation when we update for the real sync.
#[instrument(skip_all, level = "info")]
Expand Down Expand Up @@ -203,7 +205,12 @@ impl<ContextT: ConsensusContext> MultiHeightManager<ContextT> {
context, height, &mut shc, message, broadcast_channels).await?
},
Some(content_receiver) = proposal_receiver.next() => {
self.handle_proposal(context, height, &mut shc, content_receiver).await?
match tokio::time::timeout(NEW_RECEIVER_TIMEOUT, self.handle_proposal(context, height, &mut shc, content_receiver)).await {
Ok(res) => res?,
Err(_) => {
panic!("Proposal receiver timed out while waiting for first message. ");
}
}
},
Some(shc_event) = shc_events.next() => {
shc.handle_event(context, shc_event).await?
Expand Down
Loading