IntersectMBO / IntersectMBO/ouroboros-network

Query network state through LocalStateQuery mini-protocol

Open
#5,033 0 comments 0 reactions 1 assignee Claimed by @coot View on GitHub
ouroboros-diffusion
Dominant language
Haskell
Stars
296
Forks
104
Avg merge
2d 10h
Merged PRs (30d)
4

Description

In the first instance we will make it possible to query `node-to-node` state through `LocalStateQuery` mini-protocol (part of the node-to-client suite).

```hs
data ConnectionManagerState peeraddr = ConnectionManagerState {
connectionMap :: Map (ConnectionId peeraddr) AbstractState,
-- ^ map of connections, without outbound connections in
-- `ReservedOutboundSt` state.

registeredOutboundConnections :: Set peeraddr
-- ^ set of outbound connections in `ReserverdOutboundSt` state.
}
deriving (Eq, Show)

data InboundState peeraddr = InboundState {
remoteHotSet :: !(Set (ConnectionId peeraddr)),
remoteWarmSet :: !(Set (ConnectionId peeraddr)),
remoteColdSet :: !(Set (ConnectionId peeraddr)),
remoteIdleSet :: !(Set (ConnectionId peeraddr))
}
deriving (Eq, Show)

data OutboundState peeraddr = OutboundState {
coldPeers :: Set peeraddr,
warmPeers :: Set peeraddr,
hotPeers :: Set peeraddr
}
deriving (Eq, Show)

data NetworkState peeraddr = NetworkState {
connectionManagerState :: ConnectionManagerState peeraddr,
inboundGovernorState :: InboundState peeraddr,
outboundGovernorState :: OutboundState peeraddr
}
deriving (Eq, Show)
```

At a later stage, the `NetworkState` will be extended with Handshake results.
This work will be merged / released once #5007 is merged.

# TODOs

* [ ] provide a CDDL spec for `NetworkState` CBOR encoding

# Possible Future Extensions

* add handshake versions & version data
* add `node-to-client` data about inbound connections
* a new mini-protocol which allows to subscribe to network state changes (this could be useful for monitoring local roots)
* churn table
* DeltaQ stats
* Type of a peer: local root, ledger peer, big ledger peer, etc ...
* network configuration

# Branch
https://github.com/IntersectMBO/ouroboros-network/tree/coot/public-network-state

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.