comment out

This commit is contained in:
evan-schott 2024-02-09 14:08:12 -08:00
parent bfa41e1d79
commit 12f9548141
5 changed files with 100 additions and 95 deletions

View File

@ -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

View File

@ -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,
}
);

View File

@ -15,9 +15,7 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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<Self::Output> {
// Get the program name
let project_name = context.open_manifest()?.program_id().to_string();
fn apply(self, _context: Context, _: Self::Input) -> Result<Self::Output> {
// // 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())
}
}

View File

@ -15,8 +15,8 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
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<Self::Output> {
// 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.

View File

@ -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"