Skip to content

Commit

Permalink
Merge branch 'main' into issues/141/refactor/proof-store-indices-2
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite authored Jan 19, 2024
2 parents e23acc6 + 98cb3e8 commit 4d3ef9d
Show file tree
Hide file tree
Showing 17 changed files with 683 additions and 583 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ go.work.sum
# TODO_TECHDEBT: It seems that .dot files come and go so we need to figure out the root cause: https://github.com/pokt-network/poktroll/pull/177/files#r1392521547
# **/*.dot

# Load-test summary report, mentioning in gitignore to avoid accidentally committing it
summary.html

# Quickstart helpers
shannon_appgate_config.yaml
shannon_app_config.yaml
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ go_develop: proto_regen go_mockgen ## Generate protos and mocks
.PHONY: go_develop_and_test
go_develop_and_test: go_develop go_test ## Generate protos, mocks and run all tests

.PHONY: load_test_simple
load_test_simple: ## Runs the simpliest load test through the whole stack (appgate -> relayminer -> anvil)
k6 run load-testing/tests/appGateServerEtherium.js

#############
### TODOS ###
#############
Expand Down
2 changes: 0 additions & 2 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79117,8 +79117,6 @@ definitions:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
poktroll.service.MsgAddServiceResponse:
type: object
poktroll.tokenomics.Params:
type: object
properties:
Expand Down
77 changes: 77 additions & 0 deletions docusaurus/docs/configs/app_staking_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: Application staking config
sidebar_position: 4
---

# Application staking config <!-- omit in toc -->

This document describes the configuration file used by the `Application` actor
to submit a `stake`` transaction required to allow it to use the Pocket Network's
RPC services.

- [Usage](#usage)
- [Configuration](#configuration)
- [`stake_amount`](#stake_amount)
- [`service_ids`](#service_ids)
- [Example](#example)

## Usage

The `stake-application` transaction submission command accepts a `--config` flag
that points to a `yaml` configuration file that defines the `stake_amount` and
`service_ids` which the `Application` is allowed to use.

:::warning

TestNet is not ready as of writing this documentation so you may
need to adjust the command below appropriately.

:::

```bash
poktrolld tx application stake-application \
--home=./poktroll \
--config ./stake_config.yaml \
--keyring-backend test \
--from application1 \
--node tcp://poktroll-node:36657
```

## Configuration

The configuration file consists of a `stake_amount` entry denominated in `upokt`
and a `service_ids` list defining the services the `Application` is willing to
consume.

### `stake_amount`

_`Required`_

```yaml
stake_amount: <number>upokt
```
Defines the amount of `upokt` to stake from the `Application` to be able to
consume the services. This amount will be transferred from the Application's
account balance and locked. It will be deducted at the end of every session
based on the Application's usage.

### `service_ids`

_`Required`_, _`Non-empty`_

```yaml
service_ids:
- <string>
```

Defines the list of services the `Application` is willing to consume on the
Pocket network. Each entry in the list is a `service_id` that identifies a service
that is available on the Pocket network.

It MUST be a string of at most 8 characters or less allowing only alphanumeric
characters, underscores, and dashes (i.e. matching the regex `^[a-zA-Z0-9_-]{1,8}$`).

## Example

A full example of the configuration file could be found at [application_staking_config.yaml](https://github.com/pokt-network/poktroll/tree/main/localnet/poktrolld/config/application1_stake_config.yaml)
112 changes: 112 additions & 0 deletions docusaurus/docs/configs/appgate_server_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: AppGateServer config
sidebar_position: 2
---

# AppGateServer config <!-- omit in toc -->

This document describes the configuration options available for the
`AppGateServer`through the `appgate_server_config.yaml` file.

It is responsible for multiple things:

1. Determines how the `AppGateServer` with respect to Pocket network connectivity
2. Whether it acts as a self serving `Application` or a `Gateway` to other `Applications`
3. Configures the host(s) it listens on for incoming `RelayRequests`

- [Usage](#usage)
- [Configuration](#configuration)
- [`query_node_rpc_url`](#query_node_rpc_url)
- [`query_node_grpc_url`](#query_node_grpc_url)
- [`self_signing`](#self_signing)
- [`signing_key`](#signing_key)
- [`listening_endpoint`](#listening_endpoint)

## Usage

The `AppGateServer` start command accepts a `--config` flag that points to a
configuration `.yaml` file that will be used to initialize the `AppGateServer`.

:::warning

TestNet is not ready as of writing this documentation so you may
need to adjust the command below appropriately.

:::

```bash
poktrolld appgate-server start \
--config ./appgate_server_config.yaml \
--keyring-backend test
```

## Configuration

The `AppGateServer` configuration file is a `.yaml` file that contains the
following fields:

```yaml
query_node_rpc_url: tcp://<hostname>:<port>
query_node_grpc_url: tcp://<hostname>:<port>
self_signing: <boolean>
signing_key: <string>
listening_endpoint: http://<hostname>:<port>
```
### `query_node_rpc_url`

_`Required`_

The RPC URL of the Pocket node that allows the `AppGateServer` to subscribe to
on-chain CometBFT events via websockets. It is re-formatted by the SDK as
`ws://<hostname>:<port>/websocket` and establishes a persistent connection to
the Pocket Node in order to stream events such as latest blocks, and other
information such as on-chain (un)delegation events.

