Fix script to create validator in subsequent nodes
This commit is contained in:
parent
77d3a832a7
commit
80acf3c745
@ -129,12 +129,18 @@
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query bond list'
|
||||
```
|
||||
|
||||
## Publish Genesis File and Node Address
|
||||
## Publish required artifacts
|
||||
|
||||
- Copy the genesis file to [genesis](./genesis) folder:
|
||||
- Copy the genesis file to [config](./config) folder:
|
||||
|
||||
```bash
|
||||
sudo cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ~/cerc/laconicd-stack/genesis/mainnet-genesis.json
|
||||
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:
|
||||
@ -145,4 +151,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
|
||||
|
||||
@ -33,7 +33,10 @@
|
||||
|
||||
```bash
|
||||
# Path to the genesis file published by the first validator
|
||||
genesis_file: "~/cerc/laconicd-stack/genesis/mainnet-genesis.json"
|
||||
genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json"
|
||||
|
||||
# Path to the staking amount file published by the first validator
|
||||
staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"
|
||||
|
||||
# Set custom moniker for the node
|
||||
cerc_moniker: "LaconicMainnetNode"
|
||||
|
||||
@ -27,4 +27,4 @@
|
||||
|
||||
- name: Run create-validator script
|
||||
shell: |
|
||||
laconic-so deployment --dir {{ data_directory }}/{{ deployment_dir }} exec laconicd "export KEY_NAME={{ key_name }} ~/cerc/laconicd-stack/scripts/create-validator.sh"
|
||||
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 }}"
|
||||
|
||||
@ -2,5 +2,6 @@ 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_peers: ""
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DENOM=alnt
|
||||
|
||||
NODE_HOME=/root/.laconicd
|
||||
|
||||
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
|
||||
|
||||
# Set staking amount
|
||||
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
||||
|
||||
# Create validator with fixed parameters
|
||||
laconicd tx staking create-validator \
|
||||
--amount $stake_amount$DENOM \
|
||||
--pubkey $(laconicd tendermint show-validator) \
|
||||
--moniker "$CERC_MONIKER" \
|
||||
--chain-id "$CERC_CHAIN_ID" \
|
||||
--commission-rate 0.0 \
|
||||
--commission-max-rate 0.0 \
|
||||
--commission-max-change-rate 0.0 \
|
||||
--min-self-delegation 1 \
|
||||
--gas auto \
|
||||
--gas-adjustment 1.5 \
|
||||
--gas-prices $MIN_GAS_PRICE$DENOM \
|
||||
--from $KEY_NAME \
|
||||
--yes
|
||||
@ -12,7 +12,7 @@ services:
|
||||
volumes:
|
||||
- laconicd-data:/root/.laconicd
|
||||
- ../config/mainnet-laconicd/run-laconicd.sh:/opt/run-laconicd.sh
|
||||
- ../../scripts/create-validator.sh:/scripts/create-validator.sh
|
||||
- ../config/mainnet-laconicd/create-validator.sh:/scripts/create-validator.sh
|
||||
ports:
|
||||
- "6060"
|
||||
- "26657"
|
||||
|
||||
40
stack-orchestrator/config/mainnet-laconicd/create-validator.sh
Executable file
40
stack-orchestrator/config/mainnet-laconicd/create-validator.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/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
|
||||
|
||||
# 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
|
||||
Loading…
Reference in New Issue
Block a user