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 quorum certificate failure gracefully (BFT-386) #48

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
15 changes: 9 additions & 6 deletions node/actors/bft/src/leader/replica_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ pub(crate) enum Error {
/// Invalid message signature.
#[error("invalid signature: {0:#}")]
InvalidSignature(#[source] validator::Error),
/// Unexpected error when creating justification from received messages.
#[error("create justification unexpected error: {0:#}")]
CreateJustificationUnexpectedError(#[source] anyhow::Error),
}

impl StateMachine {
Expand Down Expand Up @@ -157,9 +160,14 @@ impl StateMachine {
.cloned()
.collect::<Vec<_>>();

// Clean the caches.
self.block_proposal_cache = None;
self.prepare_message_cache.retain(|k, _| k >= &self.view);
self.commit_message_cache.retain(|k, _| k >= &self.view);

// Create the justification for our message.
let justification = validator::CommitQC::from(&replica_messages, &consensus.validator_set)
.expect("Couldn't create justification from valid replica messages!");
.map_err(Error::CreateJustificationUnexpectedError)?;

// Broadcast the leader commit message to all replicas (ourselves included).
let output_message = ConsensusInputMessage {
Expand All @@ -175,11 +183,6 @@ impl StateMachine {
};
consensus.pipe.send(output_message.into());

// Clean the caches.
self.block_proposal_cache = None;
self.prepare_message_cache.retain(|k, _| k >= &self.view);
self.commit_message_cache.retain(|k, _| k >= &self.view);

Ok(())
}
}
5 changes: 4 additions & 1 deletion node/actors/bft/src/leader/replica_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ pub(crate) enum Error {
/// Invalid `HighQC` message.
#[error("invalid high QC: {0:#}")]
InvalidHighQC(#[source] anyhow::Error),
/// Unexpected error when creating justification from received messages.
#[error("create justification unexpected error: {0:#}")]
CreateJustificationUnexpectedError(#[source] anyhow::Error),
}

impl StateMachine {
Expand Down Expand Up @@ -225,7 +228,7 @@ impl StateMachine {

// Create the justification for our message.
let justification = validator::PrepareQC::from(&replica_messages, &consensus.validator_set)
.expect("Couldn't create justification from valid replica messages!");
.map_err(Error::CreateJustificationUnexpectedError)?;

// Broadcast the leader prepare message to all replicas (ourselves included).
let output_message = ConsensusInputMessage {
Expand Down
Loading