Update scripts and playbooks to sign gentx on a separate machine
This commit is contained in:
parent
6733aa7318
commit
338966f43f
@ -7,94 +7,10 @@
|
|||||||
- LPS distribution Google spreadsheet URL or CSV file path
|
- LPS distribution Google spreadsheet URL or CSV file path
|
||||||
- Install `gzip` using `sudo apt install gzip`
|
- Install `gzip` using `sudo apt install gzip`
|
||||||
|
|
||||||
## Export testnet state
|
|
||||||
|
|
||||||
- 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
|
|
||||||
```
|
|
||||||
|
|
||||||
- Fetch the stack in machine where the testnet chain node is running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run script to export state from testnet chain:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
~/cerc/laconicd-stack/scripts/export-testnet-state.sh <absolute-path-to-testnet-deployment>
|
|
||||||
```
|
|
||||||
|
|
||||||
- The compressed gzip will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.gz`
|
|
||||||
|
|
||||||
## Generate mainnet genesis file
|
|
||||||
|
|
||||||
- If mainnet node is to be setup in a new machine, fetch the stack again:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
- Copy over compressed `testnet-state.gz` file to target machine
|
|
||||||
|
|
||||||
- Extract the testnet-state JSON file
|
|
||||||
|
|
||||||
```
|
|
||||||
gzip -dc <path-to-compressed-file>/testnet-state.gz > testnet-state.json
|
|
||||||
|
|
||||||
# Remove zip folder
|
|
||||||
rm -rf <path-to-compressed-file>/testnet-state.gz
|
|
||||||
```
|
|
||||||
|
|
||||||
- Generate LPS lockup distribution JSON file
|
|
||||||
|
|
||||||
```bash
|
|
||||||
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-file-path>" -d "<destination-folder-for-json-file>"
|
|
||||||
```
|
|
||||||
|
|
||||||
- This will generate the `distribution.json` file
|
|
||||||
|
|
||||||
- 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>
|
|
||||||
```
|
|
||||||
|
|
||||||
- Copy the example variables file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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 "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
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# List files in output directory - genesis.json and staking-amount.json
|
|
||||||
ls -l output
|
|
||||||
```
|
|
||||||
|
|
||||||
## Setup node
|
## Setup node
|
||||||
|
|
||||||
|
- Run the following steps in the machine where the mainnet node is to be setup
|
||||||
|
|
||||||
- Copy the example variables file if not already done:
|
- Copy the example variables file if not already done:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -104,16 +20,6 @@
|
|||||||
- Update `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
|
- Update `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 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
|
|
||||||
# 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
|
# Set custom moniker for the node
|
||||||
cerc_moniker: "LaconicMainnetNode"
|
cerc_moniker: "LaconicMainnetNode"
|
||||||
|
|
||||||
@ -132,12 +38,22 @@
|
|||||||
export MAINNET_DEPLOYMENT_DIR=
|
export MAINNET_DEPLOYMENT_DIR=
|
||||||
```
|
```
|
||||||
|
|
||||||
- Run ansible playbook to submit gentx and setup the node:
|
- Run ansible playbook to setup the node:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/setup-first-validator.yml
|
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/setup-first-validator.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Get the public key of your node:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -it \
|
||||||
|
-v ./$MAINNET_DEPLOYMENT_DIR/data/laconicd-data:/root/.laconicd \
|
||||||
|
cerc/laconicd:local bash -c "laconicd tendermint show-validator"
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: This public key is required in next step to generate the genesis file
|
||||||
|
|
||||||
### Setup TMKMS (Optional but Recommended)
|
### Setup TMKMS (Optional but Recommended)
|
||||||
|
|
||||||
<!-- Reference: https://docs.osmosis.zone/osmosis-core/keys/tmkms/#setup-tmkms -->
|
<!-- Reference: https://docs.osmosis.zone/osmosis-core/keys/tmkms/#setup-tmkms -->
|
||||||
@ -156,6 +72,7 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Update the TMKMS configuration file `$TMKMS_HOME/tmkms.toml`:
|
- Update the TMKMS configuration file `$TMKMS_HOME/tmkms.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[chain]]
|
[[chain]]
|
||||||
id = "laconic-mainnet"
|
id = "laconic-mainnet"
|
||||||
@ -198,22 +115,26 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Start TMKMS:
|
- Start TMKMS:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
tmkms start --config $TMKMS_HOME/tmkms.toml
|
tmkms start --config $TMKMS_HOME/tmkms.toml
|
||||||
```
|
```
|
||||||
|
|
||||||
- Expected example output:
|
- Expected example output:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
INFO tmkms::commands::start: tmkms 0.14.0 starting up...
|
INFO tmkms::commands::start: tmkms 0.14.0 starting up...
|
||||||
INFO tmkms::keyring: [keyring:softsign] added consensus Ed25519 key: {"@type":"/cosmos.crypto.ed25519.PubKey","key":"T24No1A1FmetNRVCOSg2G2XAKWh97oBXuELdAD6DFgw="}
|
INFO tmkms::keyring: [keyring:softsign] added consensus Ed25519 key: {"@type":"/cosmos.crypto.ed25519.PubKey","key":"T24No1A1FmetNRVCOSg2G2XAKWh97oBXuELdAD6DFgw="}
|
||||||
INFO tmkms::connection::tcp: KMS node ID: 7f5fd8dae8953e964e7e56edd4700f597ea0d45c
|
INFO tmkms::connection::tcp: KMS node ID: 7f5fd8dae8953e964e7e56edd4700f597ea0d45c
|
||||||
ERROR tmkms::client: [laconic-mainnet@tcp://localhost:26659] I/O error: Connection refused (os error 111)
|
ERROR tmkms::client: [laconic-mainnet@tcp://localhost:26659] I/O error: Connection refused (os error 111)
|
||||||
```
|
```
|
||||||
|
|
||||||
NOTE: The errors dissapear once the laconicd node starts
|
NOTE: The errors dissapear once the laconicd node starts
|
||||||
|
|
||||||
- Note the pubkey logged at start for comparing later with validator pubkey on chain
|
- Note the pubkey logged at start for comparing later with validator pubkey on chain
|
||||||
|
|
||||||
- Enable TMKMS in the laconicd node configuration:
|
- Enable TMKMS in the laconicd node configuration:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Set TMKMS_ENABLED to true in the node's config.env
|
# Set TMKMS_ENABLED to true in the node's config.env
|
||||||
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
|
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
|
||||||
@ -227,9 +148,119 @@
|
|||||||
|
|
||||||
NOTE: Store it safely offline in case of an emergency
|
NOTE: Store it safely offline in case of an emergency
|
||||||
|
|
||||||
|
## Export testnet state
|
||||||
|
|
||||||
|
- Run the following steps in machine where the testnet node is running
|
||||||
|
|
||||||
|
- 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
|
||||||
|
```
|
||||||
|
|
||||||
|
- Fetch the stack in machine where the testnet chain node is running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||||
|
```
|
||||||
|
|
||||||
|
- Run script to export state from testnet chain:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/cerc/laconicd-stack/scripts/export-testnet-state.sh <absolute-path-to-testnet-deployment>
|
||||||
|
```
|
||||||
|
|
||||||
|
- The compressed gzip will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.gz`
|
||||||
|
|
||||||
|
## Generate mainnet genesis file
|
||||||
|
|
||||||
|
- Run the following steps in secure machine separate from the one where the node is setup
|
||||||
|
|
||||||
|
- Fetch the stack:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||||
|
```
|
||||||
|
|
||||||
|
- Copy over compressed `testnet-state.gz` file
|
||||||
|
|
||||||
|
- Extract the testnet-state JSON file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gzip -dc <path-to-compressed-file>/testnet-state.gz > testnet-state.json
|
||||||
|
|
||||||
|
# Remove zip folder
|
||||||
|
rm -rf <path-to-compressed-file>/testnet-state.gz
|
||||||
|
```
|
||||||
|
|
||||||
|
- Generate LPS lockup distribution JSON file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-file-path>" -d "<destination-folder-for-json-file>"
|
||||||
|
```
|
||||||
|
|
||||||
|
- This will generate the `distribution.json` file
|
||||||
|
|
||||||
|
- 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>
|
||||||
|
|
||||||
|
# Parent directory where the deployment directory will live
|
||||||
|
export DATA_DIRECTORY=
|
||||||
|
|
||||||
|
# Set mainnet deployment directory
|
||||||
|
# for eg: mainnet-laconicd-deployment
|
||||||
|
export MAINNET_DEPLOYMENT_DIR=
|
||||||
|
```
|
||||||
|
|
||||||
|
- Copy the example variables file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
- Edit `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Use the public key exported in previous step (make sure to wrap it with single quotes [''])
|
||||||
|
validator_pub_key: '<public-key-of-your-node>'
|
||||||
|
```
|
||||||
|
|
||||||
|
- 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 "lps_distribution_path=$LPS_DISTRIBUTION_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
|
||||||
|
```
|
||||||
|
|
||||||
|
- Input private key of the existing account that was exported in previous steps when prompted
|
||||||
|
|
||||||
|
- Genesis file will be generated in output directory along with a file specifying the staking amount
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List files in output directory - genesis.json and staking-amount.json
|
||||||
|
ls -l output
|
||||||
|
```
|
||||||
|
|
||||||
## Run node
|
## Run node
|
||||||
|
|
||||||
- Command to run node
|
- Copy the genesis file to the mainnet deployment tmp directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp <absolute-path-to-genesis-json> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/tmp/genesis.json
|
||||||
|
```
|
||||||
|
|
||||||
|
- Command to run node:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
|
||||||
@ -241,9 +272,10 @@
|
|||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
||||||
```
|
```
|
||||||
|
|
||||||
- If TMKMS has been configured verify that validator and TMKMS pubkeys match
|
- If TMKMS has been configured verify that validator and TMKMS pubkeys match:
|
||||||
|
|
||||||
- Get validator pubkey on chain
|
- Get validator pubkey on chain
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Check consensus_pubkey in output
|
# Check consensus_pubkey in output
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators -o json | jq .validators'
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators -o json | jq .validators'
|
||||||
|
@ -3,6 +3,4 @@ cerc_chain_id: "laconic-mainnet"
|
|||||||
min_gas_price: 0.001
|
min_gas_price: 0.001
|
||||||
cerc_loglevel: "info"
|
cerc_loglevel: "info"
|
||||||
key_name: "laconic-validator"
|
key_name: "laconic-validator"
|
||||||
pvt_key: ""
|
validator_pub_key: ''
|
||||||
genesis_file: ""
|
|
||||||
staking_amount_file: ""
|
|
||||||
|
@ -3,13 +3,24 @@
|
|||||||
hosts: localhost
|
hosts: localhost
|
||||||
vars_files:
|
vars_files:
|
||||||
- first-validator-vars.yml
|
- first-validator-vars.yml
|
||||||
|
vars:
|
||||||
|
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
|
||||||
|
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
|
||||||
|
spec_file: "{{data_directory}}/laconicd-spec.yml"
|
||||||
connection: local
|
connection: local
|
||||||
tasks:
|
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: Fetch repositories
|
- name: Fetch repositories
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull"
|
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull"
|
||||||
|
|
||||||
# TODO: Add a playbook flag to control force rebuild
|
# TODO: Add a flag to control force rebuild
|
||||||
- name: Build containers
|
- name: Build containers
|
||||||
ansible.builtin.shell:
|
ansible.builtin.shell:
|
||||||
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild"
|
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild"
|
||||||
@ -43,3 +54,65 @@
|
|||||||
- name: Display staking-amount file location
|
- name: Display staking-amount file location
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Staking amount written to output/staking-amount.json"
|
msg: "Staking amount written to output/staking-amount.json"
|
||||||
|
|
||||||
|
- name: Create deployment spec file
|
||||||
|
shell: |
|
||||||
|
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
|
||||||
|
|
||||||
|
- name: Create deployment from spec file
|
||||||
|
shell: |
|
||||||
|
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy create --spec-file {{ spec_file }} --deployment-dir {{data_directory}}/{{ mainnet_deployment_dir }}
|
||||||
|
|
||||||
|
- name: Ensure tmp directory exists inside laconicd-data
|
||||||
|
file:
|
||||||
|
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
|
||||||
|
- name: Copy staking amount file to laconicd-data tmp directory
|
||||||
|
copy:
|
||||||
|
src: "{{ lookup('env', 'PWD') }}/output/staking-amount.json"
|
||||||
|
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: "{{ lookup('env', 'PWD') }}/output/genesis.json"
|
||||||
|
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Prompt for validator private key
|
||||||
|
vars:
|
||||||
|
private_key_prompt: "Please enter your validator private key: "
|
||||||
|
pause:
|
||||||
|
prompt: "{{ private_key_prompt }}"
|
||||||
|
echo: no
|
||||||
|
register: private_key_input
|
||||||
|
|
||||||
|
- name: Fail if private key is not provided
|
||||||
|
fail:
|
||||||
|
msg: "Private key is required for creating the gentx."
|
||||||
|
when: private_key_input.user_input | default('') | trim == ''
|
||||||
|
|
||||||
|
- name: Run script to create and collect gentx
|
||||||
|
shell: |
|
||||||
|
docker run -i \
|
||||||
|
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
|
||||||
|
-v {{data_directory}}/{{ mainnet_deployment_dir }}/config/mainnet-laconicd:/scripts \
|
||||||
|
-e "PVT_KEY={{ private_key_input.user_input }}" \
|
||||||
|
-e "KEY_NAME={{ key_name }}" \
|
||||||
|
-e "CERC_MONIKER={{ cerc_moniker }}" \
|
||||||
|
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
|
||||||
|
-e "VALIDATOR_PUB_KEY={{ validator_pub_key | to_json }}" \
|
||||||
|
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh"
|
||||||
|
|
||||||
|
- name: Update genesis file in output
|
||||||
|
copy:
|
||||||
|
src: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/config/genesis.json"
|
||||||
|
dest: "{{ lookup('env', 'PWD') }}/output/genesis.json"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
|
- name: Clear tmp directory
|
||||||
|
file:
|
||||||
|
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
|
||||||
|
state: absent
|
||||||
|
@ -56,39 +56,3 @@
|
|||||||
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
||||||
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
||||||
mode: '0777'
|
mode: '0777'
|
||||||
|
|
||||||
- name: Ensure tmp directory exists inside laconicd-data
|
|
||||||
file:
|
|
||||||
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
|
|
||||||
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 }}"
|
|
||||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
|
||||||
mode: '0644'
|
|
||||||
|
|
||||||
- name: Fail if pvt_key is not set
|
|
||||||
fail:
|
|
||||||
msg: >-
|
|
||||||
Private key (pvt_key) is not set in first-validator-vars.yml.
|
|
||||||
This is required for creating the gentx.
|
|
||||||
when: not pvt_key
|
|
||||||
|
|
||||||
- name: Run script to create and collect gentx
|
|
||||||
shell: |
|
|
||||||
docker run -i \
|
|
||||||
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
|
|
||||||
-v {{data_directory}}/{{ mainnet_deployment_dir }}/config/mainnet-laconicd:/scripts \
|
|
||||||
-e "PVT_KEY={{ pvt_key }}" \
|
|
||||||
-e "KEY_NAME={{ key_name }}" \
|
|
||||||
-e "CERC_MONIKER={{ cerc_moniker }}" \
|
|
||||||
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
|
|
||||||
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh"
|
|
||||||
|
@ -4,6 +4,7 @@ set -e
|
|||||||
|
|
||||||
NODE_HOME=/root/.laconicd
|
NODE_HOME=/root/.laconicd
|
||||||
genesis_file_path=$NODE_HOME/config/genesis.json
|
genesis_file_path=$NODE_HOME/config/genesis.json
|
||||||
|
# TODO: Set to OS keyring backend
|
||||||
KEYRING="test"
|
KEYRING="test"
|
||||||
|
|
||||||
if [ -f "$genesis_file_path" ]; then
|
if [ -f "$genesis_file_path" ]; then
|
||||||
@ -21,6 +22,11 @@ if [ -z "$KEY_NAME" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$VALIDATOR_PUB_KEY" ]; then
|
||||||
|
echo "VALIDATOR_PUB_KEY environment variable not set, exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
input_genesis_file=$NODE_HOME/tmp/genesis.json
|
input_genesis_file=$NODE_HOME/tmp/genesis.json
|
||||||
if [ ! -f ${input_genesis_file} ]; then
|
if [ ! -f ${input_genesis_file} ]; then
|
||||||
echo "Genesis file not provided, exiting..."
|
echo "Genesis file not provided, exiting..."
|
||||||
@ -66,7 +72,7 @@ fi
|
|||||||
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
||||||
|
|
||||||
# Create gentx with staked amount equal to allocated balance
|
# Create gentx with staked amount equal to allocated balance
|
||||||
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING
|
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING --pubkey "$VALIDATOR_PUB_KEY"
|
||||||
|
|
||||||
# Collect the gentx and validate
|
# Collect the gentx and validate
|
||||||
laconicd genesis collect-gentxs
|
laconicd genesis collect-gentxs
|
||||||
@ -74,5 +80,5 @@ laconicd genesis validate
|
|||||||
|
|
||||||
chmod 777 $genesis_file_path
|
chmod 777 $genesis_file_path
|
||||||
|
|
||||||
# Update the input genesis file
|
# Clear tmp directory
|
||||||
cp $genesis_file_path $input_genesis_file
|
rm -rf $NODE_HOME/tmp
|
||||||
|
Loading…
Reference in New Issue
Block a user