Skip to content

Commit 21f7e67

Browse files
committed
docs: docs
1 parent a91d460 commit 21f7e67

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Architecture
2+
3+
This module uses an event-queue-based architecture. A `NetworkManager` is responsible for creating a set of `PeerConnection`s and sending commands to them. Each `PeerConnection` maintains a connection to a single peer; it responds to commands from the `NetworkManager`, and emits events to an event queue. The `NetworkManager` reads from that queue to decide which chain to follow. When blocks from the preferred chain have been fetched, it publishes those blocks to the message bus.
4+
5+
This module requests the body for every block announced by any chain, from the first chain which announced it. When it has the body for the next block announced
6+
7+
```mermaid
8+
graph LR
9+
EQ[Event Queue]-->NM[NetworkManager]
10+
subgraph Peers
11+
P1[PeerConnection 1]
12+
P2[PeerConnection 2]
13+
P3[PeerConnection 3]
14+
end
15+
NM -->|RequestBlock</br>FindIntersect| P1 & P2 & P3
16+
Peers -->|ChainSync<br/>BlockFetched<br/>Disconnect|EQ
17+
NM -->|BlockAvailable| MB[Message Bus]
18+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Peer network interface module
2+
3+
The peer network interface module uses the ChainSync and BlockFetch protocols to fetch blocks from one of several upstream sources. It chooses one peer to treat as the "preferred" chain to follow, but will gracefully switch which peer it follows during network issues.
4+
5+
It can either run independently, either from the origin or current tip, or
6+
be triggered by a Mithril snapshot event (the default) where it starts from
7+
where the snapshot left off, and follows the chain from there.
8+
9+
Rollbacks are handled by signalling in the block data - it is downstream
10+
subscribers' responsibility to deal with the effects of this.
11+
12+
## Configuration
13+
14+
See [./config.default.toml](./config.default.toml) for the available configuration options and their default values.
15+
16+
## Messages
17+
18+
This module publishes "raw block messages" to the configured `block-topic`. Each message includes the raw bytes composing the header and body of a block. The module follows the head of one chain at any given time, though that chain may switch during runtime. If that chain reports a rollback (or if this module switches to a different chain), the next message it emits will be the new head of the chain and have the status `RolledBack`.
Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1+
# The topic to publish blocks on
12
block-topic = "cardano.block.available"
3+
# The topic to wait for when sync-point is "snapshot"
24
snapshot-completion-topic = "cardano.snapshot.complete"
5+
# The topic to wait for when listening for genesis values from another module
36
genesis-completion-topic = "cardano.sequence.bootstrapped"
47

8+
# Upstream node connections
59
node-addresses = [
610
"backbone.cardano.iog.io:3001",
711
"backbone.mainnet.cardanofoundation.org:3001",
812
"backbone.mainnet.emurgornd.com:3001",
913
]
14+
# The network magic for the chain to connect to
1015
magic-number = 764824073
1116

12-
sync-point = "origin"
17+
# The initial point to start syncing from. Options:
18+
# - "origin": sync from the very start of the chain
19+
# - "tip": sync from the very end of the chain
20+
# - "cache": replay messages from a local filesystem cache, then sync from the point right after that cache.
21+
# - "snapshot": wait for another module to restore from a snapshot, then sync from the point right after that snapshot.
22+
sync-point = "snapshot"
23+
# The cache dir to use when sync-point is "cache"
1324
cache-dir = "upstream-cache"

0 commit comments

Comments
 (0)