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

Bake stake into genesis #68

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ openssl = "0.10.66"
rand = "0.8.5"
reqwest = { version = "0.11.23", features = ["blocking", "brotli", "deflate", "gzip", "rustls-tls", "json"] }
rustls = { version = "0.21.11", default-features = false, features = ["quic"] }
serde = "1.0.208"
serde_yaml = "0.9.34"
solana-accounts-db = "1.18.20"
solana-clap-v3-utils = "1.18.20"
solana-core = "1.18.20"
Expand Down
55 changes: 52 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ In Validator Lab we can deploy and test new validator features quickly and easil

## How to run

### Requirements
1) Docker. Create `docker` group add user to `docker` group
```
sudo usermod -aG docker $USER
newgrp docker
```
2) jq
```
sudo apt install jq
```

### Setup
Ensure you have the proper permissions to connect to the Monogon Kubernetes endpoint. Reach out to Leo on slack if you need the key (you do if you haven't asked him in the past).

Expand Down Expand Up @@ -79,9 +90,10 @@ cargo run --bin cluster --
--base-image <base-image> # e.g. ubuntu:20.04
--image-name <docker-image-name> # e.g. cluster-image
# validator config
--skip-primordial-accounts
--full-rpc
--internal-node-sol <Sol>
--internal-node-stake-sol <Sol>
--internal-node-sol <sol>
--internal-node-stake-sol <sol>
# kubernetes config
--cpu-requests <cores>
--memory-requests <memory>
Expand All @@ -107,6 +119,41 @@ For client Version >= 2.0.0
--bench-tps-args 'tx-count=5000 keypair-multiplier=4 threads=16 num-lamports-per-account=200000000 sustained tpu-connection-pool-size=8 thread-batch-sleep-ms=0 commitment-config=processed'
```

## Baking Validator Stakes into Genesis
- You can bake validator stakes into gensis on genesis creation by passing in `--validator-balances-file <file-path-to-validator-balances-yml>`. This way when the cluster boots up, all validators will consistently be in the leader schedule. In the validator balances file, you can set specific validator balances and stake amounts.
The validator balances file has the following yaml format:
```
---
v0:
balances_lamports: <balance0>
stake_lamports: <stake0>
v1:
balances_lamports: <balance1>
stake_lamports: <stake1>
...
vN:
balances_lamports: <balanceN>
stake_lamports: <stakeN>
```
^ Note, the file must have the `v0`, `v1`, ..., `vN` format. The number of validators in this file must match `--num-validators <number-of-validators>`

For example, we could create: `validator-balances.yml` and have it look like:
```
---
v0:
balance_lamports: 400000000000
stake_lamports: 40000000000
v1:
balance_lamports: 200000000000
stake_lamports: 20000000000
v2:
balance_lamports: 300000000000
stake_lamports: 30000000000
```

- If you do not want to bake stakes into genesis and instead want the stake to warm up after deplyoyment, pass in the flag `--skip-primordial-stakes` and leave out `--validator-balances`
- `--internal-node-sol`, `--internal-node-stake-sol`, are `--comission` are only valid with `--skip-primordial-stakes`

## Metrics
1) Setup metrics database:
```
Expand Down Expand Up @@ -155,7 +202,9 @@ cargo run --bin cluster -- -n <namespace> --registry <registry> --release-channe

For steps (2) and (3), when using `--no-bootstrap`, we assume that the directory at `--cluster-data-path <directory>` has the correct genesis, bootstrap identity, and faucet account stored. These are all created in step (1).

Note: We can't deploy heterogeneous clusters across v1.17 and v1.18 due to feature differences. Hope to fix this in the future. Have something where we can specifically define which features to enable.
Notes:
1) We can't deploy heterogeneous clusters across v1.17 and v1.18 due to feature differences. Hope to fix this in the future. Have something where we can specifically define which features to enable.
2) Heterogenous clusters with primordial stakes baked into genesis is not supported yet

## Querying the RPC from outside the cluster
The cluster now has an external IP/port that can be queried to reach the cluster RPC. The external RPC port will be logged during cluster boot, e.g.:
Expand Down
Loading
Loading