Skip to content

Commit

Permalink
Docs genesis scripts (#183)
Browse files Browse the repository at this point in the history
* initial implementation of exposing custom scripts

* update new setup scripts for each chain

* update install script

* add defaults for install params

* run custom script e2e tests in the PR

* upgrade starship-action to rc2

* update configmap to handle file reads

* update genesis unbonding time

* add e2e tests to check 15s unbonding time for a chain

* fix typo in token transfer script

* fix setup config script

* try and update resources for multi-validator test case

* add docs for genesis and scripts directives

* docs for genesis and scripts directive

* Chart version release for 0.1.44
  • Loading branch information
Anmol1696 committed Aug 24, 2023
1 parent 71985da commit ce9aa0a
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
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
```

0 comments on commit ce9aa0a

Please sign in to comment.