diff --git a/crates/task-impls/src/consensus.rs b/crates/task-impls/src/consensus.rs index 34ad675ee2..c1e5d08b6f 100644 --- a/crates/task-impls/src/consensus.rs +++ b/crates/task-impls/src/consensus.rs @@ -507,9 +507,30 @@ impl, A: ConsensusApi + let consensus = self.consensus.upgradable_read().await; - // Construct the leaf. + // Get the parent leaf. let parent = if justify_qc.is_genesis { - self.genesis_leaf().await + // Send the `Decide` event for the genesis block if the justify QC is genesis. + let leaf = self.genesis_leaf().await; + match leaf { + Some(ref leaf) => { + self.output_event_stream + .publish(Event { + view_number: TYPES::Time::genesis(), + event: EventType::Decide { + leaf_chain: Arc::new(vec![leaf.clone()]), + qc: Arc::new(justify_qc.clone()), + block_size: None, + }, + }) + .await; + } + None => { + error!( + "Failed to find the genesis leaf while the justify QC is genesis." + ); + } + } + leaf } else { consensus .saved_leaves diff --git a/crates/testing/src/overall_safety_task.rs b/crates/testing/src/overall_safety_task.rs index d52ca5ebba..d145a2fd58 100644 --- a/crates/testing/src/overall_safety_task.rs +++ b/crates/testing/src/overall_safety_task.rs @@ -15,7 +15,7 @@ use hotshot_types::{ error::RoundTimedoutState, event::{Event, EventType}, simple_certificate::QuorumCertificate, - traits::node_implementation::NodeType, + traits::node_implementation::{ConsensusTime, NodeType}, }; use snafu::Snafu; use std::{ @@ -445,6 +445,10 @@ impl OverallSafetyPropertiesDescription { qc, block_size: maybe_block_size, } => { + // Skip the genesis leaf. + if leaf_chain.len() == 1 && leaf_chain[0].get_view_number() == TYPES::Time::genesis() { + return (None, state); + } let paired_up = (leaf_chain.to_vec(), (*qc).clone()); match state.ctx.round_results.entry(view_number) { Entry::Occupied(mut o) => o.get_mut().insert_into_result(