### `query_node_grpc_url`

_`Required`_

The gRPC URL of the Pocket node that allows the `AppGateServer` to fetch data
from the Pocket network (eg. Sessions, Accounts, Applications, etc...).

### `self_signing`

:::tip

tl;dr

- `true` -> `AppGateServer` acts as an `Application`
- `false` -> `AppGateServer` acts as a `Gateway`

:::

_`Optional`_

Indicates whether the `AppGateServer` acts as a self serving `Application` or a
`Gateway` to other `Application`s.

If `true`, the `AppGateServer` will act as an `Application` and will only use
its own address to generate a ring-signer for signing `RelayRequest`s before
forwarding them to a `RelayMiner`.

If `false`, the `AppGateServer` will act as a `Gateway` and will generate a
ring-signer from both its address and the `Application`'s address provided in
the request's `senderAddr` query parameter then use it to sign the `RelayRequests`
before forwarding them to a `RelayMiner`.

### `signing_key`

_`Required`_

Name of the key used to derive the public key and the corresponding address
for cryptographic rings generation used to sign `RelayRequests`.

The key name must be present in the keyring that is specified when the
`AppGateServer` is started.

### `listening_endpoint`

_`Required`_

The endpoint that the `AppGateServer` will listen on for incoming requests.
56 changes: 56 additions & 0 deletions docusaurus/docs/configs/gateway_staking_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: Gateway staking config
sidebar_position: 5
---

# Gateway staking config <!-- omit in toc -->

This document describes the configuration file used by the `Gateway` actor
to submit a stake transaction required to allow it to serve Pocket Network
RPC services.

- [Usage](#usage)
- [Configuration](#configuration)
- [`stake_amount`](#stake_amount)
- [Example](#example)

## Usage

The `stake-gateway` transaction submission command accepts a `--config` flag
that points to a `yaml` configuration file that defines the `stake_amount` the
`Gateway` is willing to lock.

:::warning

TestNet is not ready as of writing this documentation so you may
need to adjust the command below appropriately.

:::

```bash
poktrolld tx gateway stake-gateway \
--home=./poktroll \
--config ./stake_config.yaml \
--keyring-backend test \
--from gateway1 \
--node tcp://poktroll-node:36657
```

## Configuration

The configuration file consists of the `stake_amount` entry denominated in `upokt`.

### `stake_amount`

_`Required`_

```yaml
stake_amount: <number>upokt
```
Defines the amount of `upokt` to stake by the `Gateway` to be able to serve
`RelayRequest` on the Pocket network on behalf of `Application`s.

## Example

A full example of the configuration file could be found at [gateway_staking_config.yaml](https://github.com/pokt-network/poktroll/tree/main/localnet/poktrolld/config/gateway1_stake_config.yaml)
119 changes: 119 additions & 0 deletions docusaurus/docs/configs/supplier_staking_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
title: Supplier staking config
sidebar_position: 3
---

# Supplier staking config <!-- omit in toc -->

_This document describes the configuration file used by the `Supplier` to submit
a stake transaction required to provide RPC services on the Pocket Network._

- [Usage](#usage)
- [Configuration](#configuration)
- [`stake_amount`](#stake_amount)
- [`services`](#services)
- [`service_id`](#service_id)
- [`endpoints`](#endpoints)
- [`url`](#url)
- [`rpc_type`](#rpc_type)
- [Example](#example)

## Usage

The `stake-supplier` transaction submission command accepts a `--config` flag
that points to a `yaml` configuration file that defines their staking
configuration. This includes, but is not limited to things like `stake_amount`, the `service`s, their respective advertised `endpoints`, etc.

The following is an example command of how to stake a supplier
in a LocalNet environment.

:::warning

TestNet is not ready as of writing this documentation so you may
need to adjust the command below appropriately.

:::

```bash
poktrolld tx supplier stake-supplier \
--home=./poktroll \
--config ./stake_config.yaml \
--keyring-backend test \
--from supplier1 \
--node tcp://poktroll-node:36657
```

## Configuration

### `stake_amount`

_`Required`_, _`Non-empty`_

```yaml
stake_amount: <number>upokt
```
Defines the amount of `upokt` to stake for the `Supplier` account.
This amount covers all the `service`s defined in the `services` section.

:::note

If the `Supplier` account already has a stake and wishes to change or add
to the `service`s that it provides, then it MUST to increase the current
`stake_amount` by at least `1upokt`.

For example, if the current stake is `1000upokt` and the `Supplier` wants to add a new `service` then `stake_amount: 1001upokt` should be specified in the configuration file. This will increase the stake by `1upokt` and deduct `1upokt` from the `Supplier`'s account balance.

:::

### `services`

_`Required`_, _`Non-empty`_

```yaml
services:
- service_id: <string>
endpoints:
- url: <protocol>://<hostname>:<port>
rpc_type: <string>
```

`services` define the list of services that the `Supplier` wants to provide.
It takes the form of a list of `service` objects. Each `service` object
consists of a `service_id` and a list of `endpoints` that the `Supplier` will
advertise on the Pocket Network.

#### `service_id`

_`Required`_

`service_id` is a string that uniquely identifies the service that the `Supplier`
is providing. It MUST 8 characters or less and composed of alphanumeric characters,
underscores, and dashes only.

For example, it must match the regex `^[a-zA-Z0-9_-]{1,8}$`, and spaces are disallowed.

#### `endpoints`

_`Required`_, _`Non-empty`_

`endpoints` is a list of `endpoint` objects that the `Supplier` will advertise
to the Pocket Network. Each `endpoint` object consists of an `url` and a `rpc_type`.

##### `url`

_`Required`_

`url` is a string formatted URL that defines the endpoint that MUST be reachable by
`Gateways` and `Applications` to send `RelayRequests` to.

##### `rpc_type`

_`Required`_

`rpc_type` is a string that defines the type of RPC service that the `Supplier`
is providing. The `rpc_type` MUST be one of the [supported types found here](https://github.com/pokt-network/poktroll/tree/main/pkg/relayer/config/types.go#L8)

## Example

A full example of the configuration file could be found at [supplier_staking_config.yaml](https://github.com/pokt-network/poktroll/tree/main/localnet/poktrolld/config/supplier1_stake_config.yaml)
Loading

0 comments on commit 4d3ef9d

Please sign in to comment.