-
Notifications
You must be signed in to change notification settings - Fork 289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have a default way to download genesis files #2777
Comments
This seems like a decent point in the tradeoff space. |
I agree with just adding support to download the genesis when |
I briefly explored adding this to the |
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 <35961250+staheri14@users.noreply.github.com>
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 <35961250+staheri14@users.noreply.github.com> (cherry picked from commit c34a93d) # Conflicts: # cmd/celestia-appd/cmd/root.go
Closes celestiaorg/celestia-app#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 <35961250+staheri14@users.noreply.github.com>
It would be nice if users have to spend less time thinking about which genesis they download and install.
As pointed out in a sync discussion, osmosis acheives this by including the genesis in the binary. This is a good simple option, as users likely have to download the mainnet genesis anyway.
Another option would be to hardcode the hashes of the genesis for each live network in the binary, and add a subcommand that would download, verify the hash of, and then install the genesis of a specific network.
The text was updated successfully, but these errors were encountered: