From fd9c2305ac0ff31b0ea39869e4b2136e6e723cb5 Mon Sep 17 00:00:00 2001 From: sebastiandanconia <20387783+sebastiandanconia@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:25:47 -0700 Subject: [PATCH] docs: improve cli friendliness (#861) * Improve clarity of an info!() message * Replace references to EZKL_REPO_PATH in `--help' output Command `--help' messages aren't meant to be unduly verbose; we can write them for common/simple use cases. We continue to support EZKL_REPO_PATH for users who need it, for example to support containerized server use cases. To be clear, by default, EZKL_REPO_PATH = $HOME/.ezkl --- src/commands.rs | 20 ++++++++++---------- src/execute.rs | 5 +++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 841529bde..84341fd34 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -508,7 +508,7 @@ pub enum Commands { /// Gets an SRS from a circuit settings file. #[command(name = "get-srs")] GetSrs { - /// The path to output the desired srs file, if set to None will save to $EZKL_REPO_PATH/srs + /// The path to output the desired srs file, if set to None will save to ~/.ezkl/srs #[arg(long, default_value = None, value_hint = clap::ValueHint::FilePath)] srs_path: Option, /// Path to the circuit settings .json file to read in logrows from. Overriden by logrows if specified. @@ -555,7 +555,7 @@ pub enum Commands { /// The path to save the proving key to #[arg(long, default_value = DEFAULT_PK_AGGREGATED, value_hint = clap::ValueHint::FilePath)] pk_path: Option, - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long, value_hint = clap::ValueHint::FilePath)] srs_path: Option, /// logrows used for aggregation circuit @@ -582,7 +582,7 @@ pub enum Commands { /// The path to output the proof file to #[arg(long, default_value = DEFAULT_PROOF_AGGREGATED, value_hint = clap::ValueHint::FilePath)] proof_path: Option, - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long)] srs_path: Option, #[arg( @@ -624,7 +624,7 @@ pub enum Commands { /// The path to the compiled model file (generated using the compile-circuit command) #[arg(short = 'M', long, default_value = DEFAULT_COMPILED_CIRCUIT, value_hint = clap::ValueHint::FilePath)] compiled_circuit: Option, - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long, value_hint = clap::ValueHint::FilePath)] srs_path: Option, /// The path to output the verification key file to @@ -701,7 +701,7 @@ pub enum Commands { /// The path to output the proof file to #[arg(long, default_value = DEFAULT_PROOF, value_hint = clap::ValueHint::FilePath)] proof_path: Option, - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long, value_hint = clap::ValueHint::FilePath)] srs_path: Option, #[arg( @@ -733,7 +733,7 @@ pub enum Commands { /// Creates an Evm verifier for a single proof #[command(name = "create-evm-verifier")] CreateEvmVerifier { - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long, value_hint = clap::ValueHint::FilePath)] srs_path: Option, /// The path to load circuit settings .json file from (generated using the gen-settings command) @@ -755,7 +755,7 @@ pub enum Commands { /// Creates an Evm verifier artifact for a single proof to be used by the reusable verifier #[command(name = "create-evm-vka")] CreateEvmVKArtifact { - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long, value_hint = clap::ValueHint::FilePath)] srs_path: Option, /// The path to load circuit settings .json file from (generated using the gen-settings command) @@ -798,7 +798,7 @@ pub enum Commands { /// Creates an Evm verifier for an aggregate proof #[command(name = "create-evm-verifier-aggr")] CreateEvmVerifierAggr { - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long, value_hint = clap::ValueHint::FilePath)] srs_path: Option, /// The path to load the desired verification key file @@ -831,7 +831,7 @@ pub enum Commands { /// The path to the verification key file (generated using the setup command) #[arg(long, default_value = DEFAULT_VK, value_hint = clap::ValueHint::FilePath)] vk_path: Option, - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long, value_hint = clap::ValueHint::FilePath)] srs_path: Option, /// Reduce SRS logrows to the number of instances rather than the number of logrows used for proofs (only works if the srs were generated in the same ceremony) @@ -849,7 +849,7 @@ pub enum Commands { /// reduced srs #[arg(long, default_value = DEFAULT_USE_REDUCED_SRS_FOR_VERIFICATION, action = clap::ArgAction::SetTrue)] reduced_srs: Option, - /// The path to SRS, if None will use $EZKL_REPO_PATH/srs/kzg{logrows}.srs + /// The path to SRS, if None will use ~/.ezkl/srs/kzg{logrows}.srs #[arg(long, value_hint = clap::ValueHint::FilePath)] srs_path: Option, /// logrows used for aggregation circuit diff --git a/src/execute.rs b/src/execute.rs index 620403617..68fa87bc9 100644 --- a/src/execute.rs +++ b/src/execute.rs @@ -677,11 +677,12 @@ pub(crate) async fn get_srs_cmd( pb.finish_with_message("SRS validated."); info!("Saving SRS to disk..."); - let mut file = std::fs::File::create(get_srs_path(k, srs_path.clone(), commitment))?; + let computed_srs_path = get_srs_path(k, srs_path.clone(), commitment); + let mut file = std::fs::File::create(&computed_srs_path)?; let mut buffer = BufWriter::with_capacity(*EZKL_BUF_CAPACITY, &mut file); params.write(&mut buffer)?; - info!("Saved SRS to disk."); + info!("Saved SRS to {}.", computed_srs_path.as_os_str().to_str().unwrap_or("disk")); info!("SRS downloaded"); } else {