reth_ress_protocol/lib.rs
1//! RESS protocol for stateless Ethereum nodes.
2//!
3//! Enables stateless nodes to fetch execution witnesses, bytecode, and block data from
4//! stateful peers for minimal on-disk state with full execution capability.
5//!
6//! ## Node Types
7//!
8//! - **Stateless**: Minimal state, requests data on-demand
9//! - **Stateful**: Full Ethereum nodes providing state data
10//!
11//! Valid connections: Stateless ↔ Stateless ✅, Stateless ↔ Stateful ✅, Stateful ↔ Stateful ❌
12//!
13//! ## Messages
14//!
15//! - `NodeType (0x00)`: Handshake
16//! - `GetHeaders/Headers (0x01/0x02)`: Block headers
17//! - `GetBlockBodies/BlockBodies (0x03/0x04)`: Block bodies
18//! - `GetBytecode/Bytecode (0x05/0x06)`: Contract bytecode
19//! - `GetWitness/Witness (0x07/0x08)`: Execution witnesses
20//!
21//! ## Flow
22//!
23//! 1. Exchange `NodeType` for compatibility
24//! 2. Download ancestor blocks via headers/bodies
25//! 3. For new payloads: request witness → get missing bytecode → execute
26//!
27//! Protocol version: `ress/1`
28
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/paradigmxyz/reth/issues/"
33)]
34#![cfg_attr(not(test), warn(unused_crate_dependencies))]
35#![cfg_attr(docsrs, feature(doc_cfg))]
36
37mod types;
38pub use types::*;
39
40mod message;
41pub use message::*;
42
43mod provider;
44pub use provider::*;
45
46mod handlers;
47pub use handlers::*;
48
49mod connection;
50pub use connection::{RessPeerRequest, RessProtocolConnection};
51
52#[cfg(any(test, feature = "test-utils"))]
53pub mod test_utils;