-
Notifications
You must be signed in to change notification settings - Fork 20.9k
cmd/geth, internal/era/eradl: add era1 downloader tool #31823
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
Conversation
We already have the URLs defined in checksums.txt, might as well use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good to me, just a couple nits.
} | ||
// Shortcut if already downloaded. | ||
if verifyHash(dstPath, hash) == nil { | ||
fmt.Printf("%s is up-to-date\n", dstPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("%s is up-to-date\n", dstPath) | |
log.Printf("%s is up-to-date\n", dstPath) |
return nil | ||
} | ||
|
||
fmt.Printf("%s is stale\n", dstPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("%s is stale\n", dstPath) | |
log.Printf("%s is stale\n", dstPath) |
} | ||
|
||
fmt.Printf("%s is stale\n", dstPath) | ||
fmt.Printf("downloading from %s\n", url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Printf("downloading from %s\n", url) | |
log.Printf("downloading from %s\n", url) |
I have decided to address your comments about logging the other way, by removing uses of package "log". The download output is just supposed to go straight to stdout, with package log it goes to stderr. |
This adds a geth subcommand for downloading era1 files and placing them into the correct location. The tool can be used even while geth is already running on the datadir. Downloads are checked against a hard-coded list of checksums for mainnet and sepolia. ``` ./geth download-era --server $SERVER --block 333333 ./geth download-era --server $SERVER --block 333333-444444 ./geth download-era --server $SERVER --epoch 0-10 ./geth download-era --server $SERVER --all ``` The implementation reuses the file downloader we already had for fetching build tools. I've done some refactoring on it to make sure it can support the new use case, and there are some changes to the build here as well.
This adds a subcommand for downloading era1 files and placing them into the correct location.
The tool can be used even while geth is already running on the datadir.
Downloads are checked against a hard-coded list of checksums for mainnet and sepolia.
The implementation reuses the file downloader we already had for fetching build tools. I've done some refactoring on it to make sure it can support the new use case, and there are some changes to the build here as well.