Add playbook to generate mainnet genesis from exported testnet state

This commit is contained in:
Nabarun 2025-05-14 20:19:40 +05:30
parent be5258c732
commit 6c8898e6e7
2 changed files with 36 additions and 19 deletions

View File

@ -0,0 +1,31 @@
---
- name: Generate Mainnet Genesis File
hosts: localhost
connection: local
tasks:
- name: Fetch repositories
ansible.builtin.shell:
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull"
- name: Build containers
ansible.builtin.shell:
cmd: "~/cerc/laconicd-stack/stack-orchestrator/laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers"
- name: Copy exported testnet state file
ansible.builtin.copy:
src: "{{ exported_state_path }}"
dest: "~/cerc/laconicd-stack/testnet-state.json"
remote_src: true # Set to true if exported_state_path is on the target host
- name: Run script to generate genesis file
ansible.builtin.shell:
cmd: "~/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh ~/cerc/laconicd-stack/testnet-state.json"
- name: Remove temporary copied state file
ansible.builtin.file:
path: "~/cerc/laconicd-stack/testnet-state.json"
state: absent
- name: Display genesis file location
ansible.builtin.debug:
msg: "Mainnet genesis file generated at output/genesis.json"

View File

@ -22,34 +22,20 @@
- The file will be generated in `<path-to-testnet-deployment>/export/testnet-state.json`
<!-- TODO: Create playbook to run steps below -->
- If mainnet node will be setup in new machine, fetch the stack again
- Build container image
```bash
# Fetch laconicd repo specified in stack
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull
# Build image
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
- Copy the generated exported state from earlier
- Copy over the exported `testnet-state.json` file to target machine
- Run playbook to use exported state for generating mainnet genesis
```bash
cp <path-to-exported-testnet-state> ~/cerc/laconicd-stack/testnet-state.json
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/generate-genesis.yml -e "exported_state_path=<path-to-exported-testnet-state>"
```
- Run script to generate genesis file using the exported state
```bash
~/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh ~/cerc/laconicd-stack/testnet-state.json
```
- Genesis file will generated in `output/genesis.json`
## Run node
- Update [run-first-validator-vars.yml](playbooks/first-validator/run-first-validator-vars.yml) with required values: