From 9d1ea033963afc106fba2395beebdaa06b4a0654 Mon Sep 17 00:00:00 2001 From: OakenKnight Date: Tue, 14 Jan 2025 15:11:19 +0100 Subject: [PATCH 1/6] Feature-gated malachitebft-metrics in malachitebft-core-consensus crate --- code/crates/core-consensus/Cargo.toml | 4 ++-- code/crates/core-consensus/src/handle.rs | 15 +++++++++--- .../core-consensus/src/handle/decide.rs | 14 +++++++---- .../core-consensus/src/handle/driver.rs | 21 +++++++++-------- .../core-consensus/src/handle/proposal.rs | 5 ++-- .../core-consensus/src/handle/propose.rs | 8 ++++--- .../src/handle/proposed_value.rs | 4 +++- .../core-consensus/src/handle/start_height.rs | 23 +++++++++++-------- .../core-consensus/src/handle/step_timeout.rs | 7 ++++-- code/crates/core-consensus/src/handle/sync.rs | 5 ++-- .../core-consensus/src/handle/timeout.rs | 4 +++- code/crates/core-consensus/src/handle/vote.rs | 4 +++- .../core-consensus/src/handle/vote_set.rs | 6 +++-- code/crates/core-consensus/src/macros.rs | 1 - code/crates/core-consensus/src/prelude.rs | 1 + code/crates/core-consensus/src/types.rs | 4 +++- 16 files changed, 81 insertions(+), 45 deletions(-) diff --git a/code/crates/core-consensus/Cargo.toml b/code/crates/core-consensus/Cargo.toml index 9033d55b0..580535c08 100644 --- a/code/crates/core-consensus/Cargo.toml +++ b/code/crates/core-consensus/Cargo.toml @@ -13,13 +13,13 @@ readme = "../../../README.md" all-features = true [features] -std = [] +std = ["malachitebft-metrics"] debug = ["std", "malachitebft-core-driver/debug"] [dependencies] malachitebft-core-types.workspace = true malachitebft-core-driver.workspace = true -malachitebft-metrics.workspace = true +malachitebft-metrics = { workspace = true, optional = true } malachitebft-peer.workspace = true async-recursion = { workspace = true } diff --git a/code/crates/core-consensus/src/handle.rs b/code/crates/core-consensus/src/handle.rs index b3165d9fb..beea989d5 100644 --- a/code/crates/core-consensus/src/handle.rs +++ b/code/crates/core-consensus/src/handle.rs @@ -1,5 +1,6 @@ use crate::prelude::*; - +#[cfg(not(feature = "std"))] +use crate::types::Metrics; mod decide; mod driver; mod proposal; @@ -33,14 +34,22 @@ pub async fn handle( where Ctx: Context, { - handle_input(&co, state, metrics, input).await + #[cfg(feature = "std")] + { + handle_input(&co, state, Some(metrics), input).await + } + + #[cfg(not(feature = "std"))] + { + handle_input(&co, state, None, input).await + } } #[async_recursion] async fn handle_input( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, input: Input, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/decide.rs b/code/crates/core-consensus/src/handle/decide.rs index 2cf18b6ef..50d382a43 100644 --- a/code/crates/core-consensus/src/handle/decide.rs +++ b/code/crates/core-consensus/src/handle/decide.rs @@ -1,9 +1,10 @@ use crate::prelude::*; - +#[cfg(not(feature = "std"))] +use crate::types::Metrics; pub async fn decide( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, consensus_round: Round, proposal: SignedProposal, ) -> Result<(), Error> @@ -21,20 +22,23 @@ where state.remove_full_proposals(height); // Update metrics + #[cfg(feature = "std")] { // We are only interested in consensus time for round 0, ie. in the happy path. if consensus_round == Round::new(0) { - metrics.consensus_end(); + metrics.unwrap().consensus_end(); } - metrics.block_end(); - metrics.finalized_blocks.inc(); + metrics.unwrap().block_end(); + metrics.unwrap().finalized_blocks.inc(); metrics + .unwrap() .consensus_round .observe(consensus_round.as_i64() as f64); metrics + .unwrap() .proposal_round .observe(proposal_round.as_i64() as f64); } diff --git a/code/crates/core-consensus/src/handle/driver.rs b/code/crates/core-consensus/src/handle/driver.rs index 94e5ba7f4..373e18c8c 100644 --- a/code/crates/core-consensus/src/handle/driver.rs +++ b/code/crates/core-consensus/src/handle/driver.rs @@ -3,16 +3,17 @@ use crate::handle::signature::sign_proposal; use crate::handle::signature::sign_vote; use crate::handle::vote::on_vote; use crate::prelude::*; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; use crate::types::SignedConsensusMsg; use crate::util::pretty::PrettyVal; use malachitebft_core_driver::Input as DriverInput; use malachitebft_core_driver::Output as DriverOutput; - #[async_recursion] pub async fn apply_driver_input( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, input: DriverInput, ) -> Result<(), Error> where @@ -20,7 +21,8 @@ where { match &input { DriverInput::NewRound(height, round, proposer) => { - metrics.round.set(round.as_i64()); + #[cfg(feature = "std")] + metrics.unwrap().round.set(round.as_i64()); info!(%height, %round, %proposer, "Starting new round"); perform!(co, Effect::CancelAllTimeouts(Default::default())); @@ -103,8 +105,11 @@ where ); } } - metrics.step_end(prev_step); - metrics.step_start(new_step); + #[cfg(feature = "std")] + { + metrics.unwrap().step_end(prev_step); + metrics.unwrap().step_start(new_step); + } } if prev_step != new_step { @@ -152,7 +157,7 @@ where async fn process_driver_outputs( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, outputs: Vec>, ) -> Result<(), Error> where @@ -168,7 +173,7 @@ where async fn process_driver_output( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, output: DriverOutput, ) -> Result<(), Error> where @@ -177,7 +182,6 @@ where match output { DriverOutput::NewRound(height, round) => { let proposer = state.get_proposer(height, round); - apply_driver_input( co, state, @@ -209,7 +213,6 @@ where ) ); } - on_proposal(co, state, metrics, signed_proposal.clone()).await?; // Proposal messages should not be broadcasted if they are implicit, diff --git a/code/crates/core-consensus/src/handle/proposal.rs b/code/crates/core-consensus/src/handle/proposal.rs index d05ed9509..10db7d755 100644 --- a/code/crates/core-consensus/src/handle/proposal.rs +++ b/code/crates/core-consensus/src/handle/proposal.rs @@ -3,14 +3,15 @@ use crate::handle::signature::verify_signature; use crate::handle::validator_set::get_validator_set; use crate::input::Input; use crate::types::ConsensusMsg; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; use crate::util::pretty::PrettyProposal; use crate::ProposedValue; use crate::{prelude::*, SignedConsensusMsg}; - pub async fn on_proposal( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, signed_proposal: SignedProposal, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/propose.rs b/code/crates/core-consensus/src/handle/propose.rs index 7becd52f1..5564abc14 100644 --- a/code/crates/core-consensus/src/handle/propose.rs +++ b/code/crates/core-consensus/src/handle/propose.rs @@ -1,4 +1,6 @@ use crate::prelude::*; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; use crate::handle::driver::apply_driver_input; use crate::types::{ProposedValue, ValueToPropose}; @@ -6,7 +8,7 @@ use crate::types::{ProposedValue, ValueToPropose}; pub async fn on_propose( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, value: ValueToPropose, ) -> Result<(), Error> where @@ -37,8 +39,8 @@ where return Ok(()); } - - metrics.consensus_start(); + #[cfg(feature = "std")] + metrics.unwrap().consensus_start(); state.store_value(&ProposedValue { height, diff --git a/code/crates/core-consensus/src/handle/proposed_value.rs b/code/crates/core-consensus/src/handle/proposed_value.rs index 2bdc372eb..34e85fdfc 100644 --- a/code/crates/core-consensus/src/handle/proposed_value.rs +++ b/code/crates/core-consensus/src/handle/proposed_value.rs @@ -1,4 +1,6 @@ use crate::prelude::*; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; use crate::handle::driver::apply_driver_input; use crate::types::ProposedValue; @@ -17,7 +19,7 @@ use super::signature::sign_proposal; pub async fn on_proposed_value( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, proposed_value: ProposedValue, origin: ValueOrigin, ) -> Result<(), Error> diff --git a/code/crates/core-consensus/src/handle/start_height.rs b/code/crates/core-consensus/src/handle/start_height.rs index eba83902f..49b1f2a23 100644 --- a/code/crates/core-consensus/src/handle/start_height.rs +++ b/code/crates/core-consensus/src/handle/start_height.rs @@ -1,4 +1,6 @@ use crate::prelude::*; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; use crate::handle::driver::apply_driver_input; use crate::handle::handle_input; @@ -6,7 +8,7 @@ use crate::handle::handle_input; pub async fn reset_and_start_height( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, height: Ctx::Height, validator_set: Ctx::ValidatorSet, ) -> Result<(), Error> @@ -15,8 +17,8 @@ where { perform!(co, Effect::CancelAllTimeouts(Default::default())); perform!(co, Effect::ResetTimeouts(Default::default())); - - metrics.step_end(state.driver.step()); + #[cfg(feature = "std")] + metrics.unwrap().step_end(state.driver.step()); state.driver.move_to_height(height, validator_set); @@ -29,7 +31,7 @@ where pub async fn start_height( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, height: Ctx::Height, ) -> Result<(), Error> where @@ -37,11 +39,12 @@ where { let round = Round::new(0); info!(%height, "Starting new height"); - - metrics.block_start(); - metrics.height.set(height.as_u64() as i64); - metrics.round.set(round.as_i64()); - + #[cfg(feature = "std")] + { + metrics.unwrap().block_start(); + metrics.unwrap().height.set(height.as_u64() as i64); + metrics.unwrap().round.set(round.as_i64()); + } let proposer = state.get_proposer(height, round); apply_driver_input( @@ -60,7 +63,7 @@ where async fn replay_pending_msgs( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, ) -> Result<(), Error> where Ctx: Context, diff --git a/code/crates/core-consensus/src/handle/step_timeout.rs b/code/crates/core-consensus/src/handle/step_timeout.rs index 6f0320f17..5e6a06dd1 100644 --- a/code/crates/core-consensus/src/handle/step_timeout.rs +++ b/code/crates/core-consensus/src/handle/step_timeout.rs @@ -1,9 +1,11 @@ use crate::prelude::*; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; pub async fn on_step_limit_timeout( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, round: Round, ) -> Result<(), Error> where @@ -17,7 +19,8 @@ where co, Effect::GetVoteSet(state.driver.height(), round, Default::default()) ); - metrics.step_timeouts.inc(); + #[cfg(feature = "std")] + metrics.unwrap().step_timeouts.inc(); if state.driver.step_is_prevote() { perform!( diff --git a/code/crates/core-consensus/src/handle/sync.rs b/code/crates/core-consensus/src/handle/sync.rs index 9c6b83535..6b7f26c7e 100644 --- a/code/crates/core-consensus/src/handle/sync.rs +++ b/code/crates/core-consensus/src/handle/sync.rs @@ -2,11 +2,13 @@ use crate::handle::driver::apply_driver_input; use crate::handle::signature::verify_certificate; use crate::handle::validator_set::get_validator_set; use crate::prelude::*; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; pub async fn on_commit_certificate( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, certificate: CommitCertificate, ) -> Result<(), Error> where @@ -33,7 +35,6 @@ where return Err(Error::InvalidCertificate(certificate, e)); } - // Go to Commit step via L49 apply_driver_input( co, state, diff --git a/code/crates/core-consensus/src/handle/timeout.rs b/code/crates/core-consensus/src/handle/timeout.rs index af28f8537..20bbcb816 100644 --- a/code/crates/core-consensus/src/handle/timeout.rs +++ b/code/crates/core-consensus/src/handle/timeout.rs @@ -2,11 +2,13 @@ use crate::handle::decide::decide; use crate::handle::driver::apply_driver_input; use crate::handle::step_timeout::on_step_limit_timeout; use crate::prelude::*; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; pub async fn on_timeout_elapsed( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, timeout: Timeout, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/vote.rs b/code/crates/core-consensus/src/handle/vote.rs index 0a48cfe8a..22947975f 100644 --- a/code/crates/core-consensus/src/handle/vote.rs +++ b/code/crates/core-consensus/src/handle/vote.rs @@ -1,3 +1,5 @@ +#[cfg(not(feature = "std"))] +use crate::types::Metrics; use crate::{prelude::*, SignedConsensusMsg}; use crate::handle::driver::apply_driver_input; @@ -10,7 +12,7 @@ use crate::util::pretty::PrettyVote; pub async fn on_vote( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, signed_vote: SignedVote, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/vote_set.rs b/code/crates/core-consensus/src/handle/vote_set.rs index ec235596a..8c594cad7 100644 --- a/code/crates/core-consensus/src/handle/vote_set.rs +++ b/code/crates/core-consensus/src/handle/vote_set.rs @@ -1,11 +1,13 @@ use crate::handle::vote::on_vote; use crate::input::RequestId; use crate::prelude::*; +#[cfg(not(feature = "std"))] +use crate::types::Metrics; pub async fn on_vote_set_request( co: &Co, state: &mut State, - _metrics: &Metrics, + _metrics: Option<&Metrics>, request_id: RequestId, height: Ctx::Height, round: Round, @@ -32,7 +34,7 @@ where pub async fn on_vote_set_response( co: &Co, state: &mut State, - metrics: &Metrics, + metrics: Option<&Metrics>, response: VoteSet, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/macros.rs b/code/crates/core-consensus/src/macros.rs index 8a5505564..afe9e4d99 100644 --- a/code/crates/core-consensus/src/macros.rs +++ b/code/crates/core-consensus/src/macros.rs @@ -21,7 +21,6 @@ macro_rules! process { (input: $input:expr, state: $state:expr, metrics: $metrics:expr, with: $effect:ident => $handle:expr) => {{ let mut gen = $crate::gen::Gen::new(|co| $crate::handle(co, $state, $metrics, $input)); - let mut co_result = gen.resume_with($crate::Resume::Start); loop { diff --git a/code/crates/core-consensus/src/prelude.rs b/code/crates/core-consensus/src/prelude.rs index e64c1eb37..c2999c8cc 100644 --- a/code/crates/core-consensus/src/prelude.rs +++ b/code/crates/core-consensus/src/prelude.rs @@ -3,6 +3,7 @@ pub use tracing::{debug, info, warn}; pub use malachitebft_core_driver::Input as DriverInput; pub use malachitebft_core_types::*; +#[cfg(feature = "std")] pub use malachitebft_metrics::Metrics; pub use crate::effect::{Effect, Resume}; diff --git a/code/crates/core-consensus/src/types.rs b/code/crates/core-consensus/src/types.rs index fec157ea0..adb6c9c67 100644 --- a/code/crates/core-consensus/src/types.rs +++ b/code/crates/core-consensus/src/types.rs @@ -7,7 +7,9 @@ use malachitebft_core_types::{ pub use malachitebft_peer::PeerId; pub use multiaddr::Multiaddr; - +// Dummy metrics structure +#[cfg(not(feature = "std"))] +pub type Metrics = (); /// A signed consensus message, ie. a signed vote or a signed proposal. #[derive_where(Clone, Debug, PartialEq, Eq)] pub enum SignedConsensusMsg { From f0cc5d1c9c832b8be3c057caf14b6c52abfa7929 Mon Sep 17 00:00:00 2001 From: OakenKnight Date: Wed, 15 Jan 2025 09:44:49 +0100 Subject: [PATCH 2/6] refactored option of metrics to metrics in core-consensus --- code/crates/core-consensus/src/handle.rs | 13 +++---------- code/crates/core-consensus/src/handle/decide.rs | 12 ++++++------ code/crates/core-consensus/src/handle/driver.rs | 12 ++++++------ code/crates/core-consensus/src/handle/proposal.rs | 2 +- code/crates/core-consensus/src/handle/propose.rs | 4 ++-- .../core-consensus/src/handle/proposed_value.rs | 2 +- .../core-consensus/src/handle/start_height.rs | 14 +++++++------- .../core-consensus/src/handle/step_timeout.rs | 5 +++-- code/crates/core-consensus/src/handle/sync.rs | 2 +- code/crates/core-consensus/src/handle/timeout.rs | 2 +- code/crates/core-consensus/src/handle/vote.rs | 2 +- code/crates/core-consensus/src/handle/vote_set.rs | 4 ++-- code/crates/core-consensus/src/types.rs | 1 + 13 files changed, 35 insertions(+), 40 deletions(-) diff --git a/code/crates/core-consensus/src/handle.rs b/code/crates/core-consensus/src/handle.rs index beea989d5..f8779011f 100644 --- a/code/crates/core-consensus/src/handle.rs +++ b/code/crates/core-consensus/src/handle.rs @@ -24,6 +24,7 @@ use timeout::on_timeout_elapsed; use vote::on_vote; use vote_set::{on_vote_set_request, on_vote_set_response}; +#[allow(unused_variables)] #[allow(private_interfaces)] pub async fn handle( co: Co, @@ -34,22 +35,14 @@ pub async fn handle( where Ctx: Context, { - #[cfg(feature = "std")] - { - handle_input(&co, state, Some(metrics), input).await - } - - #[cfg(not(feature = "std"))] - { - handle_input(&co, state, None, input).await - } + handle_input(&co, state, metrics, input).await } #[async_recursion] async fn handle_input( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, input: Input, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/decide.rs b/code/crates/core-consensus/src/handle/decide.rs index 50d382a43..f37c69964 100644 --- a/code/crates/core-consensus/src/handle/decide.rs +++ b/code/crates/core-consensus/src/handle/decide.rs @@ -1,10 +1,12 @@ use crate::prelude::*; #[cfg(not(feature = "std"))] use crate::types::Metrics; + +#[allow(unused_variables)] pub async fn decide( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, consensus_round: Round, proposal: SignedProposal, ) -> Result<(), Error> @@ -26,19 +28,17 @@ where { // We are only interested in consensus time for round 0, ie. in the happy path. if consensus_round == Round::new(0) { - metrics.unwrap().consensus_end(); + metrics.consensus_end(); } - metrics.unwrap().block_end(); - metrics.unwrap().finalized_blocks.inc(); + metrics.block_end(); + metrics.finalized_blocks.inc(); metrics - .unwrap() .consensus_round .observe(consensus_round.as_i64() as f64); metrics - .unwrap() .proposal_round .observe(proposal_round.as_i64() as f64); } diff --git a/code/crates/core-consensus/src/handle/driver.rs b/code/crates/core-consensus/src/handle/driver.rs index c8f08aea9..1bb242215 100644 --- a/code/crates/core-consensus/src/handle/driver.rs +++ b/code/crates/core-consensus/src/handle/driver.rs @@ -13,7 +13,7 @@ use malachitebft_core_driver::Output as DriverOutput; pub async fn apply_driver_input( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, input: DriverInput, ) -> Result<(), Error> where @@ -22,7 +22,7 @@ where match &input { DriverInput::NewRound(height, round, proposer) => { #[cfg(feature = "std")] - metrics.unwrap().round.set(round.as_i64()); + metrics.round.set(round.as_i64()); info!(%height, %round, %proposer, "Starting new round"); perform!(co, Effect::CancelAllTimeouts(Default::default())); @@ -107,8 +107,8 @@ where } #[cfg(feature = "std")] { - metrics.unwrap().step_end(prev_step); - metrics.unwrap().step_start(new_step); + metrics.step_end(prev_step); + metrics.step_start(new_step); } } @@ -157,7 +157,7 @@ where async fn process_driver_outputs( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, outputs: Vec>, ) -> Result<(), Error> where @@ -173,7 +173,7 @@ where async fn process_driver_output( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, output: DriverOutput, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/proposal.rs b/code/crates/core-consensus/src/handle/proposal.rs index 10db7d755..1be14e07a 100644 --- a/code/crates/core-consensus/src/handle/proposal.rs +++ b/code/crates/core-consensus/src/handle/proposal.rs @@ -11,7 +11,7 @@ use crate::{prelude::*, SignedConsensusMsg}; pub async fn on_proposal( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, signed_proposal: SignedProposal, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/propose.rs b/code/crates/core-consensus/src/handle/propose.rs index 5564abc14..9b1571e4c 100644 --- a/code/crates/core-consensus/src/handle/propose.rs +++ b/code/crates/core-consensus/src/handle/propose.rs @@ -8,7 +8,7 @@ use crate::types::{ProposedValue, ValueToPropose}; pub async fn on_propose( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, value: ValueToPropose, ) -> Result<(), Error> where @@ -40,7 +40,7 @@ where return Ok(()); } #[cfg(feature = "std")] - metrics.unwrap().consensus_start(); + metrics.consensus_start(); state.store_value(&ProposedValue { height, diff --git a/code/crates/core-consensus/src/handle/proposed_value.rs b/code/crates/core-consensus/src/handle/proposed_value.rs index 34e85fdfc..19bd62447 100644 --- a/code/crates/core-consensus/src/handle/proposed_value.rs +++ b/code/crates/core-consensus/src/handle/proposed_value.rs @@ -19,7 +19,7 @@ use super::signature::sign_proposal; pub async fn on_proposed_value( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, proposed_value: ProposedValue, origin: ValueOrigin, ) -> Result<(), Error> diff --git a/code/crates/core-consensus/src/handle/start_height.rs b/code/crates/core-consensus/src/handle/start_height.rs index 49b1f2a23..be32f4d71 100644 --- a/code/crates/core-consensus/src/handle/start_height.rs +++ b/code/crates/core-consensus/src/handle/start_height.rs @@ -8,7 +8,7 @@ use crate::handle::handle_input; pub async fn reset_and_start_height( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, height: Ctx::Height, validator_set: Ctx::ValidatorSet, ) -> Result<(), Error> @@ -18,7 +18,7 @@ where perform!(co, Effect::CancelAllTimeouts(Default::default())); perform!(co, Effect::ResetTimeouts(Default::default())); #[cfg(feature = "std")] - metrics.unwrap().step_end(state.driver.step()); + metrics.step_end(state.driver.step()); state.driver.move_to_height(height, validator_set); @@ -31,7 +31,7 @@ where pub async fn start_height( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, height: Ctx::Height, ) -> Result<(), Error> where @@ -41,9 +41,9 @@ where info!(%height, "Starting new height"); #[cfg(feature = "std")] { - metrics.unwrap().block_start(); - metrics.unwrap().height.set(height.as_u64() as i64); - metrics.unwrap().round.set(round.as_i64()); + metrics.block_start(); + metrics.height.set(height.as_u64() as i64); + metrics.round.set(round.as_i64()); } let proposer = state.get_proposer(height, round); @@ -63,7 +63,7 @@ where async fn replay_pending_msgs( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, ) -> Result<(), Error> where Ctx: Context, diff --git a/code/crates/core-consensus/src/handle/step_timeout.rs b/code/crates/core-consensus/src/handle/step_timeout.rs index 5e6a06dd1..008f4542c 100644 --- a/code/crates/core-consensus/src/handle/step_timeout.rs +++ b/code/crates/core-consensus/src/handle/step_timeout.rs @@ -2,10 +2,11 @@ use crate::prelude::*; #[cfg(not(feature = "std"))] use crate::types::Metrics; +#[allow(unused_variables)] pub async fn on_step_limit_timeout( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, round: Round, ) -> Result<(), Error> where @@ -20,7 +21,7 @@ where Effect::GetVoteSet(state.driver.height(), round, Default::default()) ); #[cfg(feature = "std")] - metrics.unwrap().step_timeouts.inc(); + metrics.step_timeouts.inc(); if state.driver.step_is_prevote() { perform!( diff --git a/code/crates/core-consensus/src/handle/sync.rs b/code/crates/core-consensus/src/handle/sync.rs index 6b7f26c7e..2249b18ef 100644 --- a/code/crates/core-consensus/src/handle/sync.rs +++ b/code/crates/core-consensus/src/handle/sync.rs @@ -8,7 +8,7 @@ use crate::types::Metrics; pub async fn on_commit_certificate( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, certificate: CommitCertificate, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/timeout.rs b/code/crates/core-consensus/src/handle/timeout.rs index 20bbcb816..f4c39991c 100644 --- a/code/crates/core-consensus/src/handle/timeout.rs +++ b/code/crates/core-consensus/src/handle/timeout.rs @@ -8,7 +8,7 @@ use crate::types::Metrics; pub async fn on_timeout_elapsed( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, timeout: Timeout, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/vote.rs b/code/crates/core-consensus/src/handle/vote.rs index fd93bae70..90409baee 100644 --- a/code/crates/core-consensus/src/handle/vote.rs +++ b/code/crates/core-consensus/src/handle/vote.rs @@ -12,7 +12,7 @@ use crate::util::pretty::PrettyVote; pub async fn on_vote( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, signed_vote: SignedVote, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/vote_set.rs b/code/crates/core-consensus/src/handle/vote_set.rs index 8c594cad7..bc14bb9b8 100644 --- a/code/crates/core-consensus/src/handle/vote_set.rs +++ b/code/crates/core-consensus/src/handle/vote_set.rs @@ -7,7 +7,7 @@ use crate::types::Metrics; pub async fn on_vote_set_request( co: &Co, state: &mut State, - _metrics: Option<&Metrics>, + _metrics: &Metrics, request_id: RequestId, height: Ctx::Height, round: Round, @@ -34,7 +34,7 @@ where pub async fn on_vote_set_response( co: &Co, state: &mut State, - metrics: Option<&Metrics>, + metrics: &Metrics, response: VoteSet, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/types.rs b/code/crates/core-consensus/src/types.rs index adb6c9c67..a46a92136 100644 --- a/code/crates/core-consensus/src/types.rs +++ b/code/crates/core-consensus/src/types.rs @@ -10,6 +10,7 @@ pub use multiaddr::Multiaddr; // Dummy metrics structure #[cfg(not(feature = "std"))] pub type Metrics = (); +pub type Metrics1 = (); /// A signed consensus message, ie. a signed vote or a signed proposal. #[derive_where(Clone, Debug, PartialEq, Eq)] pub enum SignedConsensusMsg { From 75f431d0fc30a02ee9b3bf15ad4209202e69d4fd Mon Sep 17 00:00:00 2001 From: OakenKnight Date: Wed, 15 Jan 2025 09:50:24 +0100 Subject: [PATCH 3/6] removed unnecessary type --- code/crates/core-consensus/src/types.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/code/crates/core-consensus/src/types.rs b/code/crates/core-consensus/src/types.rs index a46a92136..adb6c9c67 100644 --- a/code/crates/core-consensus/src/types.rs +++ b/code/crates/core-consensus/src/types.rs @@ -10,7 +10,6 @@ pub use multiaddr::Multiaddr; // Dummy metrics structure #[cfg(not(feature = "std"))] pub type Metrics = (); -pub type Metrics1 = (); /// A signed consensus message, ie. a signed vote or a signed proposal. #[derive_where(Clone, Debug, PartialEq, Eq)] pub enum SignedConsensusMsg { From 3f9a35a2697860ced55b0a8bb0860b4ba0aff3f2 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Wed, 15 Jan 2025 10:01:38 +0100 Subject: [PATCH 4/6] Cleanup imports --- code/crates/core-consensus/src/handle.rs | 3 +-- code/crates/core-consensus/src/handle/decide.rs | 5 +---- code/crates/core-consensus/src/handle/driver.rs | 8 ++++---- code/crates/core-consensus/src/handle/proposal.rs | 7 +++---- code/crates/core-consensus/src/handle/propose.rs | 2 -- code/crates/core-consensus/src/handle/proposed_value.rs | 2 -- code/crates/core-consensus/src/handle/start_height.rs | 2 -- code/crates/core-consensus/src/handle/step_timeout.rs | 3 --- code/crates/core-consensus/src/handle/sync.rs | 2 -- code/crates/core-consensus/src/handle/timeout.rs | 2 -- code/crates/core-consensus/src/handle/vote.rs | 6 ++---- code/crates/core-consensus/src/handle/vote_set.rs | 2 -- code/crates/core-consensus/src/prelude.rs | 8 ++++++-- code/crates/core-consensus/src/types.rs | 4 +--- 14 files changed, 18 insertions(+), 38 deletions(-) diff --git a/code/crates/core-consensus/src/handle.rs b/code/crates/core-consensus/src/handle.rs index f8779011f..f35849af5 100644 --- a/code/crates/core-consensus/src/handle.rs +++ b/code/crates/core-consensus/src/handle.rs @@ -24,12 +24,11 @@ use timeout::on_timeout_elapsed; use vote::on_vote; use vote_set::{on_vote_set_request, on_vote_set_response}; -#[allow(unused_variables)] #[allow(private_interfaces)] pub async fn handle( co: Co, state: &mut State, - metrics: &Metrics, + #[allow(unused_variables)] metrics: &Metrics, input: Input, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/decide.rs b/code/crates/core-consensus/src/handle/decide.rs index f37c69964..76f20b3fd 100644 --- a/code/crates/core-consensus/src/handle/decide.rs +++ b/code/crates/core-consensus/src/handle/decide.rs @@ -1,12 +1,9 @@ use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; -#[allow(unused_variables)] pub async fn decide( co: &Co, state: &mut State, - metrics: &Metrics, + #[allow(unused_variables)] metrics: &Metrics, consensus_round: Round, proposal: SignedProposal, ) -> Result<(), Error> diff --git a/code/crates/core-consensus/src/handle/driver.rs b/code/crates/core-consensus/src/handle/driver.rs index 1bb242215..4e094a9f5 100644 --- a/code/crates/core-consensus/src/handle/driver.rs +++ b/code/crates/core-consensus/src/handle/driver.rs @@ -1,14 +1,14 @@ +use malachitebft_core_driver::Input as DriverInput; +use malachitebft_core_driver::Output as DriverOutput; + use crate::handle::on_proposal; use crate::handle::signature::sign_proposal; use crate::handle::signature::sign_vote; use crate::handle::vote::on_vote; use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; use crate::types::SignedConsensusMsg; use crate::util::pretty::PrettyVal; -use malachitebft_core_driver::Input as DriverInput; -use malachitebft_core_driver::Output as DriverOutput; + #[async_recursion] pub async fn apply_driver_input( co: &Co, diff --git a/code/crates/core-consensus/src/handle/proposal.rs b/code/crates/core-consensus/src/handle/proposal.rs index 1be14e07a..a22d9de46 100644 --- a/code/crates/core-consensus/src/handle/proposal.rs +++ b/code/crates/core-consensus/src/handle/proposal.rs @@ -2,12 +2,11 @@ use crate::handle::driver::apply_driver_input; use crate::handle::signature::verify_signature; use crate::handle::validator_set::get_validator_set; use crate::input::Input; +use crate::prelude::*; use crate::types::ConsensusMsg; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; use crate::util::pretty::PrettyProposal; -use crate::ProposedValue; -use crate::{prelude::*, SignedConsensusMsg}; +use crate::{ProposedValue, SignedConsensusMsg}; + pub async fn on_proposal( co: &Co, state: &mut State, diff --git a/code/crates/core-consensus/src/handle/propose.rs b/code/crates/core-consensus/src/handle/propose.rs index 9b1571e4c..97b4d5f1c 100644 --- a/code/crates/core-consensus/src/handle/propose.rs +++ b/code/crates/core-consensus/src/handle/propose.rs @@ -1,6 +1,4 @@ use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; use crate::handle::driver::apply_driver_input; use crate::types::{ProposedValue, ValueToPropose}; diff --git a/code/crates/core-consensus/src/handle/proposed_value.rs b/code/crates/core-consensus/src/handle/proposed_value.rs index 19bd62447..2bdc372eb 100644 --- a/code/crates/core-consensus/src/handle/proposed_value.rs +++ b/code/crates/core-consensus/src/handle/proposed_value.rs @@ -1,6 +1,4 @@ use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; use crate::handle::driver::apply_driver_input; use crate::types::ProposedValue; diff --git a/code/crates/core-consensus/src/handle/start_height.rs b/code/crates/core-consensus/src/handle/start_height.rs index be32f4d71..690814dd5 100644 --- a/code/crates/core-consensus/src/handle/start_height.rs +++ b/code/crates/core-consensus/src/handle/start_height.rs @@ -1,6 +1,4 @@ use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; use crate::handle::driver::apply_driver_input; use crate::handle::handle_input; diff --git a/code/crates/core-consensus/src/handle/step_timeout.rs b/code/crates/core-consensus/src/handle/step_timeout.rs index 008f4542c..7877387ae 100644 --- a/code/crates/core-consensus/src/handle/step_timeout.rs +++ b/code/crates/core-consensus/src/handle/step_timeout.rs @@ -1,8 +1,5 @@ use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; -#[allow(unused_variables)] pub async fn on_step_limit_timeout( co: &Co, state: &mut State, diff --git a/code/crates/core-consensus/src/handle/sync.rs b/code/crates/core-consensus/src/handle/sync.rs index 2249b18ef..6518fafb9 100644 --- a/code/crates/core-consensus/src/handle/sync.rs +++ b/code/crates/core-consensus/src/handle/sync.rs @@ -2,8 +2,6 @@ use crate::handle::driver::apply_driver_input; use crate::handle::signature::verify_certificate; use crate::handle::validator_set::get_validator_set; use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; pub async fn on_commit_certificate( co: &Co, diff --git a/code/crates/core-consensus/src/handle/timeout.rs b/code/crates/core-consensus/src/handle/timeout.rs index f4c39991c..af28f8537 100644 --- a/code/crates/core-consensus/src/handle/timeout.rs +++ b/code/crates/core-consensus/src/handle/timeout.rs @@ -2,8 +2,6 @@ use crate::handle::decide::decide; use crate::handle::driver::apply_driver_input; use crate::handle::step_timeout::on_step_limit_timeout; use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; pub async fn on_timeout_elapsed( co: &Co, diff --git a/code/crates/core-consensus/src/handle/vote.rs b/code/crates/core-consensus/src/handle/vote.rs index 90409baee..223286912 100644 --- a/code/crates/core-consensus/src/handle/vote.rs +++ b/code/crates/core-consensus/src/handle/vote.rs @@ -1,13 +1,11 @@ -#[cfg(not(feature = "std"))] -use crate::types::Metrics; -use crate::{prelude::*, SignedConsensusMsg}; - use crate::handle::driver::apply_driver_input; use crate::handle::signature::verify_signature; use crate::handle::validator_set::get_validator_set; use crate::input::Input; +use crate::prelude::*; use crate::types::ConsensusMsg; use crate::util::pretty::PrettyVote; +use crate::SignedConsensusMsg; pub async fn on_vote( co: &Co, diff --git a/code/crates/core-consensus/src/handle/vote_set.rs b/code/crates/core-consensus/src/handle/vote_set.rs index bc14bb9b8..ec235596a 100644 --- a/code/crates/core-consensus/src/handle/vote_set.rs +++ b/code/crates/core-consensus/src/handle/vote_set.rs @@ -1,8 +1,6 @@ use crate::handle::vote::on_vote; use crate::input::RequestId; use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; pub async fn on_vote_set_request( co: &Co, diff --git a/code/crates/core-consensus/src/prelude.rs b/code/crates/core-consensus/src/prelude.rs index c2999c8cc..f0ccd3c1d 100644 --- a/code/crates/core-consensus/src/prelude.rs +++ b/code/crates/core-consensus/src/prelude.rs @@ -3,8 +3,6 @@ pub use tracing::{debug, info, warn}; pub use malachitebft_core_driver::Input as DriverInput; pub use malachitebft_core_types::*; -#[cfg(feature = "std")] -pub use malachitebft_metrics::Metrics; pub use crate::effect::{Effect, Resume}; pub use crate::error::Error; @@ -12,3 +10,9 @@ pub use crate::gen::Co; pub use crate::input::Input; pub use crate::perform; pub use crate::state::State; + +#[cfg(feature = "std")] +pub use malachitebft_metrics::Metrics; + +#[cfg(not(feature = "std"))] +pub type Metrics = (); diff --git a/code/crates/core-consensus/src/types.rs b/code/crates/core-consensus/src/types.rs index adb6c9c67..fec157ea0 100644 --- a/code/crates/core-consensus/src/types.rs +++ b/code/crates/core-consensus/src/types.rs @@ -7,9 +7,7 @@ use malachitebft_core_types::{ pub use malachitebft_peer::PeerId; pub use multiaddr::Multiaddr; -// Dummy metrics structure -#[cfg(not(feature = "std"))] -pub type Metrics = (); + /// A signed consensus message, ie. a signed vote or a signed proposal. #[derive_where(Clone, Debug, PartialEq, Eq)] pub enum SignedConsensusMsg { From c028d72e9e768445c6bfc07dd7e60a7d2e4bcfc5 Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Wed, 15 Jan 2025 10:06:01 +0100 Subject: [PATCH 5/6] Add `metrics` feature --- code/crates/core-consensus/Cargo.toml | 4 +++- code/crates/core-consensus/src/handle.rs | 8 ++++---- code/crates/core-consensus/src/handle/decide.rs | 5 +++-- code/crates/core-consensus/src/handle/driver.rs | 9 +++++++-- code/crates/core-consensus/src/handle/propose.rs | 2 +- code/crates/core-consensus/src/handle/start_height.rs | 7 +++++-- code/crates/core-consensus/src/handle/step_timeout.rs | 4 +++- code/crates/core-consensus/src/prelude.rs | 4 ++-- 8 files changed, 28 insertions(+), 15 deletions(-) diff --git a/code/crates/core-consensus/Cargo.toml b/code/crates/core-consensus/Cargo.toml index 580535c08..8a4dace0e 100644 --- a/code/crates/core-consensus/Cargo.toml +++ b/code/crates/core-consensus/Cargo.toml @@ -13,7 +13,9 @@ readme = "../../../README.md" all-features = true [features] -std = ["malachitebft-metrics"] +default = ["std", "metrics"] +std = [] +metrics = ["std", "dep:malachitebft-metrics"] debug = ["std", "malachitebft-core-driver/debug"] [dependencies] diff --git a/code/crates/core-consensus/src/handle.rs b/code/crates/core-consensus/src/handle.rs index f35849af5..ca076607e 100644 --- a/code/crates/core-consensus/src/handle.rs +++ b/code/crates/core-consensus/src/handle.rs @@ -1,6 +1,4 @@ -use crate::prelude::*; -#[cfg(not(feature = "std"))] -use crate::types::Metrics; + mod decide; mod driver; mod proposal; @@ -24,11 +22,13 @@ use timeout::on_timeout_elapsed; use vote::on_vote; use vote_set::{on_vote_set_request, on_vote_set_response}; +use crate::prelude::*; + #[allow(private_interfaces)] pub async fn handle( co: Co, state: &mut State, - #[allow(unused_variables)] metrics: &Metrics, + metrics: &Metrics, input: Input, ) -> Result<(), Error> where diff --git a/code/crates/core-consensus/src/handle/decide.rs b/code/crates/core-consensus/src/handle/decide.rs index 76f20b3fd..01d0fc96d 100644 --- a/code/crates/core-consensus/src/handle/decide.rs +++ b/code/crates/core-consensus/src/handle/decide.rs @@ -1,9 +1,10 @@ use crate::prelude::*; +#[cfg_attr(not(feature = "metrics"), allow(unused_variables))] pub async fn decide( co: &Co, state: &mut State, - #[allow(unused_variables)] metrics: &Metrics, + metrics: &Metrics, consensus_round: Round, proposal: SignedProposal, ) -> Result<(), Error> @@ -21,7 +22,7 @@ where state.remove_full_proposals(height); // Update metrics - #[cfg(feature = "std")] + #[cfg(feature = "metrics")] { // We are only interested in consensus time for round 0, ie. in the happy path. if consensus_round == Round::new(0) { diff --git a/code/crates/core-consensus/src/handle/driver.rs b/code/crates/core-consensus/src/handle/driver.rs index 4e094a9f5..76b63768c 100644 --- a/code/crates/core-consensus/src/handle/driver.rs +++ b/code/crates/core-consensus/src/handle/driver.rs @@ -21,10 +21,11 @@ where { match &input { DriverInput::NewRound(height, round, proposer) => { - #[cfg(feature = "std")] + #[cfg(feature = "metrics")] metrics.round.set(round.as_i64()); info!(%height, %round, %proposer, "Starting new round"); + perform!(co, Effect::CancelAllTimeouts(Default::default())); perform!( co, @@ -97,6 +98,7 @@ where // If the step has changed, update the metrics if prev_step != new_step { debug!(step.previous = ?prev_step, step.new = ?new_step, "Transitioned to new step"); + if let Some(valid) = &state.driver.valid_value() { if state.driver.step_is_propose() { info!( @@ -105,7 +107,8 @@ where ); } } - #[cfg(feature = "std")] + + #[cfg(feature = "metrics")] { metrics.step_end(prev_step); metrics.step_start(new_step); @@ -122,6 +125,7 @@ where ) ); } + if state.driver.step_is_precommit() { perform!( co, @@ -138,6 +142,7 @@ where ) ); } + if state.driver.step_is_commit() { perform!( co, diff --git a/code/crates/core-consensus/src/handle/propose.rs b/code/crates/core-consensus/src/handle/propose.rs index 97b4d5f1c..005a2d843 100644 --- a/code/crates/core-consensus/src/handle/propose.rs +++ b/code/crates/core-consensus/src/handle/propose.rs @@ -37,7 +37,7 @@ where return Ok(()); } - #[cfg(feature = "std")] + #[cfg(feature = "metrics")] metrics.consensus_start(); state.store_value(&ProposedValue { diff --git a/code/crates/core-consensus/src/handle/start_height.rs b/code/crates/core-consensus/src/handle/start_height.rs index 690814dd5..5cb761f36 100644 --- a/code/crates/core-consensus/src/handle/start_height.rs +++ b/code/crates/core-consensus/src/handle/start_height.rs @@ -15,7 +15,8 @@ where { perform!(co, Effect::CancelAllTimeouts(Default::default())); perform!(co, Effect::ResetTimeouts(Default::default())); - #[cfg(feature = "std")] + + #[cfg(feature = "metrics")] metrics.step_end(state.driver.step()); state.driver.move_to_height(height, validator_set); @@ -37,12 +38,14 @@ where { let round = Round::new(0); info!(%height, "Starting new height"); - #[cfg(feature = "std")] + + #[cfg(feature = "metrics")] { metrics.block_start(); metrics.height.set(height.as_u64() as i64); metrics.round.set(round.as_i64()); } + let proposer = state.get_proposer(height, round); apply_driver_input( diff --git a/code/crates/core-consensus/src/handle/step_timeout.rs b/code/crates/core-consensus/src/handle/step_timeout.rs index 7877387ae..3b74ce9d0 100644 --- a/code/crates/core-consensus/src/handle/step_timeout.rs +++ b/code/crates/core-consensus/src/handle/step_timeout.rs @@ -1,5 +1,6 @@ use crate::prelude::*; +#[cfg_attr(not(feature = "metrics"), allow(unused_variables))] pub async fn on_step_limit_timeout( co: &Co, state: &mut State, @@ -17,7 +18,8 @@ where co, Effect::GetVoteSet(state.driver.height(), round, Default::default()) ); - #[cfg(feature = "std")] + + #[cfg(feature = "metrics")] metrics.step_timeouts.inc(); if state.driver.step_is_prevote() { diff --git a/code/crates/core-consensus/src/prelude.rs b/code/crates/core-consensus/src/prelude.rs index f0ccd3c1d..0e114e0f7 100644 --- a/code/crates/core-consensus/src/prelude.rs +++ b/code/crates/core-consensus/src/prelude.rs @@ -11,8 +11,8 @@ pub use crate::input::Input; pub use crate::perform; pub use crate::state::State; -#[cfg(feature = "std")] +#[cfg(feature = "metrics")] pub use malachitebft_metrics::Metrics; -#[cfg(not(feature = "std"))] +#[cfg(not(feature = "metrics"))] pub type Metrics = (); From 15e62bb878a9dc722e9c023a76f676d24bf2712b Mon Sep 17 00:00:00 2001 From: Romain Ruetschi Date: Wed, 15 Jan 2025 10:06:50 +0100 Subject: [PATCH 6/6] Formatting --- code/crates/core-consensus/src/handle.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/code/crates/core-consensus/src/handle.rs b/code/crates/core-consensus/src/handle.rs index ca076607e..4ef1a4145 100644 --- a/code/crates/core-consensus/src/handle.rs +++ b/code/crates/core-consensus/src/handle.rs @@ -1,4 +1,3 @@ - mod decide; mod driver; mod proposal;