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

fix(hotstuff): fix bug where decide state was listening for wrong message #4160

Merged
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
Empty file.
2 changes: 1 addition & 1 deletion dan_layer/core/src/models/hot_stuff_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl<TPayload: Payload> HotStuffMessage<TPayload> {
asset_public_key: PublicKey,
) -> Self {
Self {
message_type: HotStuffMessageType::Commit,
message_type: HotStuffMessageType::Decide,
node,
justify: commit_qc,
view_number,
Expand Down
3 changes: 3 additions & 0 deletions dan_layer/core/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ pub enum HotStuffMessageType {
Prepare,
PreCommit,
Commit,
Decide,
// Special type
Genesis,
}
Expand All @@ -176,6 +177,7 @@ impl HotStuffMessageType {
HotStuffMessageType::Prepare => 2,
HotStuffMessageType::PreCommit => 3,
HotStuffMessageType::Commit => 4,
HotStuffMessageType::Decide => 5,
HotStuffMessageType::Genesis => 255,
}
}
Expand All @@ -190,6 +192,7 @@ impl TryFrom<u8> for HotStuffMessageType {
2 => Ok(HotStuffMessageType::Prepare),
3 => Ok(HotStuffMessageType::PreCommit),
4 => Ok(HotStuffMessageType::Commit),
5 => Ok(HotStuffMessageType::Decide),
255 => Ok(HotStuffMessageType::Genesis),
_ => Err("Not a value message type".to_string()),
}
Expand Down
2 changes: 1 addition & 1 deletion dan_layer/core/src/workers/states/decide_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl<TSpecification: ServiceSpecification> DecideState<TSpecification> {
}
}
},
r = inbound_services.wait_for_qc(HotStuffMessageType::Prepare, current_view.view_id()) => {
r = inbound_services.wait_for_qc(HotStuffMessageType::Commit, current_view.view_id()) => {
let (from, message) = r?;
let leader= self.committee.leader_for_view(current_view.view_id).clone();
if let Some(event) = self.process_replica_message(&message, current_view, &from, &leader, &mut unit_of_work, payload_provider).await? {
Expand Down