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

Docs genesis scripts #183

Merged
merged 16 commits into from
Aug 24, 2023
Merged
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
2 changes: 1 addition & 1 deletion charts/devnet/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.43
version: 0.1.44

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
64 changes: 63 additions & 1 deletion docs/pages/config/chains.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ For more details on the resource directive have a look at [kubernetes resources]
## `faucet` (optional)
Every genesis node runs a [cosmjs faucet](https://github.com/cosmos/cosmjs/tree/main/packages/faucet), by default
setting for faucet [here](https://github.com/cosmology-tech/starship/blob/main/charts/devnet/values.yaml#L32...#L38) but can be
overiden with this directive, specially for compatible cosmjs version with the chain version.
overridden with this directive, specially for compatible cosmjs version with the chain version.

```yaml
chains:
Expand Down Expand Up @@ -202,3 +202,65 @@ chains:

We use [cosmovisor](https://docs.cosmos.network/v0.47/tooling/cosmovisor)
to run the validators when this directive is enabled, which allows for external software-upgrade-proposal.

## `genesis` (optional)
Patch `genesis.json` file directly from the config file using this directive. Once the genesis node creates the genesis file, then the
patch for genesis is applied.
```yaml
chains:
- name: osmosis-1
type: osmosis
numValidators: 2
genesis:
app_state:
staking:
params:
unbonding_time: "5s"
```

## `scripts` (optional)
Scripts directive will replace the default scripts with the given scripts. Inorder to use this directive,
one must use [`scripts/install.sh`](https://github.com/cosmology-tech/starship/blob/main/scripts/install.sh) script for running the helm chart.

> Since the local scripts are converted into configmaps that are then created in the kubernetes cluster, there is a limit of 1MBi

Types of scripts that are allowed inside the `scripts` dir are:
* `createGenesis`: Script used in the genesis node that will create the `genesis.json` file. Default: [`create-genesis.sh`](https://github.com/cosmology-tech/starship/blob/main/charts/devnet/scripts/create-genesis.sh)
* `updateGenesis`: Script used to make custom changes to the genesis file. Default: [`update-genesis.sh`](https://github.com/cosmology-tech/starship/blob/main/charts/devnet/scripts/update-genesis.sh)
* `updateConfig`: Script used to make custom changes to the config files. Default: [`update-config.sh`](https://github.com/cosmology-tech/starship/blob/main/charts/devnet/scripts/update-config.sh)
* `createValidator`: Script to run the `create-validator` txn on the validator nodes after spinup. Note this script is run as part of the `PostStartHook` of the validator pods. Default: [`create-validator.sh`](https://github.com/cosmology-tech/starship/blob/main/charts/devnet/scripts/create-validator.sh)
* `transferTokens`: Script run as part of the Starship glue code. This script is related to the faucet that we run. Default: [`transfer-tokens.sh`](https://github.com/cosmology-tech/starship/blob/main/charts/devnet/scripts/transfer-tokens.sh)
* `buildChain`: Script that builds chain binaries, based on the `build` directive. Default: [`build-chain.sh`](https://github.com/cosmology-tech/starship/blob/main/charts/devnet/scripts/build-chain.sh)

One can choose the sub-scripts that needs to be overwritten, default scripts will be used instead.

```yaml
chains:
- name: osmosis-1
type: osmosis
numValidators: 1
scripts:
createGenesis:
file: scripts/create-custom-genesis.sh
updateGenesis:
file: scripts/update-custom-genesis.sh
updateConfig:
file: scripts/update-custom-config.sh
createValidator:
file: scripts/create-custom-validator.sh
transferTokens:
file: scripts/transfer-custom-tokens.sh
```

> Note `file` path is relative to the config file itself

Dir structure should look something like:
```bash
config.yaml
scripts/
create-custom-genesis.sh
update-custom-genesis.sh
update-custom-config.sh
create-custom-validator.sh
transfer-custom-tokens.sh
```
Loading