Skip to content

Commit

Permalink
Cancel polling for retrieved items (#2031)
Browse files Browse the repository at this point in the history
* cancel polling for retrieved items

* move DAC cancel
  • Loading branch information
rob-maron authored Nov 14, 2023
1 parent e6c5715 commit 15377d1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
15 changes: 14 additions & 1 deletion crates/task-impls/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,14 @@ where
*proposal.data.view_number
);

// stop polling for the received proposal
self.quorum_exchange
.network()
.inject_consensus_info(ConsensusIntentEvent::CancelPollForProposal(
*proposal.data.view_number,
))
.await;

let view = proposal.data.get_view_number();
if view < self.cur_view {
debug!("Proposal is from an older view {:?}", proposal.data.clone());
Expand Down Expand Up @@ -1165,8 +1173,13 @@ where
}
HotShotEvent::DACRecv(cert) => {
debug!("DAC Recved for view ! {}", *cert.view_number);

let view = cert.view_number;

self.quorum_exchange
.network()
.inject_consensus_info(ConsensusIntentEvent::CancelPollForDAC(*view))
.await;

self.da_certs.insert(view, cert);

if self.vote_if_able().await {
Expand Down
8 changes: 8 additions & 0 deletions crates/task-impls/src/da.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ where
// cause an overflow error.
// TODO ED Come back to this - we probably don't need this, but we should also never receive a DAC where this fails, investigate block ready so it doesn't make one for the genesis block

// stop polling for the received proposal
self.committee_exchange
.network()
.inject_consensus_info(ConsensusIntentEvent::CancelPollForProposal(
*proposal.data.view_number,
))
.await;

if self.cur_view != TYPES::Time::genesis() && view < self.cur_view - 1 {
warn!("Throwing away DA proposal that is more than one view older");
return None;
Expand Down
17 changes: 15 additions & 2 deletions crates/task-impls/src/vid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ where
disperse.data.get_view_number()
);

// stop polling for the received disperse
self.vid_exchange
.network()
.inject_consensus_info(ConsensusIntentEvent::CancelPollForVIDDisperse(
*disperse.data.view_number,
))
.await;

// ED NOTE: Assuming that the next view leader is the one who sends DA proposal for this view
let view = disperse.data.get_view_number();

Expand Down Expand Up @@ -347,8 +355,13 @@ where
}
}
}
HotShotEvent::VidCertRecv(_) => {
// RM TODO
HotShotEvent::VidCertRecv(cert) => {
self.vid_exchange
.network()
.inject_consensus_info(ConsensusIntentEvent::CancelPollForVIDCertificate(
*cert.view_number,
))
.await;
}
HotShotEvent::ViewChange(view) => {
if *self.cur_view >= *view {
Expand Down

0 comments on commit 15377d1

Please sign in to comment.