Skip to content

Commit

Permalink
Merge remote-tracking branch 'pokt/main' into test/gherkin-load
Browse files Browse the repository at this point in the history
* pokt/main:
  [Code Health] chore: cleanup localnet testutils (#515)
  Zero retryLimit Support in ReplayClient (#442)
  [LocalNet] Add infrastructure to run LLM inference (#508)
  [LocalNet] Documentation for MVT/LocalNet (#488)
  [GATEWAY] Makefile target added to send relays to grove gateway (#487)
  Update README
  [CI] Add GATEWAY_URL envar for e2e tests (#506)
  [Tooling] Add gateway stake/unstake/ logs (#503)
  • Loading branch information
bryanchriswhite committed May 8, 2024
2 parents 87ba008 + f488165 commit 90d6c8d
Show file tree
Hide file tree
Showing 35 changed files with 764 additions and 162 deletions.
72 changes: 37 additions & 35 deletions .github/workflows-helpers/run-e2e-test-job-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,44 @@ spec:
pokt.network/purpose: e2e-tests
spec:
containers:
- name: e2e-tests
image: ghcr.io/pokt-network/poktrolld:${IMAGE_TAG}
command: ["/bin/sh"]
args:
- "-c"
- |
poktrolld q gateway list-gateway --node=$POCKET_NODE && \
poktrolld q application list-application --node=$POCKET_NODE && \
poktrolld q supplier list-supplier --node=$POCKET_NODE && \
make acc_initialize_pubkeys && \
go test -v ./e2e/tests/... -tags=e2e
env:
- name: POCKET_NODE
value: tcp://${NAMESPACE}-validator-poktrolld:36657
- name: VALIDATOR_RPC_ENDPOINT
value: ${NAMESPACE}-validator-poktrolld:36657
- name: E2E_DEBUG_OUTPUT
value: "false" # Flip to true to see the command and result of the execution
- name: POKTROLLD_HOME
value: /root/.poktroll
- name: APPGATE_SERVER_URL
value: http://${NAMESPACE}-appgate-server:80
volumeMounts:
- mountPath: /root/.poktroll/keyring-test/
name: keys-volume
- mountPath: /root/.poktroll/config/
name: configs-volume
restartPolicy: Never
volumes:
- secret:
defaultMode: 420
secretName: keys-${IMAGE_TAG}
- name: e2e-tests
image: ghcr.io/pokt-network/poktrolld:${IMAGE_TAG}
command: ["/bin/sh"]
args:
- "-c"
- |
poktrolld q gateway list-gateway --node=$POCKET_NODE && \
poktrolld q application list-application --node=$POCKET_NODE && \
poktrolld q supplier list-supplier --node=$POCKET_NODE && \
make acc_initialize_pubkeys && \
go test -v ./e2e/tests/... -tags=e2e
env:
- name: POCKET_NODE
value: tcp://${NAMESPACE}-validator-poktrolld:36657
- name: VALIDATOR_RPC_ENDPOINT
value: ${NAMESPACE}-validator-poktrolld:36657
- name: E2E_DEBUG_OUTPUT
value: "false" # Flip to true to see the command and result of the execution
- name: POKTROLLD_HOME
value: /root/.poktroll
- name: APPGATE_SERVER_URL
value: http://${NAMESPACE}-appgate-server:80
- name: GATEWAY_URL
value: http://${NAMESPACE}-gateway:80
volumeMounts:
- mountPath: /root/.poktroll/keyring-test/
name: keys-volume
- configMap:
defaultMode: 420
name: configs-${IMAGE_TAG}
- mountPath: /root/.poktroll/config/
name: configs-volume
restartPolicy: Never
volumes:
- secret:
defaultMode: 420
secretName: keys-${IMAGE_TAG}
name: keys-volume
- configMap:
defaultMode: 420
name: configs-${IMAGE_TAG}
name: configs-volume
serviceAccountName: default
backoffLimit: 0
57 changes: 53 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
SHELL = /bin/sh
POKTROLLD_HOME ?= ./localnet/poktrolld
POCKET_NODE ?= tcp://127.0.0.1:36657 # The pocket node (validator in the localnet context)
TESTNET_RPC ?= https://testnet-validated-validator-rpc.poktroll.com/ # TestNet RPC endpoint for validator maintained by Grove. Needs to be update if there's another "primary" testnet.
APPGATE_SERVER ?= http://localhost:42069
GATEWAY_URL ?= http://localhost:42079
POCKET_ADDR_PREFIX = pokt
CHAIN_ID = poktroll

# The domain ending in ".town" is staging, ".city" is production
GROVE_GATEWAY_STAGING_ETH_MAINNET = https://eth-mainnet.rpc.grove.town
# The "protocol" field here instructs the Grove gateway which network to use
JSON_RPC_DATA_ETH_BLOCK_HEIGHT = '{"protocol": "shannon-testnet","jsonrpc":"2.0","id":"0","method":"eth_blockNumber", "params": []}'

# On-chain module account addresses. Search for `func TestModuleAddress` in the
# codebase to get an understanding of how we got these values.
APPLICATION_MODULE_ADDRESS = pokt1rl3gjgzexmplmds3tq3r3yk84zlwdl6djzgsvm
Expand Down Expand Up @@ -439,7 +446,7 @@ todo_count: ## Print a count of all the TODOs in the project

.PHONY: todo_this_commit
todo_this_commit: ## List all the TODOs needed to be done in this commit
grep --exclude-dir={.git,vendor,.vscode} --exclude=Makefile -r -e "TODO_IN_THIS_"
grep -n --exclude-dir={.git,vendor,.vscode,.idea} --exclude={Makefile,reviewdog.yml} -r -e "TODO_IN_THIS_"

####################
### Gateways ###
Expand Down Expand Up @@ -467,7 +474,7 @@ gateway3_stake: ## Stake gateway3

.PHONY: gateway_unstake
gateway_unstake: ## Unstake an gateway (must specify the GATEWAY env var)
poktrolld --home=$(POKTROLLD_HOME) tx gateway unstake-gateway --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --chain-id $(CHAIN_ID)
poktrolld --home=$(POKTROLLD_HOME) tx gateway unstake-gateway -y --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE) --chain-id $(CHAIN_ID)

.PHONY: gateway1_unstake
gateway1_unstake: ## Unstake gateway1
Expand Down Expand Up @@ -507,7 +514,7 @@ app3_stake: ## Stake app3

.PHONY: app_unstake
app_unstake: ## Unstake an application (must specify the APP env var)
poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE) --chain-id $(CHAIN_ID)
poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application -y --keyring-backend test --from $(APP) --node $(POCKET_NODE) --chain-id $(CHAIN_ID)

.PHONY: app1_unstake
app1_unstake: ## Unstake app1
Expand Down Expand Up @@ -622,6 +629,38 @@ get_session_app3_anvil: ## Retrieve the session for (app3, anvil, latest_height)
APP3=$$(make poktrolld_addr ACC_NAME=app3) && \
APP=$$APP3 SVC=anvil HEIGHT=0 make get_session

###############
### TestNet ###
###############

.PHONY: testnet_supplier_list
testnet_supplier_list: ## List all the staked supplier on TestNet
poktrolld q supplier list-supplier --node=$(TESTNET_RPC)

.PHONY: testnet_gateway_list
testnet_gateway_list: ## List all the staked gateways on TestNet
poktrolld q gateway list-gateway --node=$(TESTNET_RPC)

.PHONY: testnet_app_list
testnet_app_list: ## List all the staked applications on TestNet
poktrolld q application list-application --node=$(TESTNET_RPC)

.PHONY: testnet_consensus_params
testnet_consensus_params: ## Output consensus parameters
poktrolld q consensus params --node=$(TESTNET_RPC)

.PHONY: testnet_gov_params
testnet_gov_params: ## Output gov parameters
poktrolld q gov params --node=$(TESTNET_RPC)

.PHONY: testnet_status
testnet_status: ## Output status of the RPC node (most likely a validator)
poktrolld status --node=$(TESTNET_RPC) | jq

.PHONY: testnet_height
testnet_height: ## Height of the network from the RPC node point of view
poktrolld status --node=$(TESTNET_RPC) | jq ".sync_info.latest_block_height"

################
### Accounts ###
################
Expand Down Expand Up @@ -818,4 +857,14 @@ act_list: check_act ## List all github actions that can be executed locally with
act_reviewdog: check_act check_gh ## Run the reviewdog workflow locally like so: `GITHUB_TOKEN=$(gh auth token) make act_reviewdog`
$(eval CONTAINER_ARCH := $(shell make -s detect_arch))
@echo "Detected architecture: $(CONTAINER_ARCH)"
act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH)
act -v -s GITHUB_TOKEN=$(GITHUB_TOKEN) -W .github/workflows/reviewdog.yml --container-architecture $(CONTAINER_ARCH)

#############################
### Grove Gateway Helpers ###
#############################

.PHONY: grove_staging_eth_block_height
grove_staging_eth_block_height: ## Sends a relay through the staging grove gateway to the eth-mainnet chain. Must have GROVE_STAGING_PORTAL_APP_ID environment variable set.
curl $(GROVE_GATEWAY_STAGING_ETH_MAINNET)/v1/$(GROVE_STAGING_PORTAL_APP_ID) \
-H 'Content-Type: application/json' \
--data $(SHANNON_JSON_RPC_DATA_ETH_BLOCK_HEIGHT)
1 change: 0 additions & 1 deletion README.md

This file was deleted.

81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
sidebar_position: 1
title: Poktroll
id: home-doc
slug: /
---

<div align="center">
<a href="https://www.pokt.network">
<img src="https://user-images.githubusercontent.com/2219004/151564884-212c0e40-3bfa-412e-a341-edb54b5f1498.jpeg" alt="Pocket Network logo" width="340"/>
</a>
</div>

<div>
<a href="https://discord.gg/pokt"><img src="https://img.shields.io/discord/553741558869131266"/></a>
<a href="https://github.com/pokt-network/poktroll/releases"><img src="https://img.shields.io/github/release-pre/pokt-network/pocket.svg"/></a>
<a href="https://github.com/pokt-network/poktroll/pulse"><img src="https://img.shields.io/github/contributors/pokt-network/pocket.svg"/></a>
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg"/></a>
<a href="https://github.com/pokt-network/poktroll/pulse"><img src="https://img.shields.io/github/last-commit/pokt-network/pocket.svg"/></a>
<a href="https://github.com/pokt-network/poktroll/pulls"><img src="https://img.shields.io/github/issues-pr/pokt-network/pocket.svg"/></a>
<a href="https://github.com/pokt-network/poktroll/releases"><img src="https://img.shields.io/badge/platform-linux%20%7C%20macos-pink.svg"/></a>
<a href="https://github.com/pokt-network/poktroll/issues"><img src="https://img.shields.io/github/issues/pokt-network/pocket.svg"/></a>
<a href="https://github.com/pokt-network/poktroll/issues"><img src="https://img.shields.io/github/issues-closed/pokt-network/pocket.svg"/></a>
<a href="https://godoc.org/github.com/pokt-network/pocket"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"/></a>
<a href="https://goreportcard.com/report/github.com/pokt-network/pocket"><img src="https://goreportcard.com/badge/github.com/pokt-network/pocket"/></a>
<a href="https://golang.org"><img src="https://img.shields.io/badge/golang-v1.20-green.svg"/></a>
<a href="https://github.com/tools/godep" ><img src="https://img.shields.io/badge/godep-dependency-71a3d9.svg"/></a>
</div>

# poktroll <!-- omit in toc -->

**poktroll** is built using the [Cosmos SDK](https://docs.cosmos.network) and
[CometBFT](https://cometbft.com/), created with [Ignite CLI](https://ignite.com/cli)
for the Shannon upgrade of the [Pocket Network](https://pokt.network) blockchain.

- [Learn about Pocket Network](#learn-about-pocket-network)
- [Developer Documentation](#developer-documentation)
- [Roadmap](#roadmap)
- [Quickstart](#quickstart)
- [Godoc](#godoc)
- [Have questions? Ask An PNYC](#have-questions-ask-an-pnyc)
- [License](#license)

## Learn about Pocket Network

User friendly documentation of the Shannon upgrade is still a WIP, but there are
a handful of (potentially outdated) resources you can reference in the meantime
to build a better understanding of Pocket Network:

- [Pocket Network official documentation](https://docs.pokt.network)
- [[Live] Pocket Network Morse; aka v0](https://github.com/pokt-network/pocket-core)
- [[Outdated] Pocket Network Protocol](https://github.com/pokt-network/pocket-network-protocol)
- [[Deprecated]Pocket Network V1](https://github.com/pokt-network/pocket)

## Developer Documentation

The developer documentation is available at [dev.poktroll.com](https://dev.poktroll.com).

## Roadmap

You can view the Shannon Roadmap on [Github](https://github.com/orgs/pokt-network/projects/144?query=is%3Aopen+sort%3Aupdated-desc)

## Quickstart

The best way to get involved is by following the [quickstart instructions](<[./develop/developer_guide/quickstart.md](https://dev.poktroll.com/develop/developer_guide/quickstart)>).

## Godoc

The Godoc for the source code in this can be found at [pkg.go.dev/github.com/pokt-network/poktroll](https://pkg.go.dev/github.com/pokt-network/poktroll).

## Have questions? Ask An PNYC

You can use [PNYX](https://pnyxai.com/), an AI-powered search engine that has been
trained and indexed on the Pocket Network documentation, community calls, forums
and much more!

---

## License

This project is licensed under the MIT License; see the [LICENSE](https://github.com/pokt-network/poktroll/blob/main/LICENSE) file for details.
46 changes: 35 additions & 11 deletions Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ load("ext://restart_process", "docker_build_with_restart")
load("ext://helm_resource", "helm_resource", "helm_repo")
load("ext://configmap", "configmap_create")
load("ext://secret", "secret_create_generic")
load("ext://deployment", "deployment_create")
load("ext://execute_in_pod", "execute_in_pod")

# A list of directories where changes trigger a hot-reload of the validator
hot_reload_dirs = ["app", "cmd", "tools", "x", "pkg"]


def merge_dicts(base, updates):
for k, v in updates.items():
if k in base and type(base[k]) == "dict" and type(v) == "dict":
Expand All @@ -16,6 +19,7 @@ def merge_dicts(base, updates):
# Replace or set the value
base[k] = v


# Create a localnet config file from defaults, and if a default configuration doesn't exist, populate it with default values
localnet_config_path = "localnet_config.yaml"
localnet_config_defaults = {
Expand All @@ -28,17 +32,19 @@ localnet_config_defaults = {
"delve": {"enabled": False},
},
"observability": {"enabled": True},
"relayminers": {
"count": 1,
"delve": {"enabled": False}
},
"relayminers": {"count": 1, "delve": {"enabled": False}},
"gateways": {
"count": 1,
"delve": {"enabled": False},
"delve": {"enabled": False},
},
"appgateservers": {
"count": 1,
"delve": {"enabled": False},
"delve": {"enabled": False},
},
# TODO(#511): Add support for `REST` and enabled this.
"ollama": {
"enabled": False,
"model": "qwen:0.5b",
},
# By default, we use the `helm_repo` function below to point to the remote repository
# but can update it to the locally cloned repo for testing & development
Expand All @@ -54,7 +60,9 @@ merge_dicts(localnet_config, localnet_config_defaults)
# Then merge file contents over defaults
merge_dicts(localnet_config, localnet_config_file)
# Check if there are differences or if the file doesn't exist
if (localnet_config_file != localnet_config) or (not os.path.exists(localnet_config_path)):
if (localnet_config_file != localnet_config) or (
not os.path.exists(localnet_config_path)
):
print("Updating " + localnet_config_path + " with defaults")
local("cat - > " + localnet_config_path, stdin=encode_yaml(localnet_config))

Expand Down Expand Up @@ -198,10 +206,8 @@ helm_resource(
"--values=./localnet/kubernetes/values-validator.yaml",
"--set=persistence.cleanupBeforeEachStart="
+ str(localnet_config["validator"]["cleanupBeforeEachStart"]),
"--set=logs.level="
+ str(localnet_config["validator"]["logs"]["level"]),
"--set=logs.format="
+ str(localnet_config["validator"]["logs"]["format"]),
"--set=logs.level=" + str(localnet_config["validator"]["logs"]["level"]),
"--set=logs.format=" + str(localnet_config["validator"]["logs"]["format"]),
"--set=serviceMonitor.enabled="
+ str(localnet_config["observability"]["enabled"]),
"--set=development.delve.enabled="
Expand Down Expand Up @@ -364,3 +370,21 @@ k8s_resource(
)

k8s_resource("anvil", labels=["data_nodes"], port_forwards=["8547"])

if localnet_config["ollama"]["enabled"]:
print("Ollama enabled: " + str(localnet_config["ollama"]["enabled"]))

deployment_create(
"ollama",
image="ollama/ollama",
command=["ollama", "serve"],
ports="11434",
)

local_resource(
name="ollama-pull-model",
cmd=execute_in_pod(
"ollama", "ollama pull " + localnet_config["ollama"]["model"]
),
resource_deps=["ollama"],
)
10 changes: 10 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ genesis:
- service:
id: anvil
name: ""
- service:
id: ollama
name: ""
stake:
# NB: This value should be exactly 1upokt smaller than the value in
# `supplier1_stake_config.yaml` so that the stake command causes a state change.
Expand All @@ -149,6 +152,13 @@ genesis:
service:
id: anvil
name: ""
- endpoints:
- configs: []
rpc_type: REST
url: http://relayminer1:8545
service:
id: ollama
name: ""
stake:
# NB: This value should be exactly 1upokt smaller than the value in
# `application1_stake_config.yaml` so that the stake command causes a state change.
Expand Down
Loading

0 comments on commit 90d6c8d

Please sign in to comment.