diff --git a/crates/consensus/beacon/src/engine/event.rs b/crates/consensus/beacon/src/engine/event.rs index 994cda060c..d617ee4f23 100644 --- a/crates/consensus/beacon/src/engine/event.rs +++ b/crates/consensus/beacon/src/engine/event.rs @@ -2,7 +2,11 @@ use crate::engine::forkchoice::ForkchoiceStatus; use alloy_primitives::B256; use reth_primitives::{SealedBlock, SealedHeader}; use reth_rpc_types::engine::ForkchoiceState; -use std::{sync::Arc, time::Duration}; +use std::{ + fmt::{Display, Formatter, Result}, + sync::Arc, + time::Duration, +}; /// Events emitted by [`crate::BeaconConsensusEngine`]. #[derive(Clone, Debug)] @@ -30,6 +34,28 @@ impl BeaconConsensusEngineEvent { } } +impl Display for BeaconConsensusEngineEvent { + fn fmt(&self, f: &mut Formatter<'_>) -> Result { + match self { + Self::ForkchoiceUpdated(state, status) => { + write!(f, "ForkchoiceUpdated({state:?}, {status:?})") + } + Self::ForkBlockAdded(block, duration) => { + write!(f, "ForkBlockAdded({:?}, {duration:?})", block.num_hash()) + } + Self::CanonicalBlockAdded(block, duration) => { + write!(f, "CanonicalBlockAdded({:?}, {duration:?})", block.num_hash()) + } + Self::CanonicalChainCommitted(block, duration) => { + write!(f, "CanonicalChainCommitted({:?}, {duration:?})", block.num_hash()) + } + Self::LiveSyncProgress(progress) => { + write!(f, "LiveSyncProgress({progress:?})") + } + } + } +} + /// Progress of the consensus engine during live sync. #[derive(Clone, Debug)] pub enum ConsensusEngineLiveSyncProgress {