remove(cmd): Remove `zebrad download` command, because it no longer does anything (#7819)
* Remove the `zebrad download` command * Reorder command.rs imports * Remove zcash-params/Dockerfile and the main Dockerfile commands that use it * Stop building zcash-params Docker images in CI * Update CHANGELOG for `zebrad download` removal * Clarify why the image is smaller Co-authored-by: Marek <mail@marek.onl> --------- Co-authored-by: Marek <mail@marek.onl>
This commit is contained in:
parent
a126acb160
commit
71a9865b6c
|
@ -1,45 +0,0 @@
|
|||
name: Build zcash-params
|
||||
|
||||
# Ensures that only one workflow task will run at a time. Previous deployments, if
|
||||
# already in process, won't get cancelled. Instead, we let the first to complete
|
||||
# then queue the latest pending workflow, cancelling any workflows in between
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
no_cache:
|
||||
description: 'Disable the Docker cache for this build'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
paths:
|
||||
# parameter download code
|
||||
- 'zebra-consensus/src/primitives/groth16/params.rs'
|
||||
- 'zebra-consensus/src/router.rs'
|
||||
- 'zebrad/src/commands/download.rs'
|
||||
- 'zebrad/src/commands/start.rs'
|
||||
# workflow definitions
|
||||
- 'docker/zcash-params/Dockerfile'
|
||||
- '.dockerignore'
|
||||
- '.github/workflows/sub-build-zcash-params.yml'
|
||||
- '.github/workflows/sub-build-docker-image.yml'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Zcash Params Docker
|
||||
uses: ./.github/workflows/sub-build-docker-image.yml
|
||||
with:
|
||||
dockerfile_path: ./docker/zcash-params/Dockerfile
|
||||
dockerfile_target: release
|
||||
image_name: zcash-params
|
||||
no_cache: ${{ inputs.no_cache || false }}
|
||||
rust_backtrace: full
|
||||
rust_lib_backtrace: full
|
||||
rust_log: info
|
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
|||
|
||||
## [Zebra 1.4.0](https://github.com/ZcashFoundation/zebra/releases/tag/v1.4.0) - TODO: DATE
|
||||
|
||||
Zebra's mining RPCs are now available in release builds. TODO: rest of intro
|
||||
Zebra's mining RPCs are now available in release builds. Our Docker images are significantly smaller,
|
||||
because the smaller Zcash verification parameters are now built into the `zebrad` binary.
|
||||
TODO: rest of intro
|
||||
|
||||
This release contains the following changes:
|
||||
|
||||
|
@ -21,10 +23,12 @@ read our [mining blog post](https://zfnd.org/experimental-mining-support-in-zebr
|
|||
Please [let us know](https://github.com/ZcashFoundation/zebra/issues/new?assignees=&labels=C-enhancement%2CS-needs-triage&projects=&template=feature_request.yml&title=feature%3A+)
|
||||
if your mining pool needs extra RPC methods or fields.
|
||||
|
||||
### Parameters in Binary
|
||||
### Zcash Parameters in `zebrad` Binary
|
||||
|
||||
`zebrad` now bundles zk-SNARK parameters directly into its binary. This increases the binary size
|
||||
by a few megabytes, but these parameters do not need to be downloaded or stored separately.
|
||||
by a few megabytes, but reduces the size of the Docker image by around 600 MB because
|
||||
the parameters don't contain the Sprout proving key anymore. The `zebrad download`
|
||||
command does nothing, so it has been removed.
|
||||
|
||||
Previously, parameters were stored by default in these locations:
|
||||
|
||||
|
|
|
@ -95,9 +95,7 @@ ENV CARGO_HOME="/opt/zebrad/.cargo/"
|
|||
# We also download needed dependencies for tests to work, from other images.
|
||||
# An entrypoint.sh is only available in this step for easier test handling with variables.
|
||||
FROM deps AS tests
|
||||
# TODO: do not hardcode the user /root/ even though is a safe assumption
|
||||
# Pre-download Zcash Sprout, Sapling parameters and Lightwalletd binary
|
||||
COPY --from=us-docker.pkg.dev/zfnd-dev-zebra/zebra/zcash-params:edge /root/.zcash-params /root/.zcash-params
|
||||
|
||||
COPY --from=us-docker.pkg.dev/zfnd-dev-zebra/zebra/lightwalletd:edge /opt/lightwalletd /usr/local/bin
|
||||
|
||||
# cargo uses timestamps for its cache, so they need to be in this order:
|
||||
|
@ -176,11 +174,10 @@ RUN chmod u+x /entrypoint.sh
|
|||
# This stage is only used when deploying nodes or when only the resulting zebrad binary is needed
|
||||
#
|
||||
# To save space, this step starts from scratch using debian, and only adds the resulting
|
||||
# binary from the `release` stage, and the Zcash Sprout & Sapling parameters from ZCash
|
||||
# binary from the `release` stage
|
||||
FROM debian:bullseye-slim AS runtime
|
||||
COPY --from=release /opt/zebrad/target/release/zebrad /usr/local/bin
|
||||
COPY --from=release /entrypoint.sh /
|
||||
COPY --from=us-docker.pkg.dev/zfnd-dev-zebra/zebra/zcash-params:edge /root/.zcash-params /root/.zcash-params
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
# This image is for caching Zcash Sprout and Sapling parameters.
|
||||
# We don't test it automatically in CI due to download server rate-limiting.
|
||||
# To manually run it on the PR branch before merging, go to:
|
||||
# https://github.com/ZcashFoundation/zebra/actions/workflows/zcash-params.yml
|
||||
|
||||
FROM debian:bullseye-slim AS release
|
||||
|
||||
# Just use the precompiled zebrad binary from a recent release image.
|
||||
#
|
||||
# It doesn't matter what build or commit of Zebra we use, because it just calls into the
|
||||
# zcash_proofs download code. (Which doesn't change much.)
|
||||
# Test image zebrad binaries would also work, but it's harder to get a recent tag for them.
|
||||
#
|
||||
# Compiling the download-params example using `cargo ` is another alternative:
|
||||
# `cargo run --locked --release --features default-docker --example download-params`
|
||||
COPY --from=zfnd/zebra:latest /usr/local/bin/zebrad /usr/local/bin
|
||||
|
||||
# Pre-download Zcash Sprout and Sapling parameters
|
||||
RUN zebrad download
|
|
@ -1,7 +1,16 @@
|
|||
//! Zebrad Subcommands
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use abscissa_core::{config::Override, Command, Configurable, FrameworkError, Runnable};
|
||||
|
||||
use crate::config::ZebradConfig;
|
||||
|
||||
pub use self::{entry_point::EntryPoint, start::StartCmd};
|
||||
|
||||
use self::{copy_state::CopyStateCmd, generate::GenerateCmd, tip_height::TipHeightCmd};
|
||||
|
||||
mod copy_state;
|
||||
mod download;
|
||||
mod entry_point;
|
||||
mod generate;
|
||||
mod start;
|
||||
|
@ -10,18 +19,7 @@ mod tip_height;
|
|||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use self::ZebradCmd::*;
|
||||
use self::{
|
||||
copy_state::CopyStateCmd, download::DownloadCmd, generate::GenerateCmd,
|
||||
tip_height::TipHeightCmd,
|
||||
};
|
||||
|
||||
pub use self::{entry_point::EntryPoint, start::StartCmd};
|
||||
|
||||
use crate::config::ZebradConfig;
|
||||
|
||||
use abscissa_core::{config::Override, Command, Configurable, FrameworkError, Runnable};
|
||||
use std::path::PathBuf;
|
||||
use ZebradCmd::*;
|
||||
|
||||
/// Zebrad Configuration Filename
|
||||
pub const CONFIG_FILE: &str = "zebrad.toml";
|
||||
|
@ -33,10 +31,6 @@ pub enum ZebradCmd {
|
|||
// TODO: hide this command from users in release builds (#3279)
|
||||
CopyState(CopyStateCmd),
|
||||
|
||||
// The `download` subcommand
|
||||
/// Pre-download required Zcash Sprout and Sapling parameter files
|
||||
Download(DownloadCmd),
|
||||
|
||||
/// Generate a default `zebrad.toml` configuration
|
||||
Generate(GenerateCmd),
|
||||
|
||||
|
@ -60,7 +54,7 @@ impl ZebradCmd {
|
|||
CopyState(_) | Start(_) => true,
|
||||
|
||||
// Utility commands that don't use server components
|
||||
Download(_) | Generate(_) | TipHeight(_) => false,
|
||||
Generate(_) | TipHeight(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,14 +68,14 @@ impl ZebradCmd {
|
|||
Start(_) => true,
|
||||
|
||||
// Utility commands
|
||||
CopyState(_) | Download(_) | Generate(_) | TipHeight(_) => false,
|
||||
CopyState(_) | Generate(_) | TipHeight(_) => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns true if this command should ignore errors when
|
||||
/// attempting to load a config file.
|
||||
pub(crate) fn should_ignore_load_config_error(&self) -> bool {
|
||||
matches!(self, ZebradCmd::Generate(_) | ZebradCmd::Download(_))
|
||||
matches!(self, ZebradCmd::Generate(_))
|
||||
}
|
||||
|
||||
/// Returns the default log level for this command, based on the `verbose` command line flag.
|
||||
|
@ -96,7 +90,7 @@ impl ZebradCmd {
|
|||
Generate(_) | TipHeight(_) => true,
|
||||
|
||||
// Commands that generate informative logging output by default.
|
||||
CopyState(_) | Download(_) | Start(_) => false,
|
||||
CopyState(_) | Start(_) => false,
|
||||
};
|
||||
|
||||
if only_show_warnings && !verbose {
|
||||
|
@ -113,7 +107,6 @@ impl Runnable for ZebradCmd {
|
|||
fn run(&self) {
|
||||
match self {
|
||||
CopyState(cmd) => cmd.run(),
|
||||
Download(cmd) => cmd.run(),
|
||||
Generate(cmd) => cmd.run(),
|
||||
Start(cmd) => cmd.run(),
|
||||
TipHeight(cmd) => cmd.run(),
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
//! `download` subcommand - pre-download required parameter files
|
||||
//!
|
||||
//! `zebrad download` automatically downloads required parameter files the first time it is run.
|
||||
//!
|
||||
//! This command should be used if you're launching lots of `zebrad start` instances for testing,
|
||||
//! or you want to include the parameter files in a distribution package.
|
||||
|
||||
use abscissa_core::{Command, Runnable};
|
||||
|
||||
/// Pre-download required Zcash Sprout and Sapling parameter files
|
||||
#[derive(Command, Debug, Default, clap::Parser)]
|
||||
pub struct DownloadCmd {}
|
||||
|
||||
impl DownloadCmd {
|
||||
/// Download the Sapling and Sprout Groth16 parameters if needed,
|
||||
/// check they were downloaded correctly, and load them into Zebra.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// If the downloaded or pre-existing parameter files are invalid.
|
||||
fn download_and_check(&self) {
|
||||
// The lazy static initializer does the download, if needed,
|
||||
// and the file hash checks.
|
||||
lazy_static::initialize(&zebra_consensus::groth16::GROTH16_PARAMETERS);
|
||||
}
|
||||
}
|
||||
|
||||
impl Runnable for DownloadCmd {
|
||||
/// Run the download command.
|
||||
fn run(&self) {
|
||||
info!("checking if Zcash Sapling and Sprout parameters have been downloaded");
|
||||
|
||||
self.download_and_check();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue