Add playbook to send create-validator
tx for subsequent nodes
#3
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,5 @@
|
||||
*-deployment
|
||||
*-spec.yml
|
||||
mainnet-genesis
|
||||
|
||||
# Playbook vars
|
||||
*-vars.yml
|
||||
|
@ -1,4 +1,4 @@
|
||||
# laconicd-stack
|
||||
|
||||
- Follow [run-first-validator.md](run-first-validator.md) to run the first validator node
|
||||
- Follow [run-validator.md](run-validator.md) to run subsequent validator nodes
|
||||
- Follow [run-first-validator.md](docs/run-first-validator.md) to run the first validator node
|
||||
- Follow [run-validator.md](docs/run-validator.md) to run subsequent validator nodes
|
||||
|
@ -7,18 +7,10 @@
|
||||
|
||||
## Run node
|
||||
|
||||
- Follow these steps to run first validator node: [run-first-validator.md](run-first-validator.md)
|
||||
- Follow these steps to run first validator node: [run-first-validator.md](./run-first-validator.md)
|
||||
|
||||
- Following steps can be used to run subsequent validator nodes
|
||||
|
||||
- Fetch the stack:
|
||||
|
||||
```bash
|
||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||
```
|
||||
|
||||
This command clones the entire repository into the `~/cerc` folder, which includes the genesis file published by the first validator.
|
||||
|
||||
- Copy the example variables file:
|
||||
|
||||
```bash
|
||||
@ -36,6 +28,8 @@
|
||||
- Update `cerc_peers` in `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml`:
|
||||
|
||||
```bash
|
||||
cerc_moniker: "LaconicMainnetNode-2"
|
||||
|
||||
cerc_peers: "<node-id>@host.docker.internal:26656"
|
||||
```
|
||||
|
||||
@ -50,7 +44,7 @@
|
||||
export MAINNET_DEPLOYMENT_DIR=
|
||||
```
|
||||
|
||||
- Update port mappings in `~/cerc/laconicd-stack/playbooks/validator/templates/specs/spec-template.yml.j2` with:
|
||||
- Update port mappings in `~/cerc/laconicd-stack/playbooks/validator/templates/specs/spec-template.yml.j2` to avoid port conflicts with first validator node:
|
||||
|
||||
```bash
|
||||
network:
|
||||
@ -64,12 +58,6 @@
|
||||
- '3317:1317'
|
||||
```
|
||||
|
||||
- Update permission for `genesis/mainnet-genesis.json`:
|
||||
|
||||
```bash
|
||||
sudo chmod 777 ~/cerc/laconicd-stack/genesis/mainnet-genesis.json
|
||||
```
|
||||
|
||||
- Run ansible playbook to set up and start your validator node:
|
||||
|
||||
```bash
|
||||
@ -81,3 +69,31 @@
|
||||
```bash
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
||||
```
|
||||
|
||||
## Create Validator
|
||||
|
||||
- Export required env vars:
|
||||
|
||||
```bash
|
||||
# private key of the existing account
|
||||
export PVT_KEY=<private-key-in-hex-format>
|
||||
|
||||
# desired key name
|
||||
export KEY_NAME=<key-name>
|
||||
|
||||
export DATA_DIRECTORY=<data-directory>
|
||||
export MAINNET_DEPLOYMENT_DIR=<mainnet-deployment-dir>
|
||||
```
|
||||
|
||||
- Run ansible playbook to create validator on running chain:
|
||||
|
||||
<!-- TODO: Use OS keyring -->
|
||||
```bash
|
||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml
|
||||
```
|
||||
|
||||
- Check the validator list:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
|
||||
```
|
@ -5,16 +5,22 @@
|
||||
- [ansible](playbooks/README.md#ansible-installation)
|
||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
||||
|
||||
## Stop testnet node
|
||||
## Generate mainnet genesis file
|
||||
|
||||
- Stop the testnet node:
|
||||
- Get your private key from testnet deployment:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe"
|
||||
```
|
||||
|
||||
NOTE: Store this key securely as it is needed in later steps
|
||||
|
||||
- Stop the node for SAPO testnet:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir <testnet-deployment-dir> stop
|
||||
```
|
||||
|
||||
## Generate mainnet genesis file
|
||||
|
||||
- Fetch the stack in machine where the testnet chain node is running:
|
||||
|
||||
```bash
|
||||
@ -37,10 +43,13 @@
|
||||
|
||||
- Copy over the exported `testnet-state.json` file to target machine
|
||||
|
||||
- Copy over the LPS lockup distribution `distribution.json` file to target machine
|
||||
|
||||
- Set envs:
|
||||
|
||||
```bash
|
||||
export EXPORTED_STATE_PATH=<absolute-path-to-exported-testnet-state-json>
|
||||
export LPS_DISTRIBUTION_PATH=<absolute-path-to-distribution-json>
|
||||
export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
|
||||
```
|
||||
|
||||
@ -53,7 +62,7 @@
|
||||
- Run playbook to use exported state for generating mainnet genesis:
|
||||
|
||||
```bash
|
||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/generate-genesis.yml -e "exported_state_path=$EXPORTED_STATE_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
|
||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/generate-genesis.yml -e "exported_state_path=$EXPORTED_STATE_PATH" -e "lps_distribution_path=$LPS_DISTRIBUTION_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
|
||||
```
|
||||
|
||||
- Genesis file will be generated in output directory along with a file specifying the staking amount
|
||||
@ -65,8 +74,6 @@
|
||||
|
||||
## Run node
|
||||
|
||||
<!-- TODO: Add steps to get private key of validator account from laconic testnet -->
|
||||
|
||||
- Copy the example variables file if not already done:
|
||||
|
||||
```bash
|
||||
@ -76,17 +83,21 @@
|
||||
- Update `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
|
||||
|
||||
```bash
|
||||
# Private key of the existing account in hex format (required for gentx)
|
||||
pvt_key: ""
|
||||
# Use the private key of the existing account that was exported in previous steps
|
||||
pvt_key: "<private-key>"
|
||||
|
||||
# Path to the generated mainnet genesis file generated in the previous step
|
||||
genesis_file: "<path-to-generated-genesis-file>"
|
||||
# Path to the generated mainnet genesis file
|
||||
# Use the absolute path of generated output directory in the previous steps
|
||||
genesis_file: "<absolute-path-to-generated-output-dir>/genesis.json"
|
||||
|
||||
# Path to staking-amount.json generated in previous steps
|
||||
staking_amount_file: "<absolute-path-to-generated-output-dir>/staking-amount.json"
|
||||
|
||||
# Set custom moniker for the node
|
||||
cerc_moniker: "LaconicMainnetNode"
|
||||
|
||||
# Set desired key name
|
||||
key_name: "validator"
|
||||
key_name: "laconic-validator"
|
||||
```
|
||||
|
||||
- Export the data directory and mainnet deployment directory as environment variables:
|
||||
@ -118,12 +129,39 @@
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query bond list'
|
||||
```
|
||||
|
||||
## Publish Genesis File and Node Address
|
||||
|
||||
- Copy the genesis file to [genesis](./genesis) folder:
|
||||
- Check `alps` and `alnt` tokens total supply:
|
||||
|
||||
```bash
|
||||
sudo cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ~/cerc/laconicd-stack/genesis/mainnet-genesis.json
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query bank total-supply'
|
||||
```
|
||||
|
||||
- Query the `lps_lockup` account and view distribution:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup'
|
||||
```
|
||||
|
||||
- Query the `lps_lockup` and early supports accounts balances:
|
||||
|
||||
```bash
|
||||
lockup_account_address=$(laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query auth module-account lps_lockup -o json | jq -r .account.value.base_account.address')
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $lockup_account_address"
|
||||
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd query bank balances $EARLY_SUPPORTS_ACC_ADDR"
|
||||
```
|
||||
|
||||
## Publish required artifacts
|
||||
|
||||
- Copy the genesis file to [config](./config) folder:
|
||||
|
||||
```bash
|
||||
cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
|
||||
```
|
||||
|
||||
- Copy the staking amount file to [config](./config) folder:
|
||||
|
||||
```bash
|
||||
cp <absolute-path-to-generated-output-dir>/staking-amount.json ~/cerc/laconicd-stack/config/staking-amount.json
|
||||
```
|
||||
|
||||
- Get your node's address:
|
||||
@ -134,4 +172,4 @@
|
||||
|
||||
- Add your node's address to [node-addresses.yml](./node-addresses.yml)
|
||||
|
||||
- Submit a PR with this genesis file and node address so that it is available to other validators
|
||||
- Submit a PR with this genesis file, staking amount file and node address so that it is available to other validators
|
@ -5,16 +5,22 @@
|
||||
- [ansible](playbooks/README.md#ansible-installation)
|
||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
||||
|
||||
## Stop testnet node
|
||||
## Run node
|
||||
|
||||
- Stop the testnet node:
|
||||
- Get your private key from testnet deployment:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe"
|
||||
```
|
||||
|
||||
NOTE: Store this key securely as it is needed in later steps
|
||||
|
||||
- Stop the node for SAPO testnet:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir <testnet-deployment-dir> stop
|
||||
```
|
||||
|
||||
## Run node
|
||||
|
||||
- Fetch the stack:
|
||||
|
||||
```bash
|
||||
@ -32,23 +38,11 @@
|
||||
- Update `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml` with required values:
|
||||
|
||||
```bash
|
||||
# Path to the genesis file published by the first validator
|
||||
genesis_file: "~/cerc/laconicd-stack/genesis/mainnet-genesis.json"
|
||||
|
||||
# Set custom moniker for the node
|
||||
cerc_moniker: "LaconicMainnetNode"
|
||||
|
||||
# Set chain ID (should match the one in the genesis file)
|
||||
cerc_chain_id: "laconic-mainnet"
|
||||
|
||||
# Set minimum gas price
|
||||
min_gas_price: 0.001
|
||||
|
||||
# Set log level
|
||||
cerc_loglevel: "info"
|
||||
cerc_moniker: "<your-moniker>"
|
||||
|
||||
# Set persistent peers (comma-separated list of node IDs and addresses)
|
||||
# You can find the list of available peers in node-addresses.yml
|
||||
# You can find the list of available peers in https://git.vdb.to/cerc-io/laconicd-stack/src/branch/main/node-addresses.yml
|
||||
cerc_peers: "<node-id>@<node-host>:26656,<node-id>@<node-host>:26656"
|
||||
```
|
||||
|
||||
@ -75,6 +69,34 @@
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
||||
```
|
||||
|
||||
## Create Validator
|
||||
|
||||
- Export required env vars:
|
||||
|
||||
```bash
|
||||
# Use the private key of the existing account that was exported in previous steps
|
||||
export PVT_KEY=<private-key-in-hex-format>
|
||||
|
||||
# desired key name
|
||||
export KEY_NAME=<key-name>
|
||||
|
||||
export DATA_DIRECTORY=<data-directory>
|
||||
export MAINNET_DEPLOYMENT_DIR=<mainnet-deployment-dir>
|
||||
```
|
||||
|
||||
- Run ansible playbook to create validator on running chain:
|
||||
|
||||
<!-- TODO: Use OS keyring -->
|
||||
```bash
|
||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml
|
||||
```
|
||||
|
||||
- Check the validator list:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
|
||||
```
|
||||
|
||||
## Register Your Node
|
||||
|
||||
- Get your node's address:
|
@ -2,6 +2,7 @@ cerc_moniker: "LaconicMainnetNode"
|
||||
cerc_chain_id: "laconic-mainnet"
|
||||
min_gas_price: 0.001
|
||||
cerc_loglevel: "info"
|
||||
key_name: "validator"
|
||||
key_name: "laconic-validator"
|
||||
pvt_key: ""
|
||||
genesis_file:
|
||||
genesis_file: ""
|
||||
staking_amount_file: ""
|
||||
|
@ -9,9 +9,10 @@
|
||||
ansible.builtin.shell:
|
||||
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull"
|
||||
|
||||
# TODO: Add a flag to control force rebuild
|
||||
- name: Build containers
|
||||
ansible.builtin.shell:
|
||||
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers"
|
||||
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild"
|
||||
|
||||
- name: Copy exported testnet state file
|
||||
ansible.builtin.copy:
|
||||
@ -22,7 +23,7 @@
|
||||
- block:
|
||||
- name: Run script to generate genesis file
|
||||
ansible.builtin.shell:
|
||||
cmd: "CHAIN_ID={{ cerc_chain_id }} EARLY_SUPPORTS_ACC_ADDRESS={{ early_supports_acc_address }} {{ ansible_env.HOME }}/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh {{ ansible_env.HOME }}/cerc/laconicd-stack/testnet-state.json"
|
||||
cmd: "CHAIN_ID={{ cerc_chain_id }} EARLY_SUPPORTS_ACC_ADDRESS={{ early_supports_acc_address }} {{ ansible_env.HOME }}/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh {{ ansible_env.HOME }}/cerc/laconicd-stack/testnet-state.json {{ lps_distribution_path }}"
|
||||
chdir: "{{ lookup('env', 'PWD') }}"
|
||||
always:
|
||||
- name: Clean up temporary genesis directory
|
||||
|
@ -20,8 +20,9 @@
|
||||
fail:
|
||||
msg: >-
|
||||
Required key files are not defined.
|
||||
Please set genesis_file in first-validator-vars.yml.
|
||||
when: not genesis_file
|
||||
Please set genesis_file and staking_amount_file in first-validator-vars.yml.
|
||||
when: not genesis_file or not staking_amount_file
|
||||
|
||||
- name: Fetch laconicd stack
|
||||
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||
|
||||
@ -32,7 +33,7 @@
|
||||
|
||||
- name: Build container images
|
||||
shell: |
|
||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
|
||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild
|
||||
|
||||
- name: Create deployment spec file
|
||||
shell: |
|
||||
@ -62,6 +63,12 @@
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy staking amount file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "{{ staking_amount_file }}"
|
||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json"
|
||||
mode: '0644'
|
||||
|
||||
- name: Copy genesis file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "{{ genesis_file }}"
|
||||
|
30
playbooks/validator/create-validator.yml
Normal file
30
playbooks/validator/create-validator.yml
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: Create validator on running chain
|
||||
hosts: localhost
|
||||
vars:
|
||||
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
||||
deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
|
||||
key_name: "{{ lookup('env', 'KEY_NAME') }}"
|
||||
pvt_key: "{{ lookup('env', 'PVT_KEY') }}"
|
||||
tasks:
|
||||
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
|
||||
fail:
|
||||
msg: >-
|
||||
Required environment variables are not set.
|
||||
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
|
||||
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == ''
|
||||
|
||||
- name: Fail if pvt_key is not set
|
||||
fail:
|
||||
msg: >-
|
||||
Neither private key (pvt_key) is set.
|
||||
Please export PVT_KEY.
|
||||
when: not pvt_key
|
||||
|
||||
- name: Import private key in laconicd
|
||||
shell: |
|
||||
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "laconicd keys import-hex {{ key_name }} {{ pvt_key }} --keyring-backend test"
|
||||
|
||||
- name: Run create-validator script
|
||||
shell: |
|
||||
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "KEY_NAME={{ key_name }} /scripts/create-validator.sh"
|
@ -20,8 +20,9 @@
|
||||
fail:
|
||||
msg: >-
|
||||
Required key files are not defined.
|
||||
Please set genesis_file in validator-vars.yml.
|
||||
when: not genesis_file
|
||||
Please set genesis_file and staking_amount_file in validator-vars.yml.
|
||||
when: not genesis_file or not staking_amount_file
|
||||
|
||||
- name: Fetch laconicd stack
|
||||
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||
|
||||
@ -63,6 +64,12 @@
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy staking amount file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "{{ staking_amount_file }}"
|
||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json"
|
||||
mode: '0644'
|
||||
|
||||
- name: Copy genesis file to laconicd-data tmp directory
|
||||
copy:
|
||||
src: "{{ genesis_file }}"
|
||||
|
@ -1,6 +1,7 @@
|
||||
cerc_moniker: "LaconicMainnetNode"
|
||||
cerc_chain_id: "laconic-mainnet"
|
||||
min_gas_price: 0.001
|
||||
cerc_loglevel: "info"
|
||||
genesis_file: "~/cerc/laconicd-stack/genesis/mainnet-genesis.json"
|
||||
genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json"
|
||||
staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"
|
||||
cerc_moniker: ""
|
||||
cerc_peers: ""
|
||||
|
@ -5,23 +5,30 @@ set -e
|
||||
set -u
|
||||
|
||||
# Check args
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "Usage: $0 <testnet-state-json-file-path>"
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 <testnet-state-json-file-path> <lps-distribution-json-file-path>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TESTNET_STATE_FILE="$1"
|
||||
LPS_DISTRIBUTION_FILE="$2"
|
||||
MAINNET_GENESIS_DIR=mainnet-genesis
|
||||
OUTPUT_DIR=output
|
||||
|
||||
if ! jq empty $LPS_DISTRIBUTION_FILE >/dev/null 2>&1; then
|
||||
echo "$LPS_DISTRIBUTION_FILE is not a valid JSON"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create a required target directories
|
||||
mkdir -p $MAINNET_GENESIS_DIR
|
||||
mkdir -p $OUTPUT_DIR
|
||||
|
||||
# --------
|
||||
|
||||
# Copy testnet state file to required dir
|
||||
# Copy testnet state file and distribution to required dir
|
||||
cp $TESTNET_STATE_FILE $MAINNET_GENESIS_DIR/testnet-state.json
|
||||
cp $LPS_DISTRIBUTION_FILE $MAINNET_GENESIS_DIR/distribution.json
|
||||
|
||||
# --------
|
||||
|
||||
@ -37,12 +44,18 @@ docker run \
|
||||
# --------
|
||||
|
||||
# Install required bech32 dependency
|
||||
# TODO: Avoid installing bech32 system-wide
|
||||
python3 -m pip install bech32 --break-system-packages
|
||||
# Define and create venv if not exists
|
||||
venv_dir="$PWD/venv"
|
||||
if [ ! -d "$venv_dir" ]; then
|
||||
python3 -m venv "$venv_dir"
|
||||
"$venv_dir/bin/pip" install bech32
|
||||
fi
|
||||
|
||||
# Carry over state from testnet to mainnet
|
||||
echo "Carrying over state from testnet state to mainnet genesis..."
|
||||
python3 $script_dir/transfer-state.py
|
||||
"$venv_dir/bin/python" "$script_dir/transfer-state.py"
|
||||
|
||||
# Clean up venv
|
||||
rm -rf "$venv_dir"
|
||||
|
||||
# --------
|
||||
|
||||
|
@ -16,14 +16,15 @@ if [ -z "$EARLY_SUPPORTS_ACC_ADDRESS" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# alps allocations
|
||||
# Total supply: 129600 * 10^18 alps
|
||||
EARLY_SUPPORTS_ALLOC="12960000000000000000000" # Early supports: 12960 * 10^18 alps (10% of total supply)
|
||||
LOCKUP_ALLOC="116640000000000000000000" # Lockup: 116640 * 10^18 alps (90% of total supply)
|
||||
# lps allocations
|
||||
# Total supply: 129600 lps
|
||||
EARLY_SUPPORTS_ALLOC="25920" # Early supports: 25920 lps (20% of total supply)
|
||||
LOCKUP_ALLOC="103680" # Lockup: 103680 lps (80% of total supply)
|
||||
LPS_LOCKUP_MODULE_ACCOUNT="lps_lockup"
|
||||
LPS_DENOM="alps"
|
||||
LPS_DENOM="lps"
|
||||
|
||||
testnet_state_file="$NODE_HOME/testnet-state.json"
|
||||
distribution_file="$NODE_HOME/distribution.json"
|
||||
mainnet_genesis_file="$NODE_HOME/config/genesis.json"
|
||||
|
||||
# Update any module params if required here
|
||||
@ -43,22 +44,9 @@ update_genesis '.app_state["gov"]["params"]["expedited_threshold"]="1.0000000000
|
||||
# Set normal threshold to 99% since it needs to be lesser than expedited threshold
|
||||
update_genesis '.app_state["gov"]["params"]["threshold"]="0.990000000000000000"'
|
||||
|
||||
# Perform alps allocations
|
||||
# Perform lps allocations
|
||||
laconicd genesis add-genesis-account $EARLY_SUPPORTS_ACC_ADDRESS $EARLY_SUPPORTS_ALLOC$LPS_DENOM --keyring-backend $KEYRING --append
|
||||
|
||||
# Use zero address to add an account for lps_lockup
|
||||
zero_address="laconic1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqklcls0"
|
||||
laconicd genesis add-genesis-account $zero_address $LOCKUP_ALLOC$LPS_DENOM --keyring-backend $KEYRING --module-name $LPS_LOCKUP_MODULE_ACCOUNT
|
||||
|
||||
# Update the lps_lockup address in bank module state
|
||||
lps_lockup_address=$(jq -r '.app_state.auth.accounts[] | select(.name == "lps_lockup") | .base_account.address' $HOME/.laconicd/config/genesis.json)
|
||||
jq --arg old "$zero_address" --arg new "$lps_lockup_address" \
|
||||
'.app_state.bank.balances |= map(if .address == $old then .address = $new else . end)' "$mainnet_genesis_file" > tmp.$$.json \
|
||||
&& mv tmp.$$.json "$mainnet_genesis_file"
|
||||
jq '(.app_state.auth.accounts[] | select(.name == "lps_lockup") | .permissions) = []' "$mainnet_genesis_file" > tmp.$$.json \
|
||||
&& mv tmp.$$.json "$mainnet_genesis_file"
|
||||
|
||||
# TODO: Dump JSON for allocations in LPS_LOCKUP_MODULE_ACCOUNT state
|
||||
laconicd genesis add-genesis-lockup-account lps_lockup $distribution_file $LOCKUP_ALLOC$LPS_DENOM
|
||||
|
||||
# Ensure that resulting genesis file is valid
|
||||
laconicd genesis validate
|
||||
|
@ -69,6 +69,10 @@ mainnet_state["app_state"]["registry"] = testnet_state["app_state"]["registry"]
|
||||
mainnet_state["app_state"]["slashing"]["params"] = testnet_state["app_state"]["slashing"]["params"]
|
||||
mainnet_state["consensus"]["params"] = testnet_state["consensus"]["params"]
|
||||
|
||||
# Update authority auction durations from 3600s to 60s
|
||||
mainnet_state["app_state"]["registry"]["params"]["authority_auction_commits_duration"] = "60s"
|
||||
mainnet_state["app_state"]["registry"]["params"]["authority_auction_reveals_duration"] = "60s"
|
||||
|
||||
|
||||
#------
|
||||
|
||||
# Allocate back delegation stakes
|
||||
|
@ -12,6 +12,7 @@ services:
|
||||
volumes:
|
||||
- laconicd-data:/root/.laconicd
|
||||
- ../config/mainnet-laconicd/run-laconicd.sh:/opt/run-laconicd.sh
|
||||
- ../config/mainnet-laconicd/create-validator.sh:/scripts/create-validator.sh
|
||||
ports:
|
||||
- "6060"
|
||||
- "26657"
|
||||
|
@ -4,6 +4,7 @@ set -e
|
||||
|
||||
NODE_HOME=/root/.laconicd
|
||||
genesis_file_path=$NODE_HOME/config/genesis.json
|
||||
# TODO: Set to OS keyring backend
|
||||
KEYRING="test"
|
||||
|
||||
if [ -f "$genesis_file_path" ]; then
|
||||
@ -27,6 +28,12 @@ if [ ! -f ${input_genesis_file} ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
staking_amount_file="$NODE_HOME/tmp/staking-amount.json"
|
||||
if [ ! -f "$staking_amount_file" ]; then
|
||||
echo "staking-amount.json file not provided, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DENOM=alnt
|
||||
|
||||
# Strip leading and trailing quotes ("") if they exist
|
||||
@ -53,8 +60,8 @@ if [ -z "$account_address" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO: Use staking amount from output/staking-amount.json
|
||||
stake_amount=900000000
|
||||
# Set staking amount
|
||||
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
||||
|
||||
# Create gentx with staked amount equal to allocated balance
|
||||
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING
|
||||
|
50
stack-orchestrator/config/mainnet-laconicd/create-validator.sh
Executable file
50
stack-orchestrator/config/mainnet-laconicd/create-validator.sh
Executable file
@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DENOM=alnt
|
||||
|
||||
NODE_HOME=/root/.laconicd
|
||||
KEYRING="test"
|
||||
|
||||
staking_amount_file="$NODE_HOME/tmp/staking-amount.json"
|
||||
if [ ! -f "$staking_amount_file" ]; then
|
||||
echo "staking-amount.json file not provided, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [-z "$KEY_NAME" ]; then
|
||||
echo "KEY_NAME environment variable not set, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CERC_MONIKER" ]; then
|
||||
echo "CERC_MONIKER environment variable not set, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set staking amount
|
||||
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
||||
|
||||
# Create validator.json file
|
||||
validator_json="$NODE_HOME/tmp/validator.json"
|
||||
cat > "$validator_json" << EOF
|
||||
{
|
||||
"pubkey": $(laconicd tendermint show-validator),
|
||||
"amount": "${stake_amount}${DENOM}",
|
||||
"moniker": "${CERC_MONIKER}",
|
||||
"commission-rate": "0.0",
|
||||
"commission-max-rate": "0.0",
|
||||
"commission-max-change-rate": "0.0",
|
||||
"min-self-delegation": "1"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create validator using the JSON file
|
||||
laconicd tx staking create-validator "$validator_json" \
|
||||
--chain-id "$CERC_CHAIN_ID" \
|
||||
--gas auto \
|
||||
--gas-adjustment 1.5 \
|
||||
--gas-prices $MIN_GAS_PRICE$DENOM \
|
||||
--from $KEY_NAME \
|
||||
--keyring-backend $KEYRING \
|
||||
--yes
|
@ -53,7 +53,6 @@ else
|
||||
sed -i 's/prometheus = false/prometheus = true/g' $NODE_HOME/config/config.toml
|
||||
fi
|
||||
|
||||
|
||||
echo "Starting laconicd node..."
|
||||
laconicd start \
|
||||
--api.enable \
|
||||
|
Loading…
Reference in New Issue
Block a user
this setting is wild, gotta be on the ball :)
closes cerc-io/laconicd#66