Update playbook for subsequent validator nodes to decompress published genesis file
This commit is contained in:
parent
ab977c6237
commit
e15d1a459f
@ -18,7 +18,7 @@
|
||||
|
||||
- Following tools are required in all machines:
|
||||
|
||||
- [ansible](playbooks/README.md#ansible-installation)
|
||||
- [ansible](../playbooks/README.md#ansible-installation)
|
||||
|
||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
- [ansible](playbooks/README.md#ansible-installation)
|
||||
|
||||
- Mainnet genesis file in [config](./config) folder
|
||||
- Install `zstd` using `sudo apt install zstd`
|
||||
|
||||
- Machine 3: Where the create-validator transaction is to be signed
|
||||
|
||||
|
@ -79,16 +79,29 @@
|
||||
when: private_key_input.user_input | default('') | trim == ''
|
||||
|
||||
- name: Run script to create and collect gentx
|
||||
shell: |
|
||||
docker run -i \
|
||||
-v {{gentx_genesis_dir}}:/root/generate-gentx-genesis \
|
||||
-v ~/cerc/laconicd-stack/stack-orchestrator/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"
|
||||
command:
|
||||
argv:
|
||||
- docker
|
||||
- run
|
||||
- -i
|
||||
- -v
|
||||
- "{{ gentx_genesis_dir }}:/root/generate-gentx-genesis"
|
||||
- -v
|
||||
- "~/cerc/laconicd-stack/stack-orchestrator/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 }}"
|
||||
- cerc/laconicd:local
|
||||
- bash
|
||||
- -c
|
||||
- "/scripts/create-and-collect-gentx.sh"
|
||||
|
||||
- name: Update genesis file in output
|
||||
copy:
|
||||
|
@ -72,13 +72,26 @@
|
||||
state: directory
|
||||
mode: '0755'
|
||||
|
||||
- name: Copy genesis file to laconicd-data tmp directory
|
||||
- name: Copy compressed genesis file to laconicd-data tmp directory
|
||||
when: not BUILD_ONLY
|
||||
copy:
|
||||
src: "{{ genesis_file }}"
|
||||
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
||||
dest: "{{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json.zst"
|
||||
mode: '0644'
|
||||
|
||||
- name: Decompress genesis file in tmp directory
|
||||
when: not BUILD_ONLY
|
||||
ansible.builtin.command:
|
||||
argv:
|
||||
- zstd
|
||||
- -d
|
||||
- "-f"
|
||||
- "{{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json.zst"
|
||||
- "-o"
|
||||
- "{{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
||||
args:
|
||||
creates: "{{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
|
||||
|
||||
- name: Initialize laconicd node
|
||||
when: not BUILD_ONLY
|
||||
shell: |
|
||||
|
@ -26,7 +26,7 @@ min_gas_price: 0.001
|
||||
cerc_loglevel: "info"
|
||||
|
||||
# Absolute path to the mainnet genesis.json file
|
||||
genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json"
|
||||
genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json.zst"
|
||||
|
||||
# Absolute path to the staking-amount.json file
|
||||
staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"
|
||||
|
@ -73,33 +73,35 @@ def convert_csv_to_json(csv_path, json_path):
|
||||
if col not in df.columns:
|
||||
raise Exception(f'Missing required column: {col}')
|
||||
|
||||
result = {}
|
||||
result = []
|
||||
for _, row in df.iterrows():
|
||||
placeholder = str(row[PLACEHOLDER_COLUMN]) if not pd.isna(row[PLACEHOLDER_COLUMN]) else ''
|
||||
laconic_address = str(row[LACONIC_ADDRESS_COLUMN]) if not pd.isna(row[LACONIC_ADDRESS_COLUMN]) else ''
|
||||
|
||||
# Use laconic_address as key if placeholder is missing or empty
|
||||
key = placeholder if placeholder and placeholder.lower() != 'nan' else laconic_address
|
||||
# key = placeholder if placeholder and placeholder.lower() != 'nan' else laconic_address
|
||||
key = laconic_address
|
||||
|
||||
# Skip the row if both 'Placeholder' and 'Laconic Address' are missing or invalid
|
||||
if not key or key.lower() == 'nan':
|
||||
continue
|
||||
|
||||
# If key is the laconic address, validate that it's a valid bech32 address
|
||||
if key == laconic_address:
|
||||
hrp, data = bech32_decode(laconic_address)
|
||||
if hrp is None or data is None or not hrp.startswith("laconic"):
|
||||
print(f"Skipping invalid Laconic address: {laconic_address}")
|
||||
continue
|
||||
# if key == laconic_address:
|
||||
# hrp, data = bech32_decode(laconic_address)
|
||||
# if hrp is None or data is None or not hrp.startswith("laconic"):
|
||||
# print(f"Skipping invalid Laconic address: {laconic_address}")
|
||||
# continue
|
||||
|
||||
entry = {
|
||||
'laconic_address': row[LACONIC_ADDRESS_COLUMN] if not pd.isna(row[LACONIC_ADDRESS_COLUMN]) else None,
|
||||
'placeholder': placeholder,
|
||||
'total_lps_allocation': to_number(row[TOTAL_LPS_ALLOCATION_COLUMN]),
|
||||
'lock_months': row[LOCK_MONTHS_COLUMN] if not pd.isna(row[LOCK_MONTHS_COLUMN]) else None,
|
||||
'vest_months': row[VEST_MONTHS_COLUMN] if not pd.isna(row[VEST_MONTHS_COLUMN]) else None,
|
||||
'laconic_address': row[LACONIC_ADDRESS_COLUMN] if not pd.isna(row[LACONIC_ADDRESS_COLUMN]) else None
|
||||
'vest_months': row[VEST_MONTHS_COLUMN] if not pd.isna(row[VEST_MONTHS_COLUMN]) else None
|
||||
}
|
||||
|
||||
result[key] = entry
|
||||
result.append(entry)
|
||||
|
||||
with open(json_path, 'w') as f:
|
||||
json.dump(result, f, indent=2)
|
||||
|
@ -2,7 +2,7 @@ version: "1.0"
|
||||
name: mainnet-laconicd
|
||||
description: "Laconicd full node"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/laconicd@v1.0.0
|
||||
- git.vdb.to/cerc-io/laconicd@v1.0.1
|
||||
containers:
|
||||
- cerc/laconicd
|
||||
pods:
|
||||
|
Loading…
Reference in New Issue
Block a user