Use zstd to compress testnet state file #12

Merged
nabarun merged 1 commits from iv-use-zstd into main 2025-06-09 08:51:39 +00:00
3 changed files with 14 additions and 14 deletions

View File

@ -9,13 +9,13 @@
```bash ```bash
cargo install tmkms --features=softsign --version=0.14.0 cargo install tmkms --features=softsign --version=0.14.0
``` ```
- Install `gzip` using `sudo apt install gzip` - Install `zstd` using `sudo apt install zstd`
- testnet-state.gz ([exported testnet state](./run-first-validator.md#export-testnet-state)) - testnet-state.zst ([exported testnet state](./run-first-validator.md#export-testnet-state))
- LPS distribution Google spreadsheet URL or CSV file path - LPS distribution Google spreadsheet URL or CSV file path
## Steps ## Steps
- In current working directory demo, keep exported `testnet-state.gz` file from prerequisites - In current working directory demo, keep exported `testnet-state.zst` file from prerequisites
- Fetch stack: - Fetch stack:
@ -40,10 +40,10 @@
- Extract the testnet-state JSON file - Extract the testnet-state JSON file
``` ```
gzip -dc $CWD/testnet-state.gz > $CWD/testnet-state.json zstd -dc $CWD/testnet-state.zst > $CWD/testnet-state.json
# Remove zip folder # Remove zst folder
rm -rf testnet-state.gz rm -rf testnet-state.zst
``` ```
- Set envs: - Set envs:

View File

@ -5,7 +5,7 @@
- [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)
- LPS distribution Google spreadsheet URL or CSV file path - LPS distribution Google spreadsheet URL or CSV file path
- Install `gzip` using `sudo apt install gzip` - Install `zstd` using `sudo apt install zstd`
## Export testnet state ## Export testnet state
@ -35,7 +35,7 @@
~/cerc/laconicd-stack/scripts/export-testnet-state.sh <absolute-path-to-testnet-deployment> ~/cerc/laconicd-stack/scripts/export-testnet-state.sh <absolute-path-to-testnet-deployment>
``` ```
- The compressed gzip will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.gz` - The compressed zst file will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.zst`
## Generate mainnet genesis file ## Generate mainnet genesis file
@ -45,15 +45,15 @@
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
``` ```
- Copy over compressed `testnet-state.gz` file to target machine - Copy over compressed `testnet-state.zst` file to target machine
- Extract the testnet-state JSON file - Extract the testnet-state JSON file
``` ```
gzip -dc <path-to-compressed-file>/testnet-state.gz > testnet-state.json zstd -dc <path-to-compressed-file>/testnet-state.zst > testnet-state.json
# Remove zip folder # Remove zst folder
rm -rf <path-to-compressed-file>/testnet-state.gz rm -rf <path-to-compressed-file>/testnet-state.zst
``` ```
- Generate LPS lockup distribution JSON file - Generate LPS lockup distribution JSON file

View File

@ -19,10 +19,10 @@ OUTPUT_DIR=${TESTNET_DEPLOYMENT_DIR}/export
mkdir -p $OUTPUT_DIR mkdir -p $OUTPUT_DIR
# Export state from testnet chain # Export state from testnet chain
testnet_state_file="$OUTPUT_DIR/testnet-state.gz" testnet_state_file="$OUTPUT_DIR/testnet-state.zst"
docker run -it \ docker run -it \
-v ${TESTNET_DEPLOYMENT_DIR}/data/laconicd-data:/root/testnet-deployment/.laconicd \ -v ${TESTNET_DEPLOYMENT_DIR}/data/laconicd-data:/root/testnet-deployment/.laconicd \
cerc/laconicd:local bash -c "laconicd export --home /root/testnet-deployment/.laconicd" \ cerc/laconicd:local bash -c "laconicd export --home /root/testnet-deployment/.laconicd" \
| jq | gzip > "$testnet_state_file" | jq | zstd > "$testnet_state_file"
echo "Exported state from testnet to $testnet_state_file" echo "Exported state from testnet to $testnet_state_file"