Skip to content

Commit

Permalink
chore: update docs ahead of subgraph radio 0.1.3 release (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
neriumrevolta committed Aug 13, 2023
1 parent 411bd2f commit 2acf5f1
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 90 deletions.
14 changes: 8 additions & 6 deletions docs/graphcast/design-principles.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ There are two main components of Graphcast
The SDK is the base layer which is used to abstract all the necessary components of each Radio away from the user. That includes:

- Establishes a connection to Graphcast via a [Waku](https://waku.org/) Gossip node, providing an interface for subscribing to specific topics and broadcasting messages across the network.
- Interactions with an Ethereum node, a Graph node and a client for the Indexer management server.
- Interactions with a Graph node and a client for the Indexer management server.
- Queries to Network and Registry subgraphs.
- Checks message validity for past message injections, nonexistent blocks and expired timestamps. It also guarantees that messages are signed by an authorised operator address of an active on-chain Indexer (this can be used as a basis for a reputation system).
- Supports a flexible and customizable configuration of the Graphcast gossip agent, enabling specification of network settings, peer discovery mechanisms, message encoding formats, and more. For detailed instructions on configuring Graphcast to suit your needs, refer to the configuration guide.
Expand All @@ -34,19 +34,21 @@ General Radio components

The first Radio built on top of Graphcast is the Subgraph Radio. It's designed to facilitate real-time information exchange among participants in The Graph network and serves as a tool for Indexers and other network participants to share valuable Subgraph data.

With Subgraph Radio, Indexers can run a single Radio instance and track a wide variety of message types and data related to Subgraphs. Different use cases and message types form the different _functionalities_ of the Radio.
With Subgraph Radio, Indexers can run a single Radio instance and track a wide variety of message types and data related to Subgraphs. Different use cases and message types form the different _features_ of the Radio.

### Functionalities
### Features

#### Proof of Indexing (POI) cross-checking

Indexers must generate valid POIs to earn indexing rewards. Indexers find it beneficial to alert each other on the health status of subgraphs in community discussions. To alleviate the manual workload, the POI functionality within Subgraph Radio:
Indexers must generate valid POIs to earn indexing rewards. Indexers find it beneficial to alert each other on the health status of subgraphs in community discussions. To alleviate the manual workload, the POI cross-checking feature within Subgraph Radio:

- Defines message types and topics
- Collects public POIs from the Graph node and sends them inside of Graphcast messages along with other useful metadata
- Observes relevant messages and aggregates public POIs sent from other Indexers, in order to compare _local_ POIs to _remote_ POIs
- Monitors the network for conflicts and takes certain actions if needed, for instance Indexers can configure an alert system to send messages to a custom channel in their Slack workspace, a Discord channel, or a Telegram chat.

#### Subgraph Versioning
#### Subgraph Upgrade Pre-sync

The subgraph versioning functionality provides a way for Subgraph Developers to signal when they plan on releasing a new subgraph version, thereby allowing Indexers to start syncing the subgraph in advance. If the Radio operator has set up the notification system, they will get notified whenever a new subgraph versioning message is received.
The subgraph upgrade pre-sync feature provides a way for Subgraph Developers to signal when they plan on releasing a new subgraph version, thereby allowing Indexers to start syncing the subgraph in advance. If the Radio operator has set up the notification system, they will get notified whenever a new subgraph upgrade intent message is received.

If the `INDEXER_MANAGEMEN_SERVER_ENDPOINT` configuration variable has been set, the Radio will send a request to the Indexer Agent to start offchain syncing the new Subgraph deployment.
12 changes: 6 additions & 6 deletions docs/graphcast/radios/listener-radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,26 @@ The GraphQL API now includes:
Below are an example query:

```graphql
Query {
rows{
query {
rows {
id
message{
message {
nonce
network
payload{
payload {
content
}
}
}

messages{
messages {
identifier
nonce
network
blockNumber
blockHash
signature
payload{
payload {
identifier
content
}
Expand Down
66 changes: 64 additions & 2 deletions docs/graphcast/radios/one-shot.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ sidebar_position: 3

# One-shot CLI

The source code for the one-shot CLI is available [on GitHub](https://github.com/graphops/subgraph-radio/tree/dev/one-shot) as a member of the Subgraph Radio workspace.
The source code for the one-shot CLI is available [on GitHub](https://github.com/graphops/one-shot-cli).

## Introduction

The one-shot CLI enables sending one-off messages. Currently, its default behaviour is to construct and send a message of type `VersionUpgradeMessage`, which is used for the [Subgraph Versioning functionality](graphcast/design-principles#subgraph-versioning) of Subgraph Radio.
The one-shot CLI enables sending one-off messages. Currently, its default behaviour is to construct and send a message of type `VersionUpgradeMessage`, which is used for the [Subgraph Upgrade Pre-sync feature](https://docs.graphops.xyz/graphcast/design-principles#subgraph-upgrade-pre-sync) of Subgraph Radio.

The one-shot CLI is configured using config variables. You will need to prepare the following config variables (either as env variables or passing CLI args when running the CLI):

Expand All @@ -30,3 +30,65 @@ The one-shot CLI is configured using config variables. You will need to prepare
| `LOG_FORMAT` | Support logging formats: pretty, json, full, compact.<br/>Default: `pretty` |

The one-shot CLI code is very extensible and could be altered to send any kind of Graphcast-compatible message to the network.

## Run with Docker

1. Pull the one-shot CLI image

```bash
docker pull ghcr.io/graphops/one-shot-cli:latest
```

2. Run the image, providing the required configuration variables. Here's a sample configuration:

```bash
docker run ghcr.io/graphops/one-shot-cli \
--private-key "1b098c0f518c046dc01bc9cf785cb670e6e059d99a294319598583f546f420c8" \
--graph-account "0xedfecf44f942d53b0b8c9559560bc6cb3d6d2c1d" \
--identifier "QmXoFPYJmtSraJDTEGDXLAP52FjVQmLBJqrj6DUevk47o" \
--new-hash "Qmf7mgYnJktiYTvXGwBhbR52lXpjCZgFLA5Y9kugHtZmWU" \
--subgraph-id "J5s8MTaDrNwxHVeB2okoVnZ2eULeYc47L6LKef6BLWwX" \
--index-network "goerli" \
--migration-time 1692114708
```

## (or) Run using a pre-built binary

We also provide pre-built binaries for Ubuntu and MacOS, which you can find in the `Assets` section on each release in the [releases page](https://github.com/graphops/one-shot-cli/releases) on Github. Simply download the binary, make it executable (`chmod a+x ./one-shot-cli-{TAG}-{SYSTEM}`) and then run it (using `./one-shot-cli-{TAG}-{SYSTEM}`), like this:

```bash
./one-shot-cli-0.0.1-macos \
--private-key "1b098c0f518c046dc01bc9cf785cb670e6e059d99a294319598583f546f420c8" \
--graph-account "0xedfecf44f942d53b0b8c9559560bc6cb3d6d2c1d" \
--identifier "QmXoFPYJmtSraJDTEGDXLAP52FjVQmLBJqrj6DUevk47o" \
--new-hash "Qmf7mgYnJktiYTvXGwBhbR52lXpjCZgFLA5Y9kugHtZmWU" \
--subgraph-id "J5s8MTaDrNwxHVeB2okoVnZ2eULeYc47L6LKef6BLWwX" \
--index-network "goerli" \
--migration-time 1692114708
```

## (or) Run using a pre-built binary

1. Clone the repo

```bash
git clone https://github.com/graphops/one-shot-cli.git
```

2. Navigate to the project directory

```bash
cd one-shot-cli
```

3. Run the CLI

```bash
cargo run --release -- --private-key "1b098c0f518c046dc01bc9cf785cb670e6e059d99a294319598583f546f420c8" \
--graph-account "0xedfecf44f942d53b0b8c9559560bc6cb3d6d2c1d" \
--identifier "QmXoFPYJmtSraJDTEGDXLAP52FjVQmLBJqrj6DUevk47o" \
--new-hash "Qmf7mgYnJktiYTvXGwBhbR52lXpjCZgFLA5Y9kugHtZmWU" \
--subgraph-id "J5s8MTaDrNwxHVeB2okoVnZ2eULeYc47L6LKef6BLWwX" \
--index-network "goerli" \
--migration-time 1692114708
```
Loading

0 comments on commit 2acf5f1

Please sign in to comment.