reth_storage_api/
chain_info.rs

1use alloy_rpc_types_engine::ForkchoiceState;
2use reth_primitives_traits::SealedHeader;
3
4/// A type that can track updates related to fork choice updates.
5pub trait CanonChainTracker: Send + Sync {
6    /// The header type.
7    type Header: Send + Sync;
8
9    /// Notify the tracker about a received fork choice update.
10    fn on_forkchoice_update_received(&self, update: &ForkchoiceState);
11
12    /// Returns the last time a fork choice update was received from the CL
13    /// ([`CanonChainTracker::on_forkchoice_update_received`])
14    #[cfg(feature = "std")]
15    fn last_received_update_timestamp(&self) -> Option<std::time::Instant>;
16
17    /// Notify the tracker about a transition configuration exchange.
18    fn on_transition_configuration_exchanged(&self);
19
20    /// Returns the last time a transition configuration was exchanged with the CL
21    /// ([`CanonChainTracker::on_transition_configuration_exchanged`])
22    #[cfg(feature = "std")]
23    fn last_exchanged_transition_configuration_timestamp(&self) -> Option<std::time::Instant>;
24
25    /// Sets the canonical head of the chain.
26    fn set_canonical_head(&self, header: SealedHeader<Self::Header>);
27
28    /// Sets the safe block of the chain.
29    fn set_safe(&self, header: SealedHeader<Self::Header>);
30
31    /// Sets the finalized block of the chain.
32    fn set_finalized(&self, header: SealedHeader<Self::Header>);
33}