From 8724e254c590c94cee2317a36165733cdbf1a253 Mon Sep 17 00:00:00 2001 From: Brendon Date: Thu, 24 Oct 2024 16:16:58 -0400 Subject: [PATCH 1/2] store view sync vote as action --- crates/task-impls/src/network.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/task-impls/src/network.rs b/crates/task-impls/src/network.rs index d8ef530b54..e401847dc8 100644 --- a/crates/task-impls/src/network.rs +++ b/crates/task-impls/src/network.rs @@ -460,6 +460,7 @@ impl< )) } HotShotEvent::ViewSyncCommitVoteSend(vote) => { + *maybe_action = Some(HotShotAction::Vote); let view_number = vote.view_number() + vote.date().relay; let leader = match self.quorum_membership.leader(view_number, self.epoch) { Ok(l) => l, @@ -482,6 +483,7 @@ impl< )) } HotShotEvent::ViewSyncFinalizeVoteSend(vote) => { + *maybe_action = Some(HotShotAction::Vote); let view_number = vote.view_number() + vote.date().relay; let leader = match self.quorum_membership.leader(view_number, self.epoch) { Ok(l) => l, From 3a9f09b167a7dab771caf0983d3ddf319b9ee18d Mon Sep 17 00:00:00 2001 From: Brendon Fish Date: Mon, 28 Oct 2024 14:17:14 -0400 Subject: [PATCH 2/2] don't block view sync votes --- crates/task-impls/src/network.rs | 11 ++++++++--- crates/types/src/event.rs | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/task-impls/src/network.rs b/crates/task-impls/src/network.rs index e401847dc8..74e60b917c 100644 --- a/crates/task-impls/src/network.rs +++ b/crates/task-impls/src/network.rs @@ -309,11 +309,16 @@ impl< state: Arc>>, view: ::View, ) -> std::result::Result<(), ()> { - if let Some(action) = maybe_action { + if let Some(mut action) = maybe_action { if !state.write().await.update_action(action, view) { tracing::warn!("Already actioned {:?} in view {:?}", action, view); return Err(()); } + // If the action was view sync record it as a vote, but we don't + // want to limit to 1 View sycn vote above so change the action here. + if matches!(action, HotShotAction::ViewSyncVote) { + action = HotShotAction::Vote; + } match storage.write().await.record_action(view, action).await { Ok(()) => Ok(()), Err(e) => { @@ -460,7 +465,7 @@ impl< )) } HotShotEvent::ViewSyncCommitVoteSend(vote) => { - *maybe_action = Some(HotShotAction::Vote); + *maybe_action = Some(HotShotAction::ViewSyncVote); let view_number = vote.view_number() + vote.date().relay; let leader = match self.quorum_membership.leader(view_number, self.epoch) { Ok(l) => l, @@ -483,7 +488,7 @@ impl< )) } HotShotEvent::ViewSyncFinalizeVoteSend(vote) => { - *maybe_action = Some(HotShotAction::Vote); + *maybe_action = Some(HotShotAction::ViewSyncVote); let view_number = vote.view_number() + vote.date().relay; let leader = match self.quorum_membership.leader(view_number, self.epoch) { Ok(l) => l, diff --git a/crates/types/src/event.rs b/crates/types/src/event.rs index ca833c9f5d..f9d48779e8 100644 --- a/crates/types/src/event.rs +++ b/crates/types/src/event.rs @@ -184,6 +184,8 @@ pub enum EventType { pub enum HotShotAction { /// A quorum vote was sent Vote, + /// View Sync Vote + ViewSyncVote, /// A quorum proposal was sent Propose, /// DA proposal was sent