Update playbook for subsequent validator nodes to decompress published genesis file #29

Merged
nabarun merged 1 commits from ng-uncompress-genesis into main 2025-06-18 22:31:33 +00:00
7 changed files with 54 additions and 26 deletions

View File

@ -18,7 +18,7 @@
- Following tools are required in all machines: - 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) - [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)

View File

@ -18,7 +18,7 @@
- [ansible](playbooks/README.md#ansible-installation) - [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 - Machine 3: Where the create-validator transaction is to be signed

View File

@ -79,16 +79,29 @@
when: private_key_input.user_input | default('') | trim == '' when: private_key_input.user_input | default('') | trim == ''
- name: Run script to create and collect gentx - name: Run script to create and collect gentx
shell: | command:
docker run -i \ argv:
-v {{gentx_genesis_dir}}:/root/generate-gentx-genesis \ - docker
-v ~/cerc/laconicd-stack/stack-orchestrator/config/mainnet-laconicd:/scripts \ - run
-e "PVT_KEY={{ private_key_input.user_input }}" \ - -i
-e "KEY_NAME={{ key_name }}" \ - -v
-e "CERC_MONIKER={{ cerc_moniker }}" \ - "{{ gentx_genesis_dir }}:/root/generate-gentx-genesis"
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \ - -v
-e "VALIDATOR_PUB_KEY={{ validator_pub_key | to_json }}" \ - "~/cerc/laconicd-stack/stack-orchestrator/config/mainnet-laconicd:/scripts"
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh" - -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 - name: Update genesis file in output
copy: copy:

View File

@ -72,13 +72,26 @@
state: directory state: directory
mode: '0755' 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 when: not BUILD_ONLY
copy: copy:
src: "{{ genesis_file }}" 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' 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 - name: Initialize laconicd node
when: not BUILD_ONLY when: not BUILD_ONLY
shell: | shell: |

View File

@ -26,7 +26,7 @@ min_gas_price: 0.001
cerc_loglevel: "info" cerc_loglevel: "info"
# Absolute path to the mainnet genesis.json file # 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 # Absolute path to the staking-amount.json file
staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json" staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"

View File

@ -73,33 +73,35 @@ def convert_csv_to_json(csv_path, json_path):
if col not in df.columns: if col not in df.columns:
raise Exception(f'Missing required column: {col}') raise Exception(f'Missing required column: {col}')
result = {} result = []
for _, row in df.iterrows(): for _, row in df.iterrows():
placeholder = str(row[PLACEHOLDER_COLUMN]) if not pd.isna(row[PLACEHOLDER_COLUMN]) else '' 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 '' 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 # 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 # Skip the row if both 'Placeholder' and 'Laconic Address' are missing or invalid
if not key or key.lower() == 'nan': if not key or key.lower() == 'nan':
continue continue
# If key is the laconic address, validate that it's a valid bech32 address # If key is the laconic address, validate that it's a valid bech32 address
if key == laconic_address: # if key == laconic_address:
hrp, data = bech32_decode(laconic_address) # hrp, data = bech32_decode(laconic_address)
if hrp is None or data is None or not hrp.startswith("laconic"): # if hrp is None or data is None or not hrp.startswith("laconic"):
print(f"Skipping invalid Laconic address: {laconic_address}") # print(f"Skipping invalid Laconic address: {laconic_address}")
continue # continue
entry = { 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]), '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, '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, '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
} }
result[key] = entry result.append(entry)
with open(json_path, 'w') as f: with open(json_path, 'w') as f:
json.dump(result, f, indent=2) json.dump(result, f, indent=2)

View File

@ -2,7 +2,7 @@ version: "1.0"
name: mainnet-laconicd name: mainnet-laconicd
description: "Laconicd full node" description: "Laconicd full node"
repos: repos:
- git.vdb.to/cerc-io/laconicd@v1.0.0 - git.vdb.to/cerc-io/laconicd@v1.0.1
containers: containers:
- cerc/laconicd - cerc/laconicd
pods: pods: