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

[Stability] Cancel polling for old votes #2223

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 0 additions & 4 deletions crates/hotshot/src/tasks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,6 @@ pub async fn add_consensus_task<TYPES: NodeType, I: NodeImplementation<TYPES>>(
.quorum_network
.inject_consensus_info(ConsensusIntentEvent::PollForCurrentProposal)
.await;
consensus_state
.quorum_network
.inject_consensus_info(ConsensusIntentEvent::PollForProposal(1))
.await;
let filter = FilterEvent(Arc::new(consensus_event_filter));
let consensus_name = "Consensus Task";
let consensus_event_handler = HandleEvent(Arc::new(
Expand Down
28 changes: 26 additions & 2 deletions crates/task-impls/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +
match event {
HotShotEvent::QuorumProposalRecv(proposal, sender) => {
debug!(
"Receved Quorum Propsoal for view {}",
"Receved Quorum Proposal for view {}",
*proposal.data.view_number
);

Expand Down Expand Up @@ -840,6 +840,13 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +
debug!("QC Formed event happened!");

if let either::Right(qc) = cert.clone() {
// cancel poll for votes
self.quorum_network
.inject_consensus_info(ConsensusIntentEvent::CancelPollForVotes(
*qc.view_number,
))
.await;

debug!(
"Attempting to publish proposal after forming a TC for view {}",
*qc.view_number
Expand All @@ -861,6 +868,13 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +
let mut consensus = self.consensus.write().await;
consensus.high_qc = qc.clone();

// cancel poll for votes
self.quorum_network
.inject_consensus_info(ConsensusIntentEvent::CancelPollForVotes(
*qc.view_number,
))
.await;

drop(consensus);
debug!(
"Attempting to publish proposal after forming a QC for view {}",
Expand All @@ -883,6 +897,10 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +
.inject_consensus_info(ConsensusIntentEvent::CancelPollForDAC(*view))
.await;

self.committee_network
.inject_consensus_info(ConsensusIntentEvent::CancelPollForVotes(*view))
.await;

self.da_certs.insert(view, cert);

if self.vote_if_able().await {
Expand Down Expand Up @@ -975,6 +993,11 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +
return;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cancel poll for proposal here too, I think

// cancel poll for votes
self.quorum_network
.inject_consensus_info(ConsensusIntentEvent::CancelPollForVotes(*view))
.await;

let vote = TimeoutVote::create_signed_vote(
TimeoutData { view },
view,
Expand All @@ -997,7 +1020,8 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +
let high_qc = self.consensus.read().await.high_qc.clone();
let leader_view = high_qc.get_view_number() + 1;
if self.quorum_membership.get_leader(leader_view) == self.public_key {
self.publish_proposal_if_able(high_qc, leader_view, None).await;
self.publish_proposal_if_able(high_qc, leader_view, None)
.await;
}
}
_ => {}
Expand Down
12 changes: 12 additions & 0 deletions crates/task-impls/src/view_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,11 @@ impl<
return;
}

// cancel poll for votes
self.network
.inject_consensus_info(ConsensusIntentEvent::CancelPollForVotes(*view_number))
.await;

self.num_timeouts_tracked += 1;
error!(
"Num timeouts tracked since last view change is {}. View {} timed out",
Expand Down Expand Up @@ -782,6 +787,13 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, A: ConsensusApi<TYPES, I> +
return (None, self);
}

// cancel poll for votes
self.network
rob-maron marked this conversation as resolved.
Show resolved Hide resolved
.inject_consensus_info(ConsensusIntentEvent::CancelPollForVotes(
*certificate.view_number,
))
.await;

self.phase = last_seen_certificate;

if certificate.get_data().relay > self.relay {
Expand Down
Loading