Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation] Load Testing on DevNets and TestNets #637

Merged
merged 12 commits into from
Jul 16, 2024
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@ gentx-*.json

# Binaries VSCode builds for debugging
cmd/poktrolld/*debug_bin*

# The temporary file created by e2e scripts
job.yaml
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ TESTNET_RPC ?= https://testnet-validated-validator-rpc.poktroll.com/ # TestNet R
APPGATE_SERVER ?= http://localhost:42069
GATEWAY_URL ?= http://localhost:42079
POCKET_ADDR_PREFIX = pokt
LOAD_TEST_CUSTOM_MANIFEST ?= loadtest_manifest_example.yaml

# The domain ending in ".town" is staging, ".city" is production
GROVE_GATEWAY_STAGING_ETH_MAINNET = https://eth-mainnet.rpc.grove.town
Expand Down Expand Up @@ -403,11 +404,11 @@ test_e2e_settlement: test_e2e_env ## Run only the E2E suite that exercises the s
test_e2e_params: test_e2e_env ## Run only the E2E suite that exercises parameter updates for all modules
go test -v ./e2e/tests/... -tags=e2e,test --features-path=update_params.feature

.PHONY: test_load_relays_stress_example
test_load_relays_stress_example: ## Run the stress test for E2E relays on a persistent (non-ephemeral) remote (devnet) chain. Note that this is just an example.
.PHONY: test_load_relays_stress_custom
test_load_relays_stress_custom: ## Run the stress test for E2E relays using custom manifest. "loadtest_manifest_example.yaml" manifest is used by default. Set `LOAD_TEST_CUSTOM_MANIFEST` environment variable to use the different manifest.
go test -v -count=1 ./load-testing/tests/... \
-tags=load,test -run LoadRelays --log-level=debug --timeout=30m \
--manifest ./load-testing/loadtest_manifest_example.yaml
--manifest ./load-testing/$(LOAD_TEST_CUSTOM_MANIFEST)

.PHONY: test_load_relays_stress_localnet
test_load_relays_stress_localnet: test_e2e_env warn_message_local_stress_test ## Run the stress test for E2E relays on LocalNet.
Expand Down
137 changes: 135 additions & 2 deletions docusaurus/docs/operate/infrastructure/devnet.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
sidebar_position: 3
title: DevNet
title: DevNets
---

# DevNet <!-- omit in toc -->
# DevNets <!-- omit in toc -->

:::note

Expand All @@ -20,6 +20,15 @@ to set up your access to GCP.
- [Grafana logs](#grafana-logs)
- [Infrastructure Provisioning](#infrastructure-provisioning)
- [Configuration](#configuration)
- [Interaction with DevNet](#interaction-with-devnet)
- [DevNet types](#devnet-types)
- [Manually provisioned DevNets](#manually-provisioned-devnets)
- [How to create](#how-to-create)
- [How to delete](#how-to-delete)
- [Configuring and updating DevNets](#configuring-and-updating-devnets)
- [Scaling actors up and down](#scaling-actors-up-and-down)
- [Run e2e tests on a manually provisioned DevNet](#run-e2e-tests-on-a-manually-provisioned-devnet)
- [Staking actors](#staking-actors)
Comment on lines +23 to +31
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix link fragments in Table of Contents.

Ensure the link fragments match the corresponding section headers.

- [Interaction with DevNet](#interaction-with-devnet)
- [DevNet types](#devnet-types)
- [Manually provisioned DevNets](#manually-provisioned-devnets)
  - [How to create](#how-to-create)
  - [How to delete](#how-to-delete)
  - [Configure and update the version of the software](#configure-and-update-the-version-of-the-software)
  - [Scale actors up and down](#scale-actors-up-and-down)
  - [Run e2e tests on a manually provisioned DevNet](#run-e2e-tests-on-a-manually-provisioned-devnet)
  - [Stake actors](#stake-actors)
+ [Interaction with DevNet](#interaction-with-devnet)
+ [DevNet types](#devnet-types)
+ [Manually provisioned DevNets](#manually-provisioned-devnets)
+   - [How to create](#how-to-create)
+   - [How to delete](#how-to-delete)
+   - [Configuring and updating DevNets](#configuring-and-updating-devnets)
+   - [Scaling actors up and down](#scaling-actors-up-and-down)
+   - [Run e2e tests on a manually provisioned DevNet](#run-e2e-tests-on-a-manually-provisioned-devnet)
+   - [Staking actors](#staking-actors)

Committable suggestion was skipped due to low confidence.

Tools
LanguageTool

[duplication] ~23-~23: Possible typo: you repeated a word
Context: ...on](#configuration) - Interaction with DevNet - DevNet types - [Manually provi...

(ENGLISH_WORD_REPEAT_RULE)


## GCP Console

Expand Down Expand Up @@ -54,3 +63,127 @@ Each DevNet ArgoCD App (following the App of Apps pattern) provisions a Helm cha
Each `full-network` includes other ArgoCD applications that deploy Validators and off-chain actors.

Each Helm chart receives a list of configuration files. For example, see the [relayminer configuration](https://github.com/pokt-network/protocol-infra/blob/main/charts/full-network/templates/Application-Relayminer.yaml#L37). All possible values can be found in the `values.yaml` of the Helm chart, such as the [relayminer Helm chart](https://github.com/pokt-network/helm-charts/blob/main/charts/relayminer/values.yaml).

## Interaction with DevNet

:::note
Devnets are provisioned with the same mnemonc phrases as LocalNet, so it is possible to reuse the same keys
from the keybase - the user just needs to change the `--node=` flag to point to the DevNet RPC endpoint when using the `poktrolld` CLI.
:::

The DevNet RPC endpoint is exposed on `https://devnet-**NETWORK_NAME**-validator-rpc.poktroll.com`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a list or an example of NETWORK_NAMEs that we can reference?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would an example a few lines below count? 😅

Comment on lines +67 to +74
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide an example for the devnet name in environment variables.

Add an example to clarify how the devnet name should be specified in the environment variables.

- The DevNet RPC endpoint is exposed on `https://devnet-**NETWORK_NAME**-validator-rpc.poktroll.com`.
+ The DevNet RPC endpoint is exposed on `https://devnet-**NETWORK_NAME**-validator-rpc.poktroll.com` (e.g., `NETWORK_NAME=sophon`).
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Interaction with DevNet
:::note
Devnets are provisioned with the same mnemonc phrases as LocalNet, so it is possible to reuse the same keys
from the keybase - the user just needs to change the `--node=` flag to point to the DevNet RPC endpoint when using the `poktrolld` CLI.
:::
The DevNet RPC endpoint is exposed on `https://devnet-**NETWORK_NAME**-validator-rpc.poktroll.com`.
The DevNet RPC endpoint is exposed on `https://devnet-**NETWORK_NAME**-validator-rpc.poktroll.com` (e.g., `NETWORK_NAME=sophon`).


It is possible to reuse the LocalNet make targets with DevNet endpoints. For example

```bash
POCKET_NODE=https://devnet-issue-420-validator-rpc.poktroll.com make supplier_list
```

## DevNet types

We have two types of DevNets:
1. Automatically provisioned by `devnet-test-e2e` GitHub label.
- Their main purpose is to automatically run e2e tests for each PR this label has been assigned to.
- They are not easily modified and configured. E.g. we automatically provision single instance of each actor only.
2. Manually provisioned by creating a file in [protocol-infra repo under `devnet-configs` directory](https://github.com/pokt-network/protocol-infra/tree/main/devnets-configs).
- Their main purpose is for testing new features or configurations that require more complex setups than the first type can provide.
- They are easily modified and configured, allowing you to add multiple instances of each actor.
Comment on lines +84 to +90
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix unordered list indentation.

The unordered list items should be properly indented.

-  - Their main purpose is to automatically run e2e tests for each PR this label has been assigned to.
-  - They are not easily modified and configured. E.g. we automatically provision single instance of each actor only.
-  - Their main purpose is for testing new features or configurations that require more complex setups than the first type can provide.
-  - They are easily modified and configured, allowing you to add multiple instances of each actor.
+  - Their main purpose is to automatically run e2e tests for each PR this label has been assigned to.
+  - They are not easily modified and configured. E.g. we automatically provision single instance of each actor only.
+  - Their main purpose is for testing new features or configurations that require more complex setups than the first type can provide.
+  - They are easily modified and configured, allowing you to add multiple instances of each actor.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
We have two types of DevNets:
1. Automatically provisioned by `devnet-test-e2e` GitHub label.
- Their main purpose is to automatically run e2e tests for each PR this label has been assigned to.
- They are not easily modified and configured. E.g. we automatically provision single instance of each actor only.
2. Manually provisioned by creating a file in [protocol-infra repo under `devnet-configs` directory](https://github.com/pokt-network/protocol-infra/tree/main/devnets-configs).
- Their main purpose is for testing new features or configurations that require more complex setups than the first type can provide.
- They are easily modified and configured, allowing you to add multiple instances of each actor.
We have two types of DevNets:
1. Automatically provisioned by `devnet-test-e2e` GitHub label.
- Their main purpose is to automatically run e2e tests for each PR this label has been assigned to.
- They are not easily modified and configured. E.g. we automatically provision single instance of each actor only.
2. Manually provisioned by creating a file in [protocol-infra repo under `devnet-configs` directory](https://github.com/pokt-network/protocol-infra/tree/main/devnets-configs).
- Their main purpose is for testing new features or configurations that require more complex setups than the first type can provide.
- They are easily modified and configured, allowing you to add multiple instances of each actor.
Tools
LanguageTool

[uncategorized] ~87-~87: Possible missing article found.
Context: ...igured. E.g. we automatically provision single instance of each actor only. 2. Manuall...

(AI_HYDRA_LEO_MISSING_A)

Markdownlint

86-86: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


87-87: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


89-89: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


90-90: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


## Manually provisioned DevNets

### How to create

Commit a new YAML file in the [devnets-configs](https://github.com/pokt-network/protocol-infra/tree/main/devnets-configs)
directory on the `main` branch. Use [this template](https://github.com/pokt-network/protocol-infra/blob/main/devnets-configs/_TEMPLATE_YAML_)
as a reference. If you are not a member of the protocol team, open a pull request (PR) to add the new YAML file to the
`main` branch. Protocol team members can bypass the `main` branch protection to commit directly without going through
the PR flow.

### How to delete

Remove the devnet config file by committing the deletion to the `main` branch. If you are not a member of the protocol
team, open a pull request (PR) to delete the YAML file from the `main` branch. Protocol team members can bypass the
`main` branch protection to commit the deletion directly without going through the PR flow.
Comment on lines +94 to +106
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify instructions for creating and deleting DevNet config files.

The instructions should mention that the new file needs to be merged to the main branch for the changes to take effect.

- Commit a new YAML file in the [devnets-configs](https://github.com/pokt-network/protocol-infra/tree/main/devnets-configs)
- directory on the `main` branch. Use [this template](https://github.com/pokt-network/protocol-infra/blob/main/devnets-configs/_TEMPLATE_YAML_)
- as a reference. If you are not a member of the protocol team, open a pull request (PR) to add the new YAML file to the
- `main` branch. Protocol team members can bypass the `main` branch protection to commit directly without going through
- the PR flow.
+ Create a new YAML file in [devnets-configs](https://github.com/pokt-network/protocol-infra/tree/main/devnets-configs) and merge it to the main branch. Use [this template](https://github.com/pokt-network/protocol-infra/blob/main/devnets-configs/_TEMPLATE_YAML_) as a reference. If you are not a member of the protocol team, open a pull request (PR) to add the new YAML file to the main branch. Protocol team members can bypass the main branch protection to commit directly without going through the PR flow.
- Remove the devnet config file by committing the deletion to the `main` branch. If you are not a member of the protocol
- team, open a pull request (PR) to delete the YAML file from the `main` branch. Protocol team members can bypass the
- `main` branch protection to commit the deletion directly without going through the PR flow.
+ Remove the devnet config file and merge the changes to the main branch. If you are not a member of the protocol team, open a pull request (PR) to delete the YAML file from the main branch. Protocol team members can bypass the main branch protection to commit the deletion directly without going through the PR flow.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
### How to create
Commit a new YAML file in the [devnets-configs](https://github.com/pokt-network/protocol-infra/tree/main/devnets-configs)
directory on the `main` branch. Use [this template](https://github.com/pokt-network/protocol-infra/blob/main/devnets-configs/_TEMPLATE_YAML_)
as a reference. If you are not a member of the protocol team, open a pull request (PR) to add the new YAML file to the
`main` branch. Protocol team members can bypass the `main` branch protection to commit directly without going through
the PR flow.
### How to delete
Remove the devnet config file by committing the deletion to the `main` branch. If you are not a member of the protocol
team, open a pull request (PR) to delete the YAML file from the `main` branch. Protocol team members can bypass the
`main` branch protection to commit the deletion directly without going through the PR flow.
### How to create
Create a new YAML file in [devnets-configs](https://github.com/pokt-network/protocol-infra/tree/main/devnets-configs) and merge it to the main branch. Use [this template](https://github.com/pokt-network/protocol-infra/blob/main/devnets-configs/_TEMPLATE_YAML_) as a reference. If you are not a member of the protocol team, open a pull request (PR) to add the new YAML file to the main branch. Protocol team members can bypass the main branch protection to commit directly without going through the PR flow.
### How to delete
Remove the devnet config file and merge the changes to the main branch. If you are not a member of the protocol team, open a pull request (PR) to delete the YAML file from the main branch. Protocol team members can bypass the main branch protection to commit the deletion directly without going through the PR flow.


### Configuring and updating DevNets

New container images are automatically built on each merge to the `main` branch and each push to non-main branches for which there exists a PR with the `push-image` label.
Images named according to the following format:

```
ghcr.io/pokt-network/poktrolld:sha-7042be3
ghcr.io/pokt-network/poktrolld:sha-7042be3922245fb4313ee90e1f28d0f402b700a0
```
Comment on lines +110 to +116
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify language for fenced code blocks.

Fenced code blocks should have a language specified for syntax highlighting.

- ```
+ ```yaml
Tools
Markdownlint

108-108: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Comment on lines +113 to +116
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specify language for fenced code blocks.

Fenced code blocks should have a language specified for syntax highlighting.

- ```
+ ```yaml
Tools
Markdownlint

113-113: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


You can update the version of DevNet by changing this parameter in the devnet config file:

```yaml
image:
tag: sha-7042be3
```

All parameters in this config are passed to the [downstream helm chart](https://github.com/pokt-network/protocol-infra/tree/main/charts/full-network) via an [ArgoCD Application](https://github.com/pokt-network/protocol-infra/blob/main/clusters/protocol-us-central1/devnets-persistent.yaml).
Here is a [list of all options](https://github.com/pokt-network/protocol-infra/blob/main/charts/full-network/values.yaml) which can be modified, in addition to the image tag.

### Scaling actors up and down

You can modify the number of each actor by changing the devnet config file:

:::info
We use the same ignite `config.yaml` to provision genesis in devnet as is used in localnet. Because localnet supports a max of 3 of each actor type, any devnet deployment with more actors would also require additional corresponding genesis state to be included in `config.yaml`, or on-demand account funding and staking. General rule of thumb: don't go over `3`.
:::
Comment on lines +130 to +134
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the rule of thumb for actor count.

Rephrase the note to make it clear that the rule of thumb is to not go over 3 actors.

- General rule of thumb: don't go over `3`.
+ General rule of thumb: do not go over three actors.
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
You can modify the number of each actor by changing the devnet config file:
:::info
We use the same ignite `config.yaml` to provision genesis in devnet as is used in localnet. Because localnet supports a max of 3 of each actor type, any devnet deployment with more actors would also require additional corresponding genesis state to be included in `config.yaml`, or on-demand account funding and staking. General rule of thumb: don't go over `3`.
:::
You can modify the number of each actor by changing the devnet config file:
:::info
We use the same ignite `config.yaml` to provision genesis in devnet as is used in localnet. Because localnet supports a max of 3 of each actor type, any devnet deployment with more actors would also require additional corresponding genesis state to be included in `config.yaml`, or on-demand account funding and staking. General rule of thumb: do not go over three actors.
:::



```yaml
appgateservers:
count: 1
gateways:
count: 1
relayminers:
count: 1
```

### Run e2e tests on a manually provisioned DevNet

To run e2e tests on a manually provisioned DevNet, use the following command from the root of the poktroll repo:

```bash
IMAGE_TAG=**IMAGE TAG NAME FROM DEVNET CONFIG** NAMESPACE=devnet-**NETWORK NAME** JOB_NAME=e2e-test-**GITSHA FROM IMAGE TAG** POCKET_NODE=tcp://devnet-**NETWORK NAME**-validator-poktrolld:26657 bash .github/workflows-helpers/run-e2e-test.sh
```

**Environment Variables**:

- **IMAGE_TAG**: The tag of the image from the devnet config YAML file. This tag must match the tag of the image used in the DevNet configuration.
- **NAMESPACE**: The name of the devnet. This should be specified in the environment variables and follow the format devnet-**NETWORK NAME**.
- **JOB_NAME**: A unique identifier for the e2e test job. It follows the format e2e-test-**GITSHA FROM IMAGE TAG**.
- **POCKET_NODE**: The address of the pocket node, following the format tcp://devnet-**NETWORK NAME**-validator-poktrolld:26657.


**Example**

```bash
IMAGE_TAG=sha-7042be3 NAMESPACE=devnet-sophon JOB_NAME=e2e-test-7042be3 POCKET_NODE=tcp://devnet-sophon-validator-poktrolld:26657 bash .github/workflows-helpers/run-e2e-test.sh
```

:::info
- The `IMAGE_TAG` must match the tag of the image from the devnet config YAML file.
- The name of the devnet in the environment variables must be specified.
- The Kubernetes context must be pointed to the protocol cluster. This command can be used to change context:
Comment on lines +168 to +171
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provide an example for the devnet name in environment variables.

Add an example to clarify how the devnet name should be specified in the environment variables.

- The name of the devnet in the environment variables must be specified.
+ The name of the devnet in the environment variables must be specified (e.g., `NETWORK_NAME=sophon`).
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:::info
- The `IMAGE_TAG` must match the tag of the image from the devnet config YAML file.
- The name of the devnet in the environment variables must be specified.
- The Kubernetes context must be pointed to the protocol cluster. This command can be used to change context:
:::info
- The `IMAGE_TAG` must match the tag of the image from the devnet config YAML file.
- The name of the devnet in the environment variables must be specified (e.g., `NETWORK_NAME=sophon`).
- The Kubernetes context must be pointed to the protocol cluster. This command can be used to change context:

```bash
kubectl config set-context gke_protocol-us-central1-d505_us-central1_protocol-us-central1
```
:::

### Staking actors

Since the genesis actor keys are the same as LocalNet, we can use the same commands (and keyring) to stake actors on
DevNet. Additionally, DevNets match the hostnames with LocalNet, making it possible for the same stake configs to work on different networks.
For example, this command stakes supplier2 on DevNet `devnet-sophon`:

```bash
POCKET_NODE=https://devnet-sophon-validator-rpc.poktroll.com make supplier2_stake
```

:::note
Only manually provisioned DevNets have more than one actor to stake.
:::
Loading
Loading