reth_storage_api/
chain_info.rs

1use alloy_rpc_types_engine::ForkchoiceState;
2use reth_primitives::SealedHeader;
3use std::time::Instant;
4
5/// A type that can track updates related to fork choice updates.
6pub trait CanonChainTracker: Send + Sync {
7    /// The header type.
8    type Header: Send + Sync;
9
10    /// Notify the tracker about a received fork choice update.
11    fn on_forkchoice_update_received(&self, update: &ForkchoiceState);
12
13    /// Returns the last time a fork choice update was received from the CL
14    /// ([`CanonChainTracker::on_forkchoice_update_received`])
15    fn last_received_update_timestamp(&self) -> Option<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    fn last_exchanged_transition_configuration_timestamp(&self) -> Option<Instant>;
23
24    /// Sets the canonical head of the chain.
25    fn set_canonical_head(&self, header: SealedHeader<Self::Header>);
26
27    /// Sets the safe block of the chain.
28    fn set_safe(&self, header: SealedHeader<Self::Header>);
29
30    /// Sets the finalized block of the chain.
31    fn set_finalized(&self, header: SealedHeader<Self::Header>);
32}