From 08bdd40d608c949052b008d3106b119701e71b7a Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 9 Nov 2023 15:09:24 -0500 Subject: [PATCH 1/2] cancel polling for retrieved items --- crates/task-impls/src/consensus.rs | 15 +++++++++++++++ crates/task-impls/src/da.rs | 8 ++++++++ crates/task-impls/src/vid.rs | 17 +++++++++++++++-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/crates/task-impls/src/consensus.rs b/crates/task-impls/src/consensus.rs index efb43212cf..ac93273cec 100644 --- a/crates/task-impls/src/consensus.rs +++ b/crates/task-impls/src/consensus.rs @@ -642,6 +642,21 @@ 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; + + self.quorum_exchange + .network() + .inject_consensus_info(ConsensusIntentEvent::CancelPollForDAC( + *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()); diff --git a/crates/task-impls/src/da.rs b/crates/task-impls/src/da.rs index 0679540b29..1467bfe50e 100644 --- a/crates/task-impls/src/da.rs +++ b/crates/task-impls/src/da.rs @@ -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; diff --git a/crates/task-impls/src/vid.rs b/crates/task-impls/src/vid.rs index 56e829c33f..f8950213e8 100644 --- a/crates/task-impls/src/vid.rs +++ b/crates/task-impls/src/vid.rs @@ -273,6 +273,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(); @@ -346,8 +354,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 { From ef2f2c4fa802996b5e6e204e14ae39cefffb63bc Mon Sep 17 00:00:00 2001 From: Rob Date: Fri, 10 Nov 2023 17:19:43 -0500 Subject: [PATCH 2/2] move DAC cancel --- crates/task-impls/src/consensus.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/crates/task-impls/src/consensus.rs b/crates/task-impls/src/consensus.rs index 906069c145..7c7b3da855 100644 --- a/crates/task-impls/src/consensus.rs +++ b/crates/task-impls/src/consensus.rs @@ -650,13 +650,6 @@ where )) .await; - self.quorum_exchange - .network() - .inject_consensus_info(ConsensusIntentEvent::CancelPollForDAC( - *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()); @@ -1180,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 {