Fix create and collect gentx script
This commit is contained in:
parent
f315858479
commit
f07aa1a766
@ -22,17 +22,18 @@
|
||||
Required key files are not defined.
|
||||
Please set genesis_file in run-first-validator-vars.yml.
|
||||
when: not genesis_file
|
||||
- name: Fetch laconicd stack
|
||||
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||
|
||||
- name: Setup required repositories
|
||||
shell: >
|
||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
|
||||
setup-repositories --git-ssh --pull
|
||||
# - name: Fetch laconicd stack
|
||||
# shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||
|
||||
- name: Build container images
|
||||
shell: |
|
||||
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
|
||||
# - name: Setup required repositories
|
||||
# shell: >
|
||||
# laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
|
||||
# setup-repositories --git-ssh --pull
|
||||
|
||||
# - name: Build container images
|
||||
# shell: |
|
||||
# laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
|
||||
|
||||
- name: Create deployment spec file
|
||||
shell: |
|
||||
@ -80,7 +81,7 @@
|
||||
|
||||
- name: Run script to create and collect gentx
|
||||
shell: |
|
||||
docker run -it \
|
||||
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 }}" \
|
||||
|
@ -4,6 +4,7 @@ set -e
|
||||
|
||||
NODE_HOME=/root/.laconicd
|
||||
genesis_file_path=$NODE_HOME/config/genesis.json
|
||||
KEYRING="test"
|
||||
|
||||
if [ -f "$genesis_file_path" ]; then
|
||||
echo "Genesis file already created, exiting..."
|
||||
@ -44,17 +45,20 @@ laconicd init $MONIKER --chain-id=$CHAIN_ID --home $NODE_HOME
|
||||
cp $input_genesis_file $genesis_file_path
|
||||
|
||||
# Import private key passed via PVT_KEY
|
||||
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY"
|
||||
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY" --keyring-backend $KEYRING
|
||||
|
||||
account_address=$(laconicd keys list | awk -v key_name="$KEY_NAME" '
|
||||
$1 == "- address:" {addr=$3}
|
||||
$1 == "name:" && $2 == key_name {print addr; exit}
|
||||
')
|
||||
account_address=$(laconicd keys show "$KEY_NAME" --keyring-backend "$KEYRING" | grep 'address:' | awk -F': ' '{print $2}' | xargs)
|
||||
|
||||
if [ -z "$account_address" ]; then
|
||||
echo "Failed to get account address for key name $KEY_NAME, exiting..."
|
||||
laconicd keys list --keyring-backend $KEYRING
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stake_amount=$(jq -r --arg address "$account_address" --arg denom "$DENOM" '.app_state.bank.balances[] | select(.address == $address) | .coins[] | select(.denom == $denom) | .amount' $genesis_file_path)
|
||||
|
||||
# Create gentx with staked amount equal to allocated balance
|
||||
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID
|
||||
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING
|
||||
|
||||
# Collect the gentx and validate
|
||||
laconicd genesis collect-gentxs
|
||||
|
@ -29,13 +29,13 @@ if [ -z "$(ls -A "$NODE_HOME/data")" ]; then
|
||||
# Init node
|
||||
echo "Initializing a new laconicd node with moniker $CERC_MONIKER and chain id $CERC_CHAIN_ID"
|
||||
laconicd init $CERC_MONIKER --chain-id=$CERC_CHAIN_ID --home $NODE_HOME
|
||||
|
||||
# Use provided config files
|
||||
cp $input_genesis_file $NODE_HOME/config/genesis.json
|
||||
else
|
||||
echo "Node data dir $NODE_HOME/data already exists, skipping initialization..."
|
||||
fi
|
||||
|
||||
# Use provided config files
|
||||
cp $input_genesis_file $NODE_HOME/config/genesis.json
|
||||
|
||||
# Enable cors
|
||||
sed -i 's/cors_allowed_origins.*$/cors_allowed_origins = ["*"]/' $NODE_HOME/config/config.toml
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user