Skip to content

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

Merged
merged 16 commits into from
May 15, 2025
Merged

Conversation

fjl
Copy link
Contributor

@fjl fjl commented May 13, 2025

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.

SERVER=https://mainnet.era1.nimbus.team
./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.

@fjl fjl requested a review from lightclient as a code owner May 13, 2025 22:02
lightclient
lightclient previously approved these changes May 15, 2025
Copy link
Member

@lightclient lightclient left a 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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Printf("downloading from %s\n", url)
log.Printf("downloading from %s\n", url)

@fjl
Copy link
Contributor Author

fjl commented May 15, 2025

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.

@fjl fjl changed the title internal/era/eradl: add era1 downloader tool cmd/geth, internal/era/eradl: add era1 downloader tool May 15, 2025
@fjl fjl merged commit 3ceec0e into ethereum:master May 15, 2025
3 of 4 checks passed
@fjl fjl added this to the 1.15.12 milestone May 15, 2025
Dargon789 pushed a commit to Dargon789/go-ethereum that referenced this pull request May 27, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants