Skip to main content

reth_exex/
event.rs

1use alloy_eips::BlockNumHash;
2
3/// Events emitted by an `ExEx`.
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum ExExEvent {
6    /// Highest block processed by the `ExEx`.
7    ///
8    /// The `ExEx` must guarantee that it will not require all earlier blocks in the future,
9    /// meaning that Reth is allowed to prune them.
10    ///
11    /// On reorgs, it's possible for the height to go down.
12    ///
13    /// The manager drops, rather than defers, this event if the `ExEx` sent it before its
14    /// notification stream yielded every notification that reverts blocks the manager has sent,
15    /// because it may name a block that one of them reverted. This also applies to events sent
16    /// preemptively, and to every event sent while a revert waits in the stream until a backfill
17    /// finishes. The `ExEx` should report again after processing the revert.
18    ///
19    /// The `ExEx` must not report a block that a notification it has already taken from the stream
20    /// reverts, for example when it reads notifications ahead of processing them: the manager
21    /// can't tell that report from a fresh one.
22    FinishedHeight(BlockNumHash),
23    /// Sent by [`ExExNotifications`](crate::ExExNotifications) when it yields or skips a
24    /// notification from the manager that reverts blocks.
25    ///
26    /// Because it shares the channel with [`ExExEvent::FinishedHeight`], it tells the manager
27    /// which of those events the `ExEx` sent after receiving the revert.
28    RevertReceived(RevertReceipt),
29}
30
31/// The payload of [`ExExEvent::RevertReceived`].
32///
33/// Only the notification stream creates it, so an `ExEx` cannot acknowledge a revert it has not
34/// received.
35#[derive(Debug, Clone, Copy, PartialEq, Eq)]
36pub struct RevertReceipt(pub(crate) ());