chore(exex): move notification to types crate (#9586)

This commit is contained in:
Alexey Shekhirin
2024-07-17 17:39:19 +01:00
committed by GitHub
parent 0994d36c4e
commit bc4a16737b
7 changed files with 43 additions and 30 deletions

View File

@ -37,7 +37,6 @@ tokio-util.workspace = true
## misc
eyre.workspace = true
metrics.workspace = true
serde = { workspace = true, optional = true }
[dev-dependencies]
reth-chainspec.workspace = true
@ -53,4 +52,4 @@ secp256k1.workspace = true
[features]
default = []
serde = ["dep:serde", "reth-provider/serde"]
serde = ["reth-provider/serde", "reth-exex-types/serde"]

View File

@ -46,9 +46,6 @@ pub use event::*;
mod manager;
pub use manager::*;
mod notification;
pub use notification::*;
// Re-export exex types
#[doc(inline)]
pub use reth_exex_types::*;

View File

@ -12,4 +12,15 @@ description = "Commonly used types for exex usage in reth."
workspace = true
[dependencies]
# reth
reth-provider.workspace = true
# reth
alloy-primitives.workspace = true
# misc
serde = { workspace = true, optional = true }
[features]
default = []
serde = ["dep:serde", "reth-provider/serde"]

View File

@ -0,0 +1,25 @@
use alloy_primitives::BlockNumber;
/// The finished height of all `ExEx`'s.
#[derive(Debug, Clone, Copy)]
pub enum FinishedExExHeight {
/// No `ExEx`'s are installed, so there is no finished height.
NoExExs,
/// Not all `ExExs` have emitted a `FinishedHeight` event yet.
NotReady,
/// The finished height of all `ExEx`'s.
///
/// This is the lowest common denominator between all `ExEx`'s.
///
/// This block is used to (amongst other things) determine what blocks are safe to prune.
///
/// The number is inclusive, i.e. all blocks `<= finished_height` are safe to prune.
Height(BlockNumber),
}
impl FinishedExExHeight {
/// Returns `true` if not all `ExExs` have emitted a `FinishedHeight` event yet.
pub const fn is_not_ready(&self) -> bool {
matches!(self, Self::NotReady)
}
}

View File

@ -8,28 +8,8 @@
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
use alloy_primitives::BlockNumber;
mod finished_height;
mod notification;
/// The finished height of all `ExEx`'s.
#[derive(Debug, Clone, Copy)]
pub enum FinishedExExHeight {
/// No `ExEx`'s are installed, so there is no finished height.
NoExExs,
/// Not all `ExExs` have emitted a `FinishedHeight` event yet.
NotReady,
/// The finished height of all `ExEx`'s.
///
/// This is the lowest common denominator between all `ExEx`'s.
///
/// This block is used to (amongst other things) determine what blocks are safe to prune.
///
/// The number is inclusive, i.e. all blocks `<= finished_height` are safe to prune.
Height(BlockNumber),
}
impl FinishedExExHeight {
/// Returns `true` if not all `ExExs` have emitted a `FinishedHeight` event yet.
pub const fn is_not_ready(&self) -> bool {
matches!(self, Self::NotReady)
}
}
pub use finished_height::FinishedExExHeight;
pub use notification::ExExNotification;