mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
docs(net): add bird's eye view docs (#456)
This commit is contained in:
1
crates/net/network/README.md
Normal file
1
crates/net/network/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# RETH network implementation
|
||||||
@ -14,6 +14,37 @@
|
|||||||
//! port of that network. This includes public identities (public key) and addresses (where to reach
|
//! port of that network. This includes public identities (public key) and addresses (where to reach
|
||||||
//! them).
|
//! them).
|
||||||
//!
|
//!
|
||||||
|
//! ## Bird's Eye View
|
||||||
|
//!
|
||||||
|
//! See also diagram in [`NetworkManager`]
|
||||||
|
//!
|
||||||
|
//! The `Network` is made up of several, separate tasks:
|
||||||
|
//!
|
||||||
|
//! - `Transactions Task`: is a spawned
|
||||||
|
//! [`TransactionManager`](crate::transactions::TransactionsManager) future that:
|
||||||
|
//!
|
||||||
|
//! * Responds to incoming transaction related requests
|
||||||
|
//! * Requests missing transactions from the `Network`
|
||||||
|
//! * Broadcasts new transactions received from the
|
||||||
|
//! [`TransactionPool`](reth_transaction_pool::TransactionPool) over the `Network`
|
||||||
|
//!
|
||||||
|
//! - `ETH request Task`: is a spawned
|
||||||
|
//! [`EthRequestHandler`](crate::eth_requests::EthRequestHandler) future that:
|
||||||
|
//!
|
||||||
|
//! * Responds to incoming ETH related requests: `Headers`, `Bodies`
|
||||||
|
//!
|
||||||
|
//! - `Discovery Task`: is a spawned [`Discv4`](reth_discv4::Discv4) future that handles peer
|
||||||
|
//! discovery and emits new peers to the `Network`
|
||||||
|
//!
|
||||||
|
//! - [`NetworkManager`] task advances the state of the `Network`, which includes:
|
||||||
|
//!
|
||||||
|
//! * Initiating new _outgoing_ connections to discovered peers
|
||||||
|
//! * Handling _incoming_ TCP connections from peers
|
||||||
|
//! * Peer management
|
||||||
|
//! * Route requests:
|
||||||
|
//! - from remote peers to corresponding tasks
|
||||||
|
//! - from local to remote peers
|
||||||
|
//!
|
||||||
//! ## Usage
|
//! ## Usage
|
||||||
//!
|
//!
|
||||||
//! ### Configure and launch a standalone network
|
//! ### Configure and launch a standalone network
|
||||||
|
|||||||
@ -62,19 +62,23 @@ use tracing::{error, info, trace, warn};
|
|||||||
/// graph TB
|
/// graph TB
|
||||||
/// handle(NetworkHandle)
|
/// handle(NetworkHandle)
|
||||||
/// events(NetworkEvents)
|
/// events(NetworkEvents)
|
||||||
/// transactions[(Transactions Task)]
|
/// transactions(Transactions Task)
|
||||||
|
/// ethrequest(ETH Request Task)
|
||||||
|
/// discovery(Discovery Task)
|
||||||
/// subgraph NetworkManager
|
/// subgraph NetworkManager
|
||||||
/// direction LR
|
/// direction LR
|
||||||
/// subgraph Swarm
|
/// subgraph Swarm
|
||||||
/// direction TB
|
/// direction TB
|
||||||
/// B1[(Peer Sessions)]
|
/// B1[(Session Manager)]
|
||||||
/// B2[(Connection Lister)]
|
/// B2[(Connection Lister)]
|
||||||
/// B3[(State)]
|
/// B3[(Network State)]
|
||||||
/// end
|
/// end
|
||||||
/// end
|
/// end
|
||||||
/// handle <--> |request/response channel| NetworkManager
|
/// handle <--> |request response channel| NetworkManager
|
||||||
/// NetworkManager --> |Network events| events
|
/// NetworkManager --> |Network events| events
|
||||||
/// transactions --> |propagate transactions| NetworkManager
|
/// transactions <--> |transactions| NetworkManager
|
||||||
|
/// ethrequest <--> |ETH request handing| NetworkManager
|
||||||
|
/// discovery --> |Discovered peers| NetworkManager
|
||||||
/// ```
|
/// ```
|
||||||
#[must_use = "The NetworkManager does nothing unless polled"]
|
#[must_use = "The NetworkManager does nothing unless polled"]
|
||||||
pub struct NetworkManager<C> {
|
pub struct NetworkManager<C> {
|
||||||
|
|||||||
Reference in New Issue
Block a user