Skip to content

Commit

Permalink
docs: inline mermaid diagrams meanwhile aquamarine is fixed
Browse files Browse the repository at this point in the history
Re-exports doesn't work well with include_mmd! so we're embedding the diagrams in the code meanwhile.
  • Loading branch information
vcastellm committed Nov 27, 2024
1 parent 3b8c661 commit e747295
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 2 deletions.
23 changes: 22 additions & 1 deletion crates/net/network/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,28 @@ use tracing::{debug, error, trace, warn};
///
/// The [`NetworkManager`] is the container type for all parts involved with advancing the network.
///
/// include_mmd!("docs/mermaid/network-manager.mmd")
/// ```mermaid
/// graph TB
/// handle(NetworkHandle)
/// events(NetworkEvents)
/// transactions(Transactions Task)
/// ethrequest(ETH Request Task)
/// discovery(Discovery Task)
/// subgraph NetworkManager
/// direction LR
/// subgraph Swarm
/// direction TB
/// B1[(Session Manager)]
/// B2[(Connection Lister)]
/// B3[(Network State)]
/// end
/// end
/// handle <--> |request response channel| NetworkManager
/// NetworkManager --> |Network events| events
/// transactions <--> |transactions| NetworkManager
/// ethrequest <--> |ETH request handing| NetworkManager
/// discovery --> |Discovered peers| NetworkManager
/// ```
#[derive(Debug)]
#[must_use = "The NetworkManager does nothing unless polled"]
pub struct NetworkManager<N: NetworkPrimitives = EthNetworkPrimitives> {
Expand Down
35 changes: 34 additions & 1 deletion crates/transaction-pool/src/pool/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,40 @@ use tracing::trace;
///
/// This pool maintains the state of all transactions and stores them accordingly.
///
/// `include_mmd!("docs/mermaid/txpool.mmd`")
/// ```mermaid
/// graph TB
/// subgraph TxPool
/// direction TB
/// pool[(All Transactions)]
/// subgraph Subpools
/// direction TB
/// B3[(Queued)]
/// B1[(Pending)]
/// B2[(Basefee)]
/// B4[(Blob)]
/// end
/// end
/// discard([discard])
/// production([Block Production])
/// new([New Block])
/// A[Incoming Tx] --> B[Validation] -->|ins
/// pool --> |if ready + blobfee too low| B4
/// pool --> |if ready| B1
/// pool --> |if ready + basfee too low| B2
/// pool --> |nonce gap or lack of funds| B3
/// pool --> |update| pool
/// B1 --> |best| production
/// B2 --> |worst| discard
/// B3 --> |worst| discard
/// B4 --> |worst| discard
/// B1 --> |increased blob fee| B4
/// B4 --> |decreased blob fee| B1
/// B1 --> |increased base fee| B2
/// B2 --> |decreased base fee| B1
/// B3 --> |promote| B1
/// B3 --> |promote| B2
/// new --> |apply state changes| pool
/// ```
pub struct TxPool<T: TransactionOrdering> {
/// Contains the currently known information about the senders.
sender_info: FxHashMap<SenderId, SenderInfo>,
Expand Down

0 comments on commit e747295

Please sign in to comment.