Skip to content

Commit

Permalink
Checkpoint commit of a previous stash - working through the quickstar…
Browse files Browse the repository at this point in the history
…t guide
  • Loading branch information
Olshansk committed Dec 13, 2023
1 parent ff9b390 commit e5613bb
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 48 deletions.
10 changes: 7 additions & 3 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ accounts:
mnemonic: "baby advance work soap slow exclude blur humble lucky rough teach wide chuckle captain rack laundry butter main very cannon donate armor dress follow"
coins:
- 999999999999999999upokt
- name: sequencer1
- name: sequencer2
mnemonic: "creek path rule retire evolve vehicle bargain champion roof whisper prize endorse unknown anchor fashion energy club sauce elder parent cotton old affair visa"
coins:
- 900000000000000upokt
Expand Down Expand Up @@ -58,10 +58,14 @@ client:
openapi:
path: docs/static/openapi.yml
validators:
- name: sequencer1
- name: sequencer2
bonded: 900000000upokt
config:
moniker: "sequencer1"
moniker: "sequencer2"
consensus:
timeout_commit: "5s"
timeout_propose: "5s"

# We can persist arbitrary genesis values via 1 to 1 mapping to genesis.json
genesis:
app_state:
Expand Down
29 changes: 17 additions & 12 deletions docusaurus/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,51 +31,56 @@ slug: /

**poktroll** is a rollup built using [Rollkit](https://rollkit.dev/), [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.

This R&D effort It is the result of a research spike conducted by the Core [Pocket Network](https://pokt.network/) Protocol Team at [GROVE Inc.](https://grove.city/). We have documented our research journey [here](https://www.pokt.network/blog/pokt-network-rolling-into-the-modular-future-of-the-protocol-a-technical-deep-dive) (deep dive) and [here](https://www.pokt.network/blog/a-sovereign-rollup-and-a-modular-future) (summary).
This R&D effort is the result of a research spike conducted by the Core [Pocket Network](https://pokt.network/) Protocol Team at [GROVE Inc.](https://grove.city/). We have documented our research journey [here](https://www.pokt.network/blog/pokt-network-rolling-into-the-modular-future-of-the-protocol-a-technical-deep-dive) (deep dive) and [here](https://www.pokt.network/blog/a-sovereign-rollup-and-a-modular-future) (summary).

- [Learn about Pocket Network](#learn-about-pocket-network)
- [Roadmap](#roadmap)
- [Getting Started](#getting-started)
- [Quickstart](#quickstart)
- [Godoc](#godoc)
- [Ask An AI](#ask-an-ai)
- [PNYX](#pnyx)
- [GPokT](#gpokt)
- [Have questions? Ask An AI](#have-questions-ask-an-ai)
- [PNYX (Search Engine)](#pnyx-search-engine)
- [GPokT (Chatbot)](#gpokt-chatbot)
- [License](#license)

## Learn about Pocket Network

User friendly documentation on the Shannon upgrade is still a WIP, but there are
a handful of resources you can reference in the meantime:
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).
- [Pocket Network official documentation](https://docs.pokt.network)
- [Pocket Network Morse; aka v0 (current mainnet)](https://github.com/pokt-network/pocket-core)
- [Pocket Network Protocol (outdated)](https://github.com/pokt-network/pocket-network-protocol)
- [Pocket Network V1 (deprecated)](https://github.com/pokt-network/pocket)

## Roadmap

You can find our Roadmap [here](https://github.com/orgs/pokt-network/projects/144?query=is%3Aopen+sort%3Aupdated-desc) and the roadmap changelog [here](./roadmap/roadmap_changelog.md).
You can details related to our roadmap [here](./roadmap/roadmap.md) and the
roadmap changelog [here](./roadmap/roadmap_changelog.md).

## Getting Started

### Quickstart

The best way to get involved is by following the instructions [here](./d)
The best way to get involved is by following the instructions [here](./quickstart.md).

### 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).

## Ask An AI
## Have questions? Ask An AI

### PNYX
The fastest and easiest way to get answers to your questions is by one of our
several AI-powered tools.

### PNYX (Search Engine)

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!

### GPokT
### GPokT (Chatbot)

You can use our chatbot, [GPokT](https://gpoktn.streamlit.app), to ask questions
about Pocket Network. Please note that it may require you to provide your own
Expand Down
Binary file added docusaurus/docs/img/quickstart_accounts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docusaurus/docs/img/quickstart_applist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions docusaurus/docs/infrastructure/localnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ needed to send an end-to-end relay.
- [localnet_config.yaml](#localnet_configyaml)
- [Scaling network actors](#scaling-network-actors)
- [Modify Kubernetes workloads](#modify-kubernetes-workloads)
- [Troubleshooting](#troubleshooting)
- [Clean Slate (Nuclear Option)](#clean-slate-nuclear-option)

## Run Poktroll locally

Expand Down Expand Up @@ -94,3 +96,18 @@ cd ~/src/pocket/poktroll
sed -i.bak "s/helm_chart_local_repo\.enabled: false.*/helm_chart_local_repo.enabled: true/" localnet_config.yaml
sed -i.bak "s#path: .*#path: ../helm-charts#" localnet_config.yaml
```

## Troubleshooting

### Clean Slate (Nuclear Option)

If you're encountering weird issues and just need to start over, follow these steps:

```bash
make localnet_down
kind delete cluster
make docker_wipe
make go_develop_and_test
kind create cluster
make localnet_up
```
84 changes: 55 additions & 29 deletions docusaurus/docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ title: Quickstart

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

- [Report issues](#report-issues)
- [Install Dependencies](#install-dependencies)
- [Launch LocalNet](#launch-localnet)
- [Clone the repository](#clone-the-repository)
- [Prepare your environment](#prepare-your-environment)
- [Create a k8s cluster](#create-a-k8s-cluster)
- [Start the LocalNet](#start-the-localnet)
- [Start up LocalNet](#start-up-localnet)
- [Interact with the chain](#interact-with-the-chain)
- [Create a new Account](#create-a-new-account)
- [Fund your account](#fund-your-account)
Expand All @@ -23,29 +22,34 @@ title: Quickstart
- [Makefile](#makefile)
- [Ignite](#ignite)

The goal of this document is to get you up and running with a LocalNet and end-to-end relay.

## Report issues
:::tip
The goal of this document is to get you up and running with a LocalNet and
end-to-end relay.

If you encounter any problems, please create a new [GitHub Issue here](https://github.com/pokt-network/pocket/issues/new/choose).
**If you encounter any problems**, the best way to get support
from the team is by creating a new [GitHub Issue here](https://github.com/pokt-network/pocket/issues/new/choose).
:::

## Install Dependencies

Install the following:
Install the following dependencies:

1. [Golang](https://go.dev/doc/install)
2. [Docker](https://docs.docker.com/get-docker/)
3. [Ignite](https://docs.ignite.com/welcome/install)
4. [Kind](https://kind.sigs.k8s.io/#installation-and-usage)
5. [Helm](https://helm.sh/docs/intro/install/#through-package-managers)
6. [Tilt](https://docs.tilt.dev/install.html)
1. [Golang](https://go.dev/doc/install) - The language we use to implement the protocol
2. [Docker](https://docs.docker.com/get-docker/) - Containerization tool
3. [Ignite](https://docs.ignite.com/welcome/install) - Cosmos SDK CLI for building and deploying blockchains
4. [Kind](https://kind.sigs.k8s.io/#installation-and-usage) - k8s local cluster manager
5. [Helm](https://helm.sh/docs/intro/install/#through-package-managers) - k8s configuration and automation tool
6. [Tilt](https://docs.tilt.dev/install.html) - k8s local development tool & environment manager

:::note
You might already have these installed if you've followed the [localnet instructions](./infrastructure/localnet.md).
:::

## Launch LocalNet

This section will help you deploy a Celestia cluster, Pocket LocalNet in a k8s
cluster on your machine.

### Clone the repository

```bash
Expand All @@ -67,40 +71,51 @@ make go_develop_and_test
kind create cluster
```

### Start the LocalNet
### Start up LocalNet

```bash
make localnet_up
```

Visit [localhost:10350](http://localhost:10350) and wait until all the containers are 🟢.

If everything worked as expected, your screen should look similar to the following:

![LocalNet](./img/quickstart_localnet.png)

## Interact with the chain

This section is an opinionated walkthrough of a small number of interactions you
can have with the network so you get a feel of how to interact with the chain.

### Create a new Account

List all the accounts we get out of the box by running:

```bash
ignite account list --keyring-dir=./localnet/poktrolld --keyring-backend test --address-prefix pokt
ignite account list \
--keyring-dir=./localnet/poktrolld \
--keyring-backend test --address-prefix pokt
```

And create a new account named `shannon` by running:

```bash
ignite account create shannon --keyring-dir=./localnet/poktrolld --keyring-backend test
ignite account create shannon \
--keyring-dir=./localnet/poktrolld \
--keyring-backend test
```

If you re-run the command above, it should show up in the list.
Make sure to note its address under the `Address` column and export it as an
environment variable for convenience. For example:

```bash
export SHANNON_ADDRESS=pokt1mczm7xste7ckrwrmerda7m5ze89gyd9rzvxztr
export SHANNON_ADDRESS=pokt1skun4qy6z0cvac4fc37kcqcjsyr3qe9thhlzkv
```

![Accounts](./img/quickstart_accounts.png)

### Fund your account

Query your account's balance by running:
Expand All @@ -120,20 +135,21 @@ pagination:
total: "0"
```
But our sequencer has a lot of pokt from the genesis.json file (found at `localnet/poktrolld/config/genesis.json`)
But if you look in our genesis file (found at `localnet/poktrolld/config/genesis.json`)
you'll find that our sequencer has a lot of POKT, so we can use some of that.

```bash
poktrolld --home=./localnet/poktrolld \
tx bank send \
sequencer1 $SHANNON_ADDRESS 199999100000000upokt \
sequencer1 $SHANNON_ADDRESS 420000000000069upokt \
--node tcp://127.0.0.1:36657
```

And you'll find that Shannon is now rolling in POKT:

```yaml
balances:
- amount: "199999100000000"
- amount: "420000000000069"
denom: upokt
pagination:
next_key: null
Expand All @@ -142,22 +158,27 @@ pagination:

### Stake Shannon as an Application

Run `make app_list` (a helper our team created) to see all the apps staked on the network.
You should see that `SHANNON_ADDRESS` is not staked as an app yet.
Run `make app_list` (a helper our team created) to see all the apps staked on the
network. There will be a default application, but `SHANNON_ADDRESS` won't be there.

In order to stake shannon as an app, we need to create a new config file and run
the stake command.

```bash
touch shannon_app_config.yaml
cat <<EOF >> shannon_app_config.yaml
service_ids:
- anvil
EOF
```

We already have a supplier pre-configured to supply services for anvil
(an local ethereum testing node), so we simply reused that for simplicity.
:::note
Details on all the available configurations are still in progress and will be linked here once ready.
TODO(@red-0ne): Link to the document for all the config files once ready.
:::

We already have a supplier pre-configured (try running `make supplier_list`) to
supply services for anvil (an local ethereum testing node), so we can simply
reused that for simplicity.

Next, run the stake command:

Expand All @@ -170,6 +191,8 @@ poktrolld --home=./localnet/poktrolld \

If you re-run, `make app_list` you should see that `SHANNON_ADDRESS` is now staked as an app.

![Apps](./img/quickstart_applist.png)

### Send a relay

:::danger
Expand Down Expand Up @@ -265,9 +288,11 @@ Run `ignite --help` in order to explore all the different commands.
Things to add:

```
flow: curl (client) -> AppGateServer -> Supplier -> Anvil
defaut: localhost -> k8s -> k8s -> k8s
quickstart: localhost -> localhost -.-> k8s -> k8s
flow: curl (client) -> AppGateServer -> Supplier -> Anvil
defaut: localhost -> k8s -> k8s -> k8s
quickstart: localhost -> localhost -.-> k8s -> k8s
```

1. Update /etc/hosts
Expand All @@ -276,4 +301,5 @@ quickstart: localhost -> localhost -.-> k8s -> k8s


TODO(@okdas): avoid restarting celestia when restarting localnet
TODO(@Olshansk): A script that runs all the things at once
TODO(@Olshansk): A script that runs all the things at once
```
2 changes: 2 additions & 0 deletions e2e/tests/relay.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Feature: Relay Namespace
When the application "app1" sends the supplier "supplier1" a request for service "anvil" with data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Then the application "app1" receives a successful relay response signed by "supplier1"

# data :=

# TODO_TEST(@Olshansk):
# - Successful relay if using a gateway to proxy the relay
# - Succeedful relays when using multiple suppliers for app in some session
Expand Down
7 changes: 3 additions & 4 deletions pkg/relayer/proxy/relay_verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ func (rp *relayerProxy) VerifyRelayRequest(
}).
Msg("verifying relay request session")

currentBlock := rp.blockClient.LastNBlocks(ctx, 1)[0]

// TODO_IN_THIS_PR: Slow down blocks OR/AND increase numBlocksPerSession AND/OR make the following change:
// session, err := rp.sessionQuerier.GetSession(ctx, appAddress, service.Id, currentBlock.Height())
session, err := rp.sessionQuerier.GetSession(ctx, appAddress, service.Id, relayRequest.Meta.SessionHeader.SessionStartBlockHeight)
currentBlock := rp.blockClient.LastNBlocks(ctx, 1)[0]
session, err := rp.sessionQuerier.GetSession(ctx, appAddress, service.Id, currentBlock.Height())
// session, err := rp.sessionQuerier.GetSession(ctx, appAddress, service.Id, relayRequest.Meta.SessionHeader.SessionStartBlockHeight)

if err != nil {
return err
Expand Down

0 comments on commit e5613bb

Please sign in to comment.