Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
download-genesis
command (#2791)
Closes #2777 Note for reviewers: I'd rather not backport this PR to v1.x b/c it's a new feature and not a bug fix. I wanted to have it ready in case ppl do want it on v1.x ## Testing Works for all 3 known networks. Complains on an unknown network ```shell $ ./build/celestia-appd download-genesis mocha-4 Downloading genesis file for mocha-4 to /Users/rootulp/.celestia-app/config/genesis.json Downloaded genesis file for mocha-4 to /Users/rootulp/.celestia-app/config/genesis.json SHA-256 hash verified for mocha-4 $ ./build/celestia-appd download-genesis celestia Downloading genesis file for celestia to /Users/rootulp/.celestia-app/config/genesis.json Downloaded genesis file for celestia to /Users/rootulp/.celestia-app/config/genesis.json SHA-256 hash verified for celestia $ ./build/celestia-appd download-genesis arabica-10 Downloading genesis file for arabica-10 to /Users/rootulp/.celestia-app/config/genesis.json Downloaded genesis file for arabica-10 to /Users/rootulp/.celestia-app/config/genesis.json SHA-256 hash verified for arabica-10 $ ./build/celestia-appd download-genesis foo Error: unknown chain-id: foo. Must be: celestia, mocha-4, or arabica-10. ``` I verified the chain ID actually differs for each file: ```shell $ ./build/celestia-appd download-genesis mocha-4 && cat ~/.celestia-app/config/genesis.json | jq ."chain_id" Downloading genesis file for mocha-4 to /Users/rootulp/.celestia-app/config/genesis.json Downloaded genesis file for mocha-4 to /Users/rootulp/.celestia-app/config/genesis.json SHA-256 hash verified for mocha-4 "mocha-4" $ ./build/celestia-appd download-genesis celestia && cat ~/.celestia-app/config/genesis.json | jq ."chain_id" Downloading genesis file for celestia to /Users/rootulp/.celestia-app/config/genesis.json Downloaded genesis file for celestia to /Users/rootulp/.celestia-app/config/genesis.json SHA-256 hash verified for celestia "celestia" ``` I tampered with the hard-coded Arabica hash and it correctly identified the mismatch: ```shell $ ./build/celestia-appd download-genesis arabica-10 Downloading genesis file for arabica-10 to /Users/rootulp/.celestia-app/config/genesis.json Downloaded genesis file for arabica-10 to /Users/rootulp/.celestia-app/config/genesis.json Error: sha256 hash mismatch: got fad0a187669f7a2c11bb07f9dc27140d66d2448b7193e186312713856f28e3e1, expected fad0a187669f7a2c11bb07f9dc27140d66d2448b7193e186312713856f28e3e2 ``` --------- Co-authored-by: Sanaz Taheri <[email protected]>
- Loading branch information