diff --git a/node/components/bft/src/chonky_bft/proposal.rs b/node/components/bft/src/chonky_bft/proposal.rs index 7da6962c..d854adc3 100644 --- a/node/components/bft/src/chonky_bft/proposal.rs +++ b/node/components/bft/src/chonky_bft/proposal.rs @@ -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 { diff --git a/node/components/bft/src/chonky_bft/timeout.rs b/node/components/bft/src/chonky_bft/timeout.rs index 43bb4919..4e6783da 100644 --- a/node/components/bft/src/chonky_bft/timeout.rs +++ b/node/components/bft/src/chonky_bft/timeout.rs @@ -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; @@ -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?; @@ -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(()) } diff --git a/node/components/bft/src/metrics.rs b/node/components/bft/src/metrics.rs index 248b57c9..abfa82e7 100644 --- a/node/components/bft/src/metrics.rs +++ b/node/components/bft/src/metrics.rs @@ -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, /// Number of the last finalized block observed by the node. pub(crate) finalized_block_number: Gauge, diff --git a/node/libs/roles/src/validator/messages/leader_proposal.rs b/node/libs/roles/src/validator/messages/leader_proposal.rs index e05c6668..6e0b4983 100644 --- a/node/libs/roles/src/validator/messages/leader_proposal.rs +++ b/node/libs/roles/src/validator/messages/leader_proposal.rs @@ -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())), } } @@ -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),