Skip to content

Commit

Permalink
minor fix of error formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pompon0 committed Oct 25, 2023
1 parent e3f2961 commit 851a292
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion node/actors/consensus/src/leader/replica_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub(crate) enum Error {
num_messages: usize,
threshold: usize,
},
#[error("received replica commit message with invalid signature")]
#[error("invalid signature: {0:#}")]
InvalidSignature(#[source] crypto::bls12_381::Error),
}

Expand Down
22 changes: 13 additions & 9 deletions node/actors/consensus/src/leader/replica_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,32 @@ use tracing::instrument;
#[derive(thiserror::Error, Debug)]
#[allow(clippy::missing_docs_in_private_items)]
pub(crate) enum Error {
#[error("received replica prepare message for a past view/phase (current view: {current_view:?}, current phase: {current_phase:?})")]
#[error("past view/phase (current view: {current_view:?}, current phase: {current_phase:?})")]
Old {
current_view: validator::ViewNumber,
current_phase: validator::Phase,
},
#[error("received replica prepare message for a view when we are not a leader")]
#[error("we are not a leader for this message's view")]
WhenNotLeaderInView,
#[error("received replica prepare message that already exists (existing message: {existing_message:?}")]
Exists { existing_message: String },
#[error("received replica prepare message while number of received messages below threshold. waiting for more (received: {num_messages:?}, threshold: {threshold:?}")]
#[error("duplicate message from a replica (existing message: {existing_message:?}")]
Exists {
existing_message: validator::ReplicaPrepare,
},
#[error("number of received messages below threshold. waiting for more (received: {num_messages:?}, threshold: {threshold:?}")]
NumReceivedBelowThreshold {
num_messages: usize,
threshold: usize,
},
#[error("received replica prepare message with high QC of a future view (high QC view: {high_qc_view:?}, current view: {current_view:?}")]
#[error(
"high QC of a future view (high QC view: {high_qc_view:?}, current view: {current_view:?}"
)]
HighQCOfFutureView {
high_qc_view: validator::ViewNumber,
current_view: validator::ViewNumber,
},
#[error("received replica prepare message with invalid signature")]
#[error("invalid signature: {0:#}")]
InvalidSignature(#[source] crypto::bls12_381::Error),
#[error("received replica prepare message with invalid high QC")]
#[error("invalid high QC: {0:#}")]
InvalidHighQC(#[source] anyhow::Error),
}

Expand Down Expand Up @@ -69,7 +73,7 @@ impl StateMachine {
.and_then(|x| x.get(author))
{
return Err(Error::Exists {
existing_message: format!("{:?}", existing_message),
existing_message: existing_message.msg.clone(),
});
}

Expand Down
6 changes: 3 additions & 3 deletions node/actors/consensus/src/replica/leader_commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ pub(crate) enum Error {
current_view: validator::ViewNumber,
current_phase: validator::Phase,
},
#[error("invalid signature")]
#[error("invalid signature: {0:#}")]
InvalidSignature(#[source] crypto::bls12_381::Error),
#[error("invalid justification")]
#[error("invalid justification: {0:#}")]
InvalidJustification(#[source] anyhow::Error),
#[error("internal error: {0}")]
#[error("internal error: {0:#}")]
Internal(#[from] anyhow::Error),
}

Expand Down
8 changes: 4 additions & 4 deletions node/actors/consensus/src/replica/leader_prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ pub(crate) enum Error {
current_view: validator::ViewNumber,
current_phase: validator::Phase,
},
#[error("invalid signature")]
#[error("invalid signature: {0:#}")]
InvalidSignature(#[source] crypto::bls12_381::Error),
#[error("invalid PrepareQC")]
#[error("invalid PrepareQC: {0:#}")]
InvalidPrepareQC(#[source] anyhow::Error),
#[error("invalid high QC")]
#[error("invalid high QC: {0:#}")]
InvalidHighQC(#[source] anyhow::Error),
#[error(
"high QC of a future view (high QC view: {high_qc_view:?}, current view: {current_view:?}"
Expand Down Expand Up @@ -64,7 +64,7 @@ pub(crate) enum Error {
ReproposalWhenFinalized,
#[error("block re-proposal of invalid block")]
ReproposalInvalidBlock,
#[error("internal error: {0}")]
#[error("internal error: {0:#}")]
Internal(#[from] anyhow::Error),
}

Expand Down

0 comments on commit 851a292

Please sign in to comment.