diff --git a/Cargo.toml b/Cargo.toml index 70d2b42d83..14edaff9c4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -147,8 +147,8 @@ version = "1.0" [dependencies.serial_test] version = "3.0.0" -[dependencies.snarkos-cli] -version = "2.2.4" +#[dependencies.snarkos-cli] +#version = "2.2.4" [dependencies.snarkvm] workspace = true diff --git a/errors/src/errors/package/package_errors.rs b/errors/src/errors/package/package_errors.rs index 21584fee1c..711bd8184f 100644 --- a/errors/src/errors/package/package_errors.rs +++ b/errors/src/errors/package/package_errors.rs @@ -363,4 +363,11 @@ create_messages!( help: Some("Delete the lock file and rebuild the project".to_string()), } + @backtraced + unimplemented_command { + args: (command: impl Display), + msg: format!("The `{command}` command is not implemented."), + help: None, + } + ); diff --git a/leo/cli/commands/deploy.rs b/leo/cli/commands/deploy.rs index 175f2f301b..a002363d4a 100644 --- a/leo/cli/commands/deploy.rs +++ b/leo/cli/commands/deploy.rs @@ -15,9 +15,7 @@ // along with the Leo library. If not, see . use super::*; -use snarkos_cli::commands::{Deploy as SnarkOSDeploy, Developer}; -use snarkvm::cli::helpers::dotenv_private_key; -use std::path::PathBuf; +//use snarkos_cli::commands::{Deploy as SnarkOSDeploy, Developer}; /// Deploys an Aleo program. #[derive(Parser, Debug)] @@ -53,55 +51,55 @@ impl Command for Deploy { Ok(()) } - fn apply(self, context: Context, _: Self::Input) -> Result { - // Get the program name - let project_name = context.open_manifest()?.program_id().to_string(); + fn apply(self, _context: Context, _: Self::Input) -> Result { + // // Get the program name + // let project_name = context.open_manifest()?.program_id().to_string(); + // + // // Get the private key + // let mut private_key = self.private_key; + // if private_key.is_none() { + // private_key = + // Some(dotenv_private_key().map_err(CliError::failed_to_read_environment_private_key)?.to_string()); + // } + // + // let mut all_paths: Vec<(String, PathBuf)> = Vec::new(); + // + // // Extract post-ordered list of local dependencies' paths from `leo.lock` + // if !self.non_recursive { + // all_paths = context.local_dependency_paths()?; + // } + // + // // Add the parent program to be deployed last + // all_paths.push((project_name, context.dir()?.join("build"))); + // + // for (index, (name, path)) in all_paths.iter().enumerate() { + // // Set deploy arguments + // let deploy = SnarkOSDeploy::try_parse_from([ + // "snarkos", + // "--private-key", + // private_key.as_ref().unwrap(), + // "--query", + // self.endpoint.as_str(), + // "--priority-fee", + // self.priority_fee.as_str(), + // "--path", + // path.to_str().unwrap(), + // "--broadcast", + // format!("{}/{}/transaction/broadcast", self.endpoint, self.network).as_str(), + // &name, + // ]) + // .unwrap(); + // + // // Deploy program + // Developer::Deploy(deploy).parse().map_err(CliError::failed_to_execute_deploy)?; + // + // // Sleep for `wait_gap` seconds. + // // This helps avoid parents from being serialized before children. + // if index < all_paths.len() - 1 { + // std::thread::sleep(std::time::Duration::from_secs(self.wait_gap)); + // } + // } - // Get the private key - let mut private_key = self.private_key; - if private_key.is_none() { - private_key = - Some(dotenv_private_key().map_err(CliError::failed_to_read_environment_private_key)?.to_string()); - } - - let mut all_paths: Vec<(String, PathBuf)> = Vec::new(); - - // Extract post-ordered list of local dependencies' paths from `leo.lock` - if !self.non_recursive { - all_paths = context.local_dependency_paths()?; - } - - // Add the parent program to be deployed last - all_paths.push((project_name, context.dir()?.join("build"))); - - for (index, (name, path)) in all_paths.iter().enumerate() { - // Set deploy arguments - let deploy = SnarkOSDeploy::try_parse_from([ - "snarkos", - "--private-key", - private_key.as_ref().unwrap(), - "--query", - self.endpoint.as_str(), - "--priority-fee", - self.priority_fee.as_str(), - "--path", - path.to_str().unwrap(), - "--broadcast", - format!("{}/{}/transaction/broadcast", self.endpoint, self.network).as_str(), - &name, - ]) - .unwrap(); - - // Deploy program - Developer::Deploy(deploy).parse().map_err(CliError::failed_to_execute_deploy)?; - - // Sleep for `wait_gap` seconds. - // This helps avoid parents from being serialized before children. - if index < all_paths.len() - 1 { - std::thread::sleep(std::time::Duration::from_secs(self.wait_gap)); - } - } - - Ok(()) + Err(PackageError::unimplemented_command("leo deploy").into()) } } diff --git a/leo/cli/commands/execute.rs b/leo/cli/commands/execute.rs index 3507ad15ac..b71427de4d 100644 --- a/leo/cli/commands/execute.rs +++ b/leo/cli/commands/execute.rs @@ -15,8 +15,8 @@ // along with the Leo library. If not, see . use super::*; -use snarkos_cli::commands::{Developer, Execute as SnarkOSExecute}; -use snarkvm::cli::{dotenv_private_key, Execute as SnarkVMExecute}; +//use snarkos_cli::commands::{Developer, Execute as SnarkOSExecute}; +use snarkvm::cli::Execute as SnarkVMExecute; /// Build, Prove and Run Leo program with inputs #[derive(Parser, Debug)] @@ -52,44 +52,44 @@ impl Command for Execute { fn apply(self, context: Context, input: Self::Input) -> Result { // If the `broadcast` flag is set, then broadcast the transaction. if self.broadcast { - // Get the program name - let project_name = context.open_manifest()?.program_id().to_string(); + // // Get the program name + // let project_name = context.open_manifest()?.program_id().to_string(); + // + // // Get the private key + // let mut private_key = self.private_key; + // if private_key.is_none() { + // private_key = + // Some(dotenv_private_key().map_err(CliError::failed_to_read_environment_private_key)?.to_string()); + // } + // + // // Execute program + // Developer::Execute( + // SnarkOSExecute::try_parse_from( + // [ + // vec![ + // "snarkos", + // "--private-key", + // private_key.as_ref().unwrap(), + // "--query", + // self.compiler_options.endpoint.as_str(), + // "--priority-fee", + // self.priority_fee.as_str(), + // "--broadcast", + // format!("{}/{}/transaction/broadcast", self.compiler_options.endpoint, self.network) + // .as_str(), + // project_name.as_str(), + // &self.name, + // ], + // self.inputs.iter().map(|input| input.as_str()).collect(), + // ] + // .concat(), + // ) + // .unwrap(), + // ) + // .parse() + // .map_err(CliError::failed_to_execute_deploy)?; - // Get the private key - let mut private_key = self.private_key; - if private_key.is_none() { - private_key = - Some(dotenv_private_key().map_err(CliError::failed_to_read_environment_private_key)?.to_string()); - } - - // Execute program - Developer::Execute( - SnarkOSExecute::try_parse_from( - [ - vec![ - "snarkos", - "--private-key", - private_key.as_ref().unwrap(), - "--query", - self.compiler_options.endpoint.as_str(), - "--priority-fee", - self.priority_fee.as_str(), - "--broadcast", - format!("{}/{}/transaction/broadcast", self.compiler_options.endpoint, self.network) - .as_str(), - project_name.as_str(), - &self.name, - ], - self.inputs.iter().map(|input| input.as_str()).collect(), - ] - .concat(), - ) - .unwrap(), - ) - .parse() - .map_err(CliError::failed_to_execute_deploy)?; - - return Ok(()); + return Err(PackageError::unimplemented_command("leo execute --broadcast").into()); } // If input values are provided, then run the program with those inputs. diff --git a/leo/package/Cargo.toml b/leo/package/Cargo.toml index f35a4a6ed6..4765a79b4b 100644 --- a/leo/package/Cargo.toml +++ b/leo/package/Cargo.toml @@ -25,8 +25,8 @@ default-features = false [dependencies.snarkvm] workspace = true -[dependencies.snarkos-cli] -version = "2.2.4" +#[dependencies.snarkos-cli] +#version = "2.2.4" [dependencies.leo-errors] path = "../../errors"