Skip to content

Commit 83d7cff

Browse files
authored
docs: enhance Hyperspace docs (#181)
* docs: enhance Hyperspace docs * link instructions in main README * link to template config
1 parent d21cc43 commit 83d7cff

File tree

3 files changed

+36
-17
lines changed

3 files changed

+36
-17
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ This contains utility functions for assembling Grandpa proofs as well as paracha
2424

2525
A `no_std` compatible crate which contains primitive types which are shared by both crates.
2626

27-
### [Hyperspace Relayer](hyperspace/core/src/lib.rs)
28-
27+
### [Hyperspace Relayer](hyperspace/README.md)
28+
Looking for instructions on how to run the relayer? [Check here](hyperspace/README.md#running-the-relayer)
2929

3030
Rust implementation of the IBC relayer algorithm.
3131

hyperspace/core/README.md hyperspace/README.md

+33-15
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,29 @@
44
The relayer is designed to be:
55

66
### 1. Stateless
7-
This means that the relayer does not perform **any form** of data caching. The relayer therefore relies heavily on
7+
This means that the relayer does not perform **any form** of data caching. The relayer, therefore, relies heavily on
88
the nodes it's connected to for sourcing data as needed. This design choice eliminates a class of bugs that could come from cache invalidation.
99

1010
### 2. Event Driven
11-
The relayer follows an event driven model, where it waits idly until it receives a finality notification from any of the chains it's connected to. The finality notification represents new IBC messages and events that have finalized and ready to be sent to the connected counterparty chain.
11+
The relayer follows an event-driven model, where it waits idly until it receives a finality notification from any of the chains it's connected to. The finality notification represents new IBC messages and events that have been finalized and are ready to be sent to the connected counterparty chain.
1212

1313
## Relayer Loop
1414

1515
The relayer has a single entry point, which is the [`relay`](/hyperspace/core/src/lib.rs#L20) function, this function takes two [`Chain`](/hyperspace/primitives/src/lib.rs#L346) implementations
1616
alongside optional metric handlers and starts the relayer loop.
1717

1818
The relayer loops awaits finality events from the finality subscription of the chain handlers.
19-
Whenever a finality event is received, the latest ibc events are queried using `query_latest_ibc_events`.
19+
Whenever a finality event is received, the latest IBC events are queried using `query_latest_ibc_events`.
2020
These events are then parsed into the appropriate outgoing IBC messages, and sent off to the counterparty chain.
21-
22-
The `query_ready_and_timed_out_packets` which queries a chain and
21+
The `query_ready_and_timed_out_packets` queries a chain and
2322
produces all packet messages that have passed the connection delay check.
24-
It also returns timed out packet messages that have passed the connection delay check.
23+
It also returns timed-out packet messages that have passed the connection delay check.
2524

2625
### Connection delay and Packet Timeout
2726

2827
The relayer needs to submit packets with a proof fetched at a height where the equivalent client consensus state on the
29-
counterparty chain has satisfied the connection delay.
30-
Since the relayer has no cache of the block heights at which packets events were emitted, it has to go through a more
31-
rigorous process to identify when the connection delay has been satisfied for some arbitrary consensus height.
28+
counterparty chain has satisfied the connection delay.
29+
Since the relayer has no cache of the block heights at which packet events were emitted, it has to go through a more rigorous process to identify when the connection delay has been satisfied for some arbitrary consensus height.
3230
The following pseudocode describes how connection delays and packet timeouts are handled:
3331

3432
```rust
@@ -144,15 +142,32 @@ if the estimate exceeds the latter then the ibc messages are split into smaller
144142
these chunks are then submitted as individual transactions.
145143

146144

147-
## CLI Interface
145+
## Running the relayer
146+
147+
### How to build Hyperspace
148148

149-
The CLI interface can be used to start the relayer from a config file and also performing the IBC setup on both chains.
149+
```
150+
make build-release-hyperspace
151+
```
152+
153+
The binary will leave in the root directory of `centauri` repository,
154+
on:
155+
```
156+
./target/release/hyperspace
157+
```
158+
159+
### Running Hyperspace - CLI Interface
160+
161+
The CLI interface can be used to start the relayer from a config file and also perform the IBC setup on both chains. It assumes that `hyperspace` was already built.
162+
163+
A template configuration file (which is needed to run the CLI) can be found
164+
[here](./config.toml)
150165

151166
- [`relay`](/hyperspace/core/src/command.rs#L24)
152-
This command accepts a path to a config file and spawns the relayer alongside a prometheus server for monitoring.
167+
This command accepts a path to a config file and spawns the relayer alongside a Prometheus server for monitoring.
153168
The config file must have all the parameters necessary for the chain clients to work correctly.
154169
- [`create-clients`](/hyperspace/core/src/command.rs#L26)
155-
This command takes a path to a config file and attempts to create a light clients of each chain on its counterparty.
170+
This command takes a path to a config file and attempts to create a light client of each chain on its counterparty.
156171
- [`create-connection`](/hyperspace/core/src/command.rs#L28)
157172
This command takes a path to a config file and delay period in seconds and attempts to complete the connection
158173
handshake between both chains.
@@ -165,8 +180,11 @@ The CLI interface can be used to start the relayer from a config file and also p
165180

166181
### Metrics
167182

168-
The relayer can be spawn with metrics enabled. The [`metrics`](/hyperspace/metrics/README.md) crate provides a prometheus server that collects data
183+
The relayer can be spawned with metrics enabled. The [`metrics`](/hyperspace/metrics/README.md) crate provides a Prometheus server that collects data
169184
about the relayer's operation.
170185

171-
Metrics collected are centered around packets and light client state on either chain and also the cost of transactions submitted on both chains.
186+
Metrics collected are centered around packets and light client states on either chain and also the cost of transactions submitted on both chains.
187+
188+
### Troubleshooting
172189

190+
Update this section with feedback!

hyperspace/config.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Parachain to Parachain configuration template
12
[chain_a]
23
type = "parachain"
34
name = "picasso"

0 commit comments

Comments
 (0)