mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +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
|
||||
//! 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
|
||||
//!
|
||||
//! ### Configure and launch a standalone network
|
||||
|
||||
@ -62,19 +62,23 @@ use tracing::{error, info, trace, warn};
|
||||
/// graph TB
|
||||
/// handle(NetworkHandle)
|
||||
/// events(NetworkEvents)
|
||||
/// transactions[(Transactions Task)]
|
||||
/// transactions(Transactions Task)
|
||||
/// ethrequest(ETH Request Task)
|
||||
/// discovery(Discovery Task)
|
||||
/// subgraph NetworkManager
|
||||
/// direction LR
|
||||
/// subgraph Swarm
|
||||
/// direction TB
|
||||
/// B1[(Peer Sessions)]
|
||||
/// B1[(Session Manager)]
|
||||
/// B2[(Connection Lister)]
|
||||
/// B3[(State)]
|
||||
/// B3[(Network State)]
|
||||
/// end
|
||||
/// end
|
||||
/// handle <--> |request/response channel| NetworkManager
|
||||
/// end
|
||||
/// handle <--> |request response channel| NetworkManager
|
||||
/// 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"]
|
||||
pub struct NetworkManager<C> {
|
||||
|
||||
Reference in New Issue
Block a user