diff --git a/.github/workflows/leo-add-remove.yml b/.github/workflows/leo-add-remove.yml index bb859f6187..a3f6650196 100644 --- a/.github/workflows/leo-add-remove.yml +++ b/.github/workflows/leo-add-remove.yml @@ -42,6 +42,9 @@ jobs: cd .. && leo new my-app && cd my-app leo login -u "$USER" -p "$PASS" leo add argus4130/xnor + leo setup + leo setup + leo setup --skip-key-check leo remove xnor leo clean diff --git a/leo/commands/prove.rs b/leo/commands/prove.rs index 71eb4df9d5..53edef7fd1 100644 --- a/leo/commands/prove.rs +++ b/leo/commands/prove.rs @@ -29,24 +29,24 @@ use std::{convert::TryFrom, env::current_dir, time::Instant}; pub struct ProveCommand; impl CLI for ProveCommand { - type Options = (); + type Options = bool; type Output = (Proof, PreparedVerifyingKey); const ABOUT: AboutType = "Run the program and produce a proof"; const ARGUMENTS: &'static [ArgumentType] = &[]; - const FLAGS: &'static [FlagType] = &[]; + const FLAGS: &'static [FlagType] = &[("--skip-key-check")]; const NAME: NameType = "prove"; const OPTIONS: &'static [OptionType] = &[]; const SUBCOMMANDS: &'static [SubCommandType] = &[]; #[cfg_attr(tarpaulin, skip)] - fn parse(_arguments: &ArgMatches) -> Result { - Ok(()) + fn parse(arguments: &ArgMatches) -> Result { + Ok(!arguments.is_present("skip-key-check")) } #[cfg_attr(tarpaulin, skip)] - fn output(options: Self::Options) -> Result { - let (program, parameters, prepared_verifying_key) = SetupCommand::output(options)?; + fn output(do_setup_check: Self::Options) -> Result { + let (program, parameters, prepared_verifying_key) = SetupCommand::output(do_setup_check)?; // Begin "Proving" context for console logging let span = tracing::span!(tracing::Level::INFO, "Proving"); diff --git a/leo/commands/run.rs b/leo/commands/run.rs index 8f9d688aab..e9112c5d4d 100644 --- a/leo/commands/run.rs +++ b/leo/commands/run.rs @@ -28,24 +28,24 @@ use std::time::Instant; pub struct RunCommand; impl CLI for RunCommand { - type Options = (); + type Options = bool; type Output = (); const ABOUT: AboutType = "Run a program with input variables"; const ARGUMENTS: &'static [ArgumentType] = &[]; - const FLAGS: &'static [FlagType] = &[]; + const FLAGS: &'static [FlagType] = &[("--skip-key-check")]; const NAME: NameType = "run"; const OPTIONS: &'static [OptionType] = &[]; const SUBCOMMANDS: &'static [SubCommandType] = &[]; #[cfg_attr(tarpaulin, skip)] - fn parse(_arguments: &ArgMatches) -> Result { - Ok(()) + fn parse(arguments: &ArgMatches) -> Result { + Ok(!arguments.is_present("skip-key-check")) } #[cfg_attr(tarpaulin, skip)] - fn output(options: Self::Options) -> Result<(), CLIError> { - let (proof, prepared_verifying_key) = ProveCommand::output(options)?; + fn output(do_setup_check: Self::Options) -> Result<(), CLIError> { + let (proof, prepared_verifying_key) = ProveCommand::output(do_setup_check)?; // Begin "Verifying" context for console logging let span = tracing::span!(tracing::Level::INFO, "Verifying"); diff --git a/leo/commands/setup.rs b/leo/commands/setup.rs index d85d70e1b9..96dcba8bc7 100644 --- a/leo/commands/setup.rs +++ b/leo/commands/setup.rs @@ -39,7 +39,7 @@ use std::{convert::TryFrom, env::current_dir, time::Instant}; pub struct SetupCommand; impl CLI for SetupCommand { - type Options = (); + type Options = bool; type Output = ( Compiler, Parameters, @@ -48,23 +48,23 @@ impl CLI for SetupCommand { const ABOUT: AboutType = "Run a program setup"; const ARGUMENTS: &'static [ArgumentType] = &[]; - const FLAGS: &'static [FlagType] = &[]; + const FLAGS: &'static [FlagType] = &[("--skip-key-check")]; const NAME: NameType = "setup"; const OPTIONS: &'static [OptionType] = &[]; const SUBCOMMANDS: &'static [SubCommandType] = &[]; #[cfg_attr(tarpaulin, skip)] - fn parse(_arguments: &ArgMatches) -> Result { - Ok(()) + fn parse(arguments: &ArgMatches) -> Result { + Ok(!arguments.is_present("skip-key-check")) } #[cfg_attr(tarpaulin, skip)] - fn output(options: Self::Options) -> Result { + fn output(do_check: Self::Options) -> Result { // Get the package name let path = current_dir()?; let package_name = Manifest::try_from(path.as_path())?.get_package_name(); - match BuildCommand::output(options)? { + match BuildCommand::output(())? { Some((program, checksum_differs)) => { // Begin "Setup" context for console logging let span = tracing::span!(tracing::Level::INFO, "Setup"); @@ -116,8 +116,11 @@ impl CLI for SetupCommand { // Read the proving key file from the output directory tracing::info!("Loading proving key..."); + if !do_check { + tracing::info!("Skipping curve check"); + } let proving_key_bytes = ProvingKeyFile::new(&package_name).read_from(&path)?; - let proving_key = Parameters::::read(proving_key_bytes.as_slice(), true)?; + let proving_key = Parameters::::read(proving_key_bytes.as_slice(), do_check)?; tracing::info!("Complete"); // Read the verification key file from the output directory