mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: use new aquamarine macro (#5785)
This commit is contained in:
31
docs/mermaid/fetch-client.mmd
Normal file
31
docs/mermaid/fetch-client.mmd
Normal file
@ -0,0 +1,31 @@
|
||||
sequenceDiagram
|
||||
participant Client as FetchClient
|
||||
participant Fetcher as StateFetcher
|
||||
participant State as NetworkState
|
||||
participant Session as Active Peer Session
|
||||
participant Peers as PeerManager
|
||||
loop Send Request, retry if retriable and remaining retries
|
||||
Client->>Fetcher: DownloadRequest{GetHeaders, GetBodies}
|
||||
Note over Client,Fetcher: Request and oneshot Sender sent via `request_tx` channel
|
||||
loop Process buffered requests
|
||||
State->>Fetcher: poll action
|
||||
Fetcher->>Fetcher: Select Available Peer
|
||||
Note over Fetcher: Peer is available if it's currently idle, no inflight requests
|
||||
Fetcher->>State: FetchAction::BlockDownloadRequest
|
||||
State->>Session: Delegate Request
|
||||
Note over State,Session: Request and oneshot Sender sent via `to_session_tx` channel
|
||||
end
|
||||
Session->>Session: Send Request to remote
|
||||
Session->>Session: Enforce Request timeout
|
||||
Session-->>State: Send Response Result via channel
|
||||
State->>Fetcher: Delegate Response
|
||||
Fetcher-->>Client: Send Response via channel
|
||||
opt Bad Response
|
||||
Client->>Peers: Penalize Peer
|
||||
end
|
||||
Peers->>Peers: Apply Reputation Change
|
||||
opt reputation dropped below threshold
|
||||
Peers->>State: Disconnect Session
|
||||
State->>Session: Delegate Disconnect
|
||||
end
|
||||
end
|
||||
20
docs/mermaid/network-manager.mmd
Normal file
20
docs/mermaid/network-manager.mmd
Normal file
@ -0,0 +1,20 @@
|
||||
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
|
||||
31
docs/mermaid/pipeline.mmd
Normal file
31
docs/mermaid/pipeline.mmd
Normal file
@ -0,0 +1,31 @@
|
||||
graph TB
|
||||
Start[Start]
|
||||
Done[Done]
|
||||
Error[Error]
|
||||
subgraph Unwind
|
||||
StartUnwind(Unwind in reverse order of execution)
|
||||
UnwindStage(Unwind stage)
|
||||
NextStageToUnwind(Next stage)
|
||||
end
|
||||
subgraph Single loop
|
||||
RunLoop(Run loop)
|
||||
NextStage(Next stage)
|
||||
LoopDone(Loop done)
|
||||
subgraph Stage Execution
|
||||
Execute(Execute stage)
|
||||
end
|
||||
end
|
||||
Start --> RunLoop --> NextStage
|
||||
NextStage --> |No stages left| LoopDone
|
||||
NextStage --> |Next stage| Execute
|
||||
Execute --> |Not done| Execute
|
||||
Execute --> |Unwind requested| StartUnwind
|
||||
Execute --> |Done| NextStage
|
||||
Execute --> |Error| Error
|
||||
StartUnwind --> NextStageToUnwind
|
||||
NextStageToUnwind --> |Next stage| UnwindStage
|
||||
NextStageToUnwind --> |No stages left| RunLoop
|
||||
UnwindStage --> |Error| Error
|
||||
UnwindStage --> |Unwound| NextStageToUnwind
|
||||
LoopDone --> |Target block reached| Done
|
||||
LoopDone --> |Target block not reached| RunLoop
|
||||
15
docs/mermaid/swarm.mmd
Normal file
15
docs/mermaid/swarm.mmd
Normal file
@ -0,0 +1,15 @@
|
||||
graph TB
|
||||
connections(TCP Listener)
|
||||
Discovery[(Discovery)]
|
||||
fetchRequest(Client Interfaces)
|
||||
Sessions[(SessionManager)]
|
||||
SessionTask[(Peer Session)]
|
||||
State[(State)]
|
||||
StateFetch[(State Fetcher)]
|
||||
connections --> |incoming| Sessions
|
||||
State --> |initiate outgoing| Sessions
|
||||
Discovery --> |update peers| State
|
||||
Sessions --> |spawns| SessionTask
|
||||
SessionTask <--> |handle state requests| State
|
||||
fetchRequest --> |request Headers, Bodies| StateFetch
|
||||
State --> |poll pending requests| StateFetch
|
||||
21
docs/mermaid/tree.mmd
Normal file
21
docs/mermaid/tree.mmd
Normal file
@ -0,0 +1,21 @@
|
||||
flowchart BT
|
||||
subgraph canonical chain
|
||||
CanonState:::state
|
||||
block0canon:::canon -->block1canon:::canon -->block2canon:::canon -->block3canon:::canon -->
|
||||
block4canon:::canon --> block5canon:::canon
|
||||
end
|
||||
block5canon --> block6pending1:::pending
|
||||
block5canon --> block6pending2:::pending
|
||||
subgraph sidechain2
|
||||
S2State:::state
|
||||
block3canon --> block4s2:::sidechain --> block5s2:::sidechain
|
||||
end
|
||||
subgraph sidechain1
|
||||
S1State:::state
|
||||
block2canon --> block3s1:::sidechain --> block4s1:::sidechain --> block5s1:::sidechain -->
|
||||
block6s1:::sidechain
|
||||
end
|
||||
classDef state fill:#1882C4
|
||||
classDef canon fill:#8AC926
|
||||
classDef pending fill:#FFCA3A
|
||||
classDef sidechain fill:#FF595E
|
||||
32
docs/mermaid/txpool.mmd
Normal file
32
docs/mermaid/txpool.mmd
Normal file
@ -0,0 +1,32 @@
|
||||
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] -->|insert| pool
|
||||
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
|
||||
Reference in New Issue
Block a user