diff --git a/crates/exex/exex/src/context.rs b/crates/exex/exex/src/context.rs index f6d2602bca53..3b4d820df50f 100644 --- a/crates/exex/exex/src/context.rs +++ b/crates/exex/exex/src/context.rs @@ -6,28 +6,28 @@ use reth_tasks::TaskExecutor; use std::fmt::Debug; use tokio::sync::mpsc::{Receiver, UnboundedSender}; -/// Captures the context that an `ExEx` has access to. +/// Captures the context that an `ExEx` has access to pub struct ExExContext { - /// The current head of the blockchain at launch. + /// The current head of the blockchain at launch pub head: Head, /// The config of the node pub config: NodeConfig, /// The loaded node config pub reth_config: reth_config::Config, - /// Channel used to send [`ExExEvent`]s to the rest of the node. + /// Channel used to send [`ExExEvent`]s to the rest of the node /// /// # Important /// - /// The exex should emit a `FinishedHeight` whenever a processed block is safe to prune. + /// The exex should emit a `FinishedHeight` whenever a processed block is safe to prune /// Additionally, the exex can pre-emptively emit a `FinishedHeight` event to specify what - /// blocks to receive notifications for. + /// blocks to receive notifications for pub events: UnboundedSender, /// Channel to receive [`ExExNotification`]s. /// /// # Important /// /// Once a an [`ExExNotification`] is sent over the channel, it is considered delivered by the - /// node. + /// node pub notifications: Receiver, /// node components @@ -55,22 +55,22 @@ impl Debug for ExExContext { } impl ExExContext { - /// Returns the transaction pool of the node. + /// Returns the transaction pool of the node pub fn pool(&self) -> &Node::Pool { self.components.pool() } - /// Returns the node's evm config. + /// Returns the node's evm config pub fn evm_config(&self) -> &Node::Evm { self.components.evm_config() } - /// Returns the node's executor type. + /// Returns the node's executor type pub fn block_executor(&self) -> &Node::Executor { self.components.block_executor() } - /// Returns the provider of the node. + /// Returns the provider of the node pub fn provider(&self) -> &Node::Provider { self.components.provider() } @@ -80,12 +80,12 @@ impl ExExContext { self.components.network() } - /// Returns the handle to the payload builder service. + /// Returns the handle to the payload builder service pub fn payload_builder(&self) -> &reth_payload_builder::PayloadBuilderHandle { self.components.payload_builder() } - /// Returns the task executor. + /// Returns the task executor pub fn task_executor(&self) -> &TaskExecutor { self.components.task_executor() } diff --git a/crates/exex/exex/src/lib.rs b/crates/exex/exex/src/lib.rs index 4c8c0aeb0da3..f472c850c414 100644 --- a/crates/exex/exex/src/lib.rs +++ b/crates/exex/exex/src/lib.rs @@ -35,22 +35,22 @@ #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #![cfg_attr(not(test), warn(unused_crate_dependencies))] -/// The context module, which contains the definition and implementation of the `ExExContext` struct. +/// the context module, which contains the definition and implementation of the `ExExContext` struct. mod context; pub use context::*; -/// The event module, which contains the definition of the `ExExEvent` enum. +/// the event module, which contains the definition of the `ExExEvent` enum. mod event; pub use event::*; -/// The manager module, which manages the lifecycle and execution of `ExEx` tasks. +/// the manager module, which manages the lifecycle and execution of `ExEx` tasks. mod manager; pub use manager::*; -/// The notification module, which handles the notifications that `ExEx` tasks can receive. +/// the notification module, which handles the notifications that `ExEx` tasks can receive. mod notification; pub use notification::*; -// Re-export ExEx types for easy access. +// re-export ExEx types for easy access. #[doc(inline)] pub use reth_exex_types::*; diff --git a/crates/exex/exex/src/manager.rs b/crates/exex/exex/src/manager.rs index dd878a6007bf..34aed29226ab 100644 --- a/crates/exex/exex/src/manager.rs +++ b/crates/exex/exex/src/manager.rs @@ -19,48 +19,48 @@ use tokio::sync::{ }; use tokio_util::sync::{PollSendError, PollSender, ReusableBoxFuture}; -/// Metrics for an `ExEx`. +/// metrics for an `ExEx`. #[derive(Metrics)] #[metrics(scope = "exex")] struct ExExMetrics { - /// The total number of notifications sent to an `ExEx`. + /// the total number of notifications sent to an `ExEx`. notifications_sent_total: Counter, - /// The total number of events an `ExEx` has sent to the manager. + /// the total number of events an `ExEx` has sent to the manager. events_sent_total: Counter, } -/// A handle to an `ExEx` used by the [`ExExManager`] to communicate with `ExEx`'s. +/// a handle to an `ExEx` used by the [`ExExManager`] to communicate with `ExEx`'s. /// -/// A handle should be created for each `ExEx` with a unique ID. The channels returned by +/// a handle should be created for each `ExEx` with a unique ID. The channels returned by /// [`ExExHandle::new`] should be given to the `ExEx`, while the handle itself should be given to /// the manager in [`ExExManager::new`]. #[derive(Debug)] pub struct ExExHandle { - /// The execution extension's ID. + /// the execution extension's ID. id: String, - /// Metrics for an `ExEx`. + /// metrics for an `ExEx`. metrics: ExExMetrics, - /// Channel to send [`ExExNotification`]s to the `ExEx`. + /// channel to send [`ExExNotification`]s to the `ExEx`. sender: PollSender, - /// Channel to receive [`ExExEvent`]s from the `ExEx`. + /// channel to receive [`ExExEvent`]s from the `ExEx`. receiver: UnboundedReceiver, - /// The ID of the next notification to send to this `ExEx`. + /// the ID of the next notification to send to this `ExEx`. next_notification_id: usize, - /// The finished block number of the `ExEx`. + /// the finished block number of the `ExEx`. /// - /// If this is `None`, the `ExEx` has not emitted a `FinishedHeight` event. + /// if this is `None`, the `ExEx` has not emitted a `FinishedHeight` event. finished_height: Option, } impl ExExHandle { - /// Create a new handle for the given `ExEx`. + /// create a new handle for the given `ExEx`. /// - /// Returns the handle, as well as a [`UnboundedSender`] for [`ExExEvent`]s and a + /// returns the handle, as well as a [`UnboundedSender`] for [`ExExEvent`]s and a /// [`Receiver`] for [`ExExNotification`]s that should be given to the `ExEx`. pub fn new(id: String) -> (Self, UnboundedSender, Receiver) { - // Create channels for notifications and events + // create channels for notifications and events let (notification_tx, notification_rx) = mpsc::channel(1); let (event_tx, event_rx) = mpsc::unbounded_channel(); @@ -78,10 +78,10 @@ impl ExExHandle { ) } - /// Reserves a slot in the `PollSender` channel and sends the notification if the slot was + /// reserves a slot in the `PollSender` channel and sends the notification if the slot was /// successfully reserved. /// - /// When the notification is sent, it is considered delivered. + /// whe n the notification is sent, it is considered delivered. fn send( &mut self, cx: &mut Context<'_>, @@ -90,9 +90,9 @@ impl ExExHandle { if let Some(finished_height) = self.finished_height { match notification { ExExNotification::ChainCommitted { new } => { - // Skip the chain commit notification if the finished height of the ExEx is + // skip the chain commit notification if the finished height of the ExEx is // higher than or equal to the tip of the new notification. - // I.e., the ExEx has already processed the notification. + // gia paradeigma the ExEx has already processed the notification. if finished_height >= new.tip().number { debug!( exex_id = %self.id, @@ -140,19 +140,19 @@ impl ExExHandle { } } -/// Metrics for the `ExEx` manager. +/// metrics for the `ExEx` manager. #[derive(Metrics)] #[metrics(scope = "exex_manager")] pub struct ExExManagerMetrics { - /// Max size of the internal state notifications buffer. + /// max size of the internal state notifications buffer. max_capacity: Gauge, - /// Current capacity of the internal state notifications buffer. + /// current capacity of the internal state notifications buffer. current_capacity: Gauge, - /// Current size of the internal state notifications buffer. + /// current size of the internal state notifications buffer. /// - /// Note that this might be slightly bigger than the maximum capacity in some cases. + /// note that this might be slightly bigger than the maximum capacity in some cases. buffer_size: Gauge, - /// Current number of `ExEx`'s on the node. + /// current number of `ExEx`'s on the node. num_exexs: Gauge, } @@ -507,7 +507,7 @@ mod tests { #[tokio::test] async fn delivers_events() {} - // Test function for ensuring events are delivered correctly + // Ttest function for ensuring events are delivered correctly #[tokio::test] async fn capacity() {} diff --git a/crates/exex/exex/src/notification.rs b/crates/exex/exex/src/notification.rs index 88d1d7d615d6..863966adad84 100644 --- a/crates/exex/exex/src/notification.rs +++ b/crates/exex/exex/src/notification.rs @@ -2,24 +2,24 @@ use std::sync::Arc; use reth_provider::{CanonStateNotification, Chain}; -/// Notifications sent to an `ExEx`. +/// notifications sent to an `ExEx` #[derive(Debug, Clone, PartialEq, Eq)] pub enum ExExNotification { - /// Chain got committed without a reorg, and only the new chain is returned. + /// chain got committed without a reorg, and only the new chain is returned ChainCommitted { - /// The new chain after commit. + /// the new chain after commit new: Arc, }, - /// Chain got reorged, and both the old and the new chains are returned. + /// Chain got reorged, and both the old and the new chains are returned ChainReorged { - /// The old chain before reorg. + /// The old chain before reorg old: Arc, - /// The new chain after reorg. + /// The new chain after reorg new: Arc, }, - /// Chain got reverted, and only the old chain is returned. + /// Chain got reverted, and only the old chain is returned ChainReverted { - /// The old chain before reversion. + /// The old chain before reversion old: Arc, }, }