reth_exex/lib.rs
1// todo: expand this (examples, assumptions, invariants)
2//! Execution extensions (`ExEx`).
3//!
4//! An execution extension is a task that derives its state from Reth's state.
5//!
6//! Some examples of such state derives are rollups, bridges, and indexers.
7//!
8//! An `ExEx` is a [`Future`] resolving to a `Result<()>` that is run indefinitely alongside Reth.
9//!
10//! `ExEx`'s are initialized using an async closure that resolves to the `ExEx`; this closure gets
11//! passed an [`ExExContext`] where it is possible to spawn additional tasks and modify Reth.
12//!
13//! Most `ExEx`'s will want to derive their state from the [`CanonStateNotification`] channel given
14//! in [`ExExContext`]. A new notification is emitted whenever blocks are executed in live and
15//! historical sync.
16//!
17//! # Pruning
18//!
19//! `ExEx`'s **SHOULD** emit an `ExExEvent::FinishedHeight` event to signify what blocks have been
20//! processed. This event is used by Reth to determine what state can be pruned.
21//!
22//! An `ExEx` will only receive notifications for blocks greater than the block emitted in the
23//! event. To clarify: if the `ExEx` emits `ExExEvent::FinishedHeight(0)` it will receive
24//! notifications for any `block_number > 0`.
25//!
26//! [`Future`]: std::future::Future
27//! [`ExExContext`]: crate::ExExContext
28//! [`CanonStateNotification`]: reth_provider::CanonStateNotification
29#![doc(
30 html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
31 html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
32 issue_tracker_base_url = "https://github.com/SeismicSystems/seismic-reth/issues/"
33)]
34#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
35#![cfg_attr(not(test), warn(unused_crate_dependencies))]
36
37mod backfill;
38pub use backfill::*;
39
40mod context;
41pub use context::*;
42
43mod dyn_context;
44pub use dyn_context::*;
45
46mod event;
47pub use event::*;
48
49mod manager;
50pub use manager::*;
51
52mod notifications;
53pub use notifications::*;
54
55mod wal;
56pub use wal::*;
57
58// Re-export exex types
59#[doc(inline)]
60pub use reth_exex_types::*;