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

Handle HighQcSend #3919

Merged
merged 4 commits into from
Dec 2, 2024
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
10 changes: 9 additions & 1 deletion crates/task-impls/src/consensus/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,15 @@ pub async fn send_high_qc<TYPES: NodeType, V: Versions, I: NodeImplementation<TY
let leader = task_state
.quorum_membership
.leader(new_view_number, TYPES::Epoch::new(0))?;
broadcast_event(Arc::new(HotShotEvent::HighQcSend(high_qc, leader)), sender).await;
broadcast_event(
Arc::new(HotShotEvent::HighQcSend(
high_qc,
leader,
task_state.public_key.clone(),
)),
sender,
)
.await;
Ok(())
}

Expand Down
10 changes: 7 additions & 3 deletions crates/task-impls/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,11 @@ pub enum HotShotEvent<TYPES: NodeType> {
HighQcRecv(QuorumCertificate2<TYPES>, TYPES::SignatureKey),

/// Send our HighQc to the next leader, should go to the same leader as our vote
HighQcSend(QuorumCertificate2<TYPES>, TYPES::SignatureKey),
HighQcSend(
QuorumCertificate2<TYPES>,
TYPES::SignatureKey,
TYPES::SignatureKey,
),
}

impl<TYPES: NodeType> HotShotEvent<TYPES> {
Expand Down Expand Up @@ -322,7 +326,7 @@ impl<TYPES: NodeType> HotShotEvent<TYPES> {
| HotShotEvent::VidRequestRecv(request, _) => Some(request.view),
HotShotEvent::VidResponseSend(_, _, proposal)
| HotShotEvent::VidResponseRecv(_, proposal) => Some(proposal.data.view_number),
HotShotEvent::HighQcRecv(qc, _) | HotShotEvent::HighQcSend(qc, _) => {
HotShotEvent::HighQcRecv(qc, _) | HotShotEvent::HighQcSend(qc, ..) => {
Some(qc.view_number())
}
}
Expand Down Expand Up @@ -590,7 +594,7 @@ impl<TYPES: NodeType> Display for HotShotEvent<TYPES> {
HotShotEvent::HighQcRecv(qc, _) => {
write!(f, "HighQcRecv(view_number={:?}", qc.view_number())
}
HotShotEvent::HighQcSend(qc, _) => {
HotShotEvent::HighQcSend(qc, ..) => {
write!(f, "HighQcSend(view_number={:?}", qc.view_number())
}
}
Expand Down
7 changes: 7 additions & 0 deletions crates/task-impls/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,13 @@ impl<
TransmitType::Direct(to),
))
}
HotShotEvent::HighQcSend(quorum_cert, leader, sender) => Some((
sender,
MessageKind::Consensus(SequencingMessage::General(
GeneralConsensusMessage::HighQc(quorum_cert.to_qc()),
Copy link
Contributor

Choose a reason for hiding this comment

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

can we change GeneralConsensusMessage::HighQc to a QuorumCertificate2?

it's not deployed so I think we can make the breaking change, and I think we would be gated on the same version (epochs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, that's a good idea.

)),
TransmitType::Direct(leader),
)),
_ => None,
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/task-impls/src/quorum_proposal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>, V: Versions>
HotShotEvent::ViewChange(view, _) | HotShotEvent::Timeout(view) => {
self.cancel_tasks(*view);
}
HotShotEvent::HighQcSend(qc, _sender) => {
HotShotEvent::HighQcSend(qc, ..) => {
ensure!(qc.view_number() > self.highest_qc.view_number());
let epoch_number = self.consensus.read().await.cur_epoch();
ensure!(
Expand Down