Skip to content

Commit

Permalink
added more debug info for timeoutqc verification
Browse files Browse the repository at this point in the history
  • Loading branch information
pompon0 committed Dec 10, 2024
1 parent c586f85 commit 632377d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions node/components/bft/src/chonky_bft/proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ impl StateMachine {

// Update the state machine.
self.view_number = message.view().number;
metrics::METRICS.replica_view_number.set(self.view_number.0);
self.phase = validator::Phase::Commit;
self.high_vote = Some(commit_vote.clone());
match &message.justification {
Expand Down
6 changes: 2 additions & 4 deletions node/components/bft/src/chonky_bft/timeout.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::StateMachine;
use crate::metrics;
use std::{cmp::max, collections::HashSet};
use std::collections::HashSet;
use zksync_concurrency::{ctx, error::Wrap, time};
use zksync_consensus_network::io::ConsensusInputMessage;
use zksync_consensus_roles::validator;
Expand Down Expand Up @@ -142,7 +141,7 @@ impl StateMachine {
.await
.wrap("process_commit_qc()")?;
}
self.high_timeout_qc = max(Some(timeout_qc.clone()), self.high_timeout_qc.clone());
self.high_timeout_qc = self.high_timeout_qc.clone().max(Some(timeout_qc.clone()));

// Start a new view.
self.start_new_view(ctx, message.view.number.next()).await?;
Expand Down Expand Up @@ -180,7 +179,6 @@ impl StateMachine {

// Log the event.
tracing::info!("Timed out at view {}", self.view_number);
metrics::METRICS.replica_view_number.set(self.view_number.0);

Ok(())
}
Expand Down
1 change: 0 additions & 1 deletion node/components/bft/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ pub(crate) struct ProcessingLatencyLabels {
#[metrics(prefix = "consensus")]
pub(crate) struct ConsensusMetrics {
/// Number of the current view of the replica.
#[metrics(unit = Unit::Seconds)]
pub(crate) replica_view_number: Gauge<u64>,
/// Number of the last finalized block observed by the node.
pub(crate) finalized_block_number: Gauge<u64>,
Expand Down
6 changes: 3 additions & 3 deletions node/libs/roles/src/validator/messages/leader_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl ProposalJustification {
.map_err(ProposalJustificationVerifyError::Commit),
ProposalJustification::Timeout(qc) => qc
.verify(genesis)
.map_err(ProposalJustificationVerifyError::Timeout),
.map_err(|err|ProposalJustificationVerifyError::Timeout(err,qc.clone())),
}
}

Expand Down Expand Up @@ -130,8 +130,8 @@ impl ProposalJustification {
#[derive(thiserror::Error, Debug)]
pub enum ProposalJustificationVerifyError {
/// Invalid timeout QC.
#[error("Invalid timeout QC: {0:#}")]
Timeout(TimeoutQCVerifyError),
#[error("Invalid timeout QC: {0:#}: {1:?}")]
Timeout(TimeoutQCVerifyError,TimeoutQC),
/// Invalid commit QC.
#[error("Invalid commit QC: {0:#}")]
Commit(CommitQCVerifyError),
Expand Down

0 comments on commit 632377d

Please sign in to comment.