-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: add command download
to download public node snapshots
#13598
base: main
Are you sure you want to change the base?
feat: add command download
to download public node snapshots
#13598
Conversation
CodSpeed Performance ReportMerging #13598 will not alter performanceComparing Summary
|
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.
Let's also maybe add a list of pre-set snapshot URLs so that the user doesn't need to find the URL themselves? And we can default to one of them, while the --help
menu shows alternatives/fallbacks?
What would you advise me to be able to fetch the same block height they are using in their url ? @matias-gonz @joshieDo My aim is to build a default "dynamic" url with the corresponding block height with this pattern : |
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.
Snapshots can be quite big (>2TB with an archival node).
The current PR would mean that we'd need double that space, since we're downloading everything first and then decompressing. Ideally we'd pipe what we download straight into the decompressing stage.
Basically replicating the following behaviour:
wget -O - https://downloads.merkle.io/reth-2025-01-06.tar.lz4 | tar -I lz4 -xvf -
Regarding merkle url, it's possible to find the latest archive with the following link: https://downloads.merkle.io/latest.txt |
Thanks, I've added this option |
download
to download public node snapshots download
to download public node snapshots
#[arg( | ||
long, | ||
short, | ||
help = "Custom URL to download the snapshot from", | ||
long_help = "Specify a snapshot URL or let the command propose a default one.\n\ | ||
\n\ | ||
Available snapshot sources:\n\ | ||
- https://downloads.merkle.io (default, mainnet archive)\n\ | ||
- https://publicnode.com/snapshots (full nodes & testnets)\n\ | ||
\n\ | ||
If no URL is provided, the latest mainnet archive snapshot\n\ | ||
will be proposed for download from merkle.io" | ||
)] |
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.
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.
no need to propose/ask for further user input. if no --url
is provided then default to the merkle one
fn spawn_tar_process(target_dir: &Path, lz4_stdout: Stdio) -> Result<Child> { | ||
Ok(ProcessCommand::new("tar") | ||
.arg("-xf") | ||
.arg("-") // Read from stdin | ||
.arg("-C") | ||
.arg(target_dir) | ||
.stdin(lz4_stdout) | ||
.stderr(Stdio::inherit()) | ||
.spawn()?) | ||
} |
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.
could this be using the lz4
and tar
crates instead? we shouldnt be depending on external binaries imo
); | ||
|
||
stream_and_extract(&url, data_dir.data_dir()).await?; | ||
info!("Snapshot downloaded and extracted successfully"); |
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.
info!("Snapshot downloaded and extracted successfully"); | |
info!(target: "reth::cli", "Snapshot downloaded and extracted successfully"); |
and in other places
Closes #13469.
Example of use :