mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-26 11:06:00 +03:00
Follow up on comments to PR
- fixes import ordering (with rule group_imports) - removes explicit 0group from pedersen hash example - updater is now fully-anyhow-ed :) - fixed doc comment in prove command - renamed cmd to command in main
This commit is contained in:
parent
2ff2db2570
commit
deb830ce65
@ -7,7 +7,7 @@ circuit PedersenHash {
|
||||
}
|
||||
|
||||
function hash(self, bits: [bool; 256]) -> group {
|
||||
let mut digest: group = 0group;
|
||||
let mut digest: group = 0;
|
||||
for i in 0..256 {
|
||||
if bits[i] {
|
||||
digest += self.parameters[i];
|
||||
|
@ -14,14 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use serde::Serialize;
|
||||
|
||||
use anyhow::{anyhow, Error, Result};
|
||||
use reqwest::{
|
||||
blocking::{Client, Response},
|
||||
Method,
|
||||
StatusCode,
|
||||
};
|
||||
use serde::Serialize;
|
||||
|
||||
/// Trait describes API Routes and Request bodies, struct which implements
|
||||
/// Route MUST also support Serialize to be usable in Api::run_route(r: Route)
|
||||
|
@ -14,25 +14,26 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::synthesizer::{CircuitSynthesizer, SerializedCircuit};
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use anyhow::Result;
|
||||
use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType};
|
||||
use leo_package::{
|
||||
inputs::*,
|
||||
outputs::{ChecksumFile, CircuitFile, OutputsDirectory, OUTPUTS_DIRECTORY_NAME},
|
||||
source::{LibraryFile, MainFile, LIBRARY_FILENAME, MAIN_FILENAME, SOURCE_DIRECTORY_NAME},
|
||||
};
|
||||
|
||||
use snarkvm_curves::{bls12_377::Bls12_377, edwards_bls12::Fq};
|
||||
use snarkvm_models::gadgets::r1cs::ConstraintSystem;
|
||||
|
||||
use anyhow::Result;
|
||||
use std::convert::TryFrom;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{
|
||||
commands::Command,
|
||||
context::Context,
|
||||
synthesizer::{CircuitSynthesizer, SerializedCircuit},
|
||||
};
|
||||
|
||||
/// Compile and build program command
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,13 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use anyhow::Result;
|
||||
use leo_compiler::OutputFile;
|
||||
use leo_package::outputs::{ChecksumFile, CircuitFile, ProofFile, ProvingKeyFile, VerificationKeyFile};
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Clean outputs folder command
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,11 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use anyhow::Result;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Deploy Leo program to the network
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,13 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use std::env::current_dir;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use leo_package::LeoPackage;
|
||||
use std::env::current_dir;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Init Leo project command within current directory
|
||||
#[derive(StructOpt, Debug)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,11 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use anyhow::Result;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Lint Leo code command
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,11 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::context::{get_context, Context};
|
||||
use anyhow::Result;
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::Result;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::context::{get_context, Context};
|
||||
|
||||
// local program commands
|
||||
pub mod build;
|
||||
pub use build::Build;
|
||||
@ -26,9 +28,15 @@ pub use build::Build;
|
||||
pub mod clean;
|
||||
pub use clean::Clean;
|
||||
|
||||
pub mod deploy;
|
||||
pub use deploy::Deploy;
|
||||
|
||||
pub mod init;
|
||||
pub use init::Init;
|
||||
|
||||
pub mod lint;
|
||||
pub use lint::Lint;
|
||||
|
||||
pub mod new;
|
||||
pub use new::New;
|
||||
|
||||
@ -44,22 +52,15 @@ pub use setup::Setup;
|
||||
pub mod test;
|
||||
pub use test::Test;
|
||||
|
||||
pub mod watch;
|
||||
pub use watch::Watch;
|
||||
|
||||
pub mod update;
|
||||
pub use update::{Sub as UpdateAutomatic, Update};
|
||||
|
||||
// aleo pm related commands
|
||||
pub mod watch;
|
||||
pub use watch::Watch;
|
||||
|
||||
// Aleo PM related commands
|
||||
pub mod package;
|
||||
|
||||
// not implemented
|
||||
pub mod deploy;
|
||||
pub use deploy::Deploy;
|
||||
|
||||
pub mod lint;
|
||||
pub use lint::Lint;
|
||||
|
||||
/// Base trait for Leo CLI, see methods and their documentation for details
|
||||
pub trait Command {
|
||||
/// If current command requires running another command before
|
||||
|
@ -14,14 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use anyhow::{anyhow, Result};
|
||||
|
||||
use leo_package::LeoPackage;
|
||||
use std::{env::current_dir, fs};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use leo_package::LeoPackage;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Create new Leo project
|
||||
#[derive(StructOpt, Debug)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,20 +14,17 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_package::imports::{ImportsDirectory, IMPORTS_DIRECTORY_NAME};
|
||||
use tracing::Span;
|
||||
|
||||
use std::{
|
||||
fs::{create_dir_all, File},
|
||||
io::{Read, Write},
|
||||
};
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use leo_package::imports::{ImportsDirectory, IMPORTS_DIRECTORY_NAME};
|
||||
use structopt::StructOpt;
|
||||
use tracing::Span;
|
||||
|
||||
use crate::api::Fetch;
|
||||
use crate::{api::Fetch, commands::Command, context::Context};
|
||||
|
||||
/// Add package from Aleo Package Manager
|
||||
#[derive(StructOpt, Debug)]
|
||||
|
@ -14,17 +14,18 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
use crate::api::{Login as LoginRoute, Profile as ProfileRoute};
|
||||
|
||||
use crate::config::*;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use structopt::StructOpt;
|
||||
use tracing::Span;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use crate::{
|
||||
api::{Login as LoginRoute, Profile as ProfileRoute},
|
||||
commands::Command,
|
||||
config::*,
|
||||
context::Context,
|
||||
};
|
||||
|
||||
pub const LOGIN_URL: &str = "v1/account/authenticate";
|
||||
pub const PROFILE_URL: &str = "v1/account/my_profile";
|
||||
|
@ -14,14 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
use crate::config::remove_token;
|
||||
use anyhow::Result;
|
||||
use std::io::ErrorKind;
|
||||
|
||||
use anyhow::Result;
|
||||
use structopt::StructOpt;
|
||||
use tracing::Span;
|
||||
|
||||
use crate::{commands::Command, config::remove_token, context::Context};
|
||||
|
||||
/// Remove credentials for Aleo PM from .leo directory
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,23 +14,20 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{
|
||||
commands::Command,
|
||||
context::{Context, PACKAGE_MANAGER_URL},
|
||||
};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use structopt::StructOpt;
|
||||
|
||||
use leo_package::{outputs::OutputsDirectory, root::ZipFile};
|
||||
use reqwest::{
|
||||
blocking::{multipart::Form, Client},
|
||||
header::{HeaderMap, HeaderValue},
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use super::build::Build;
|
||||
use serde::Deserialize;
|
||||
|
||||
use leo_package::{outputs::OutputsDirectory, root::ZipFile};
|
||||
use crate::{
|
||||
commands::Command,
|
||||
context::{Context, PACKAGE_MANAGER_URL},
|
||||
};
|
||||
|
||||
pub const PUBLISH_URL: &str = "v1/package/publish";
|
||||
|
||||
|
@ -14,14 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
use leo_package::LeoPackage;
|
||||
|
||||
use anyhow::Result;
|
||||
use leo_package::LeoPackage;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Remove imported package
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,22 +14,20 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use super::setup::Setup;
|
||||
use crate::{commands::Command, context::Context};
|
||||
use anyhow::Result;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use leo_package::outputs::ProofFile;
|
||||
|
||||
use rand::thread_rng;
|
||||
use snarkvm_algorithms::snark::groth16::{Groth16, PreparedVerifyingKey, Proof};
|
||||
use snarkvm_curves::bls12_377::{Bls12_377, Fr};
|
||||
use snarkvm_models::algorithms::SNARK;
|
||||
use snarkvm_utilities::bytes::ToBytes;
|
||||
|
||||
use rand::thread_rng;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
/// Init Leo project command in current directory
|
||||
use super::setup::Setup;
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Run the program and produce a proof
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
pub struct Prove {
|
||||
|
@ -14,19 +14,16 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
use anyhow::Result;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType};
|
||||
|
||||
use snarkvm_algorithms::snark::groth16::Groth16;
|
||||
use snarkvm_curves::bls12_377::{Bls12_377, Fr};
|
||||
use snarkvm_models::algorithms::SNARK;
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use super::prove::Prove;
|
||||
use tracing::span::Span;
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Build, Prove and Run Leo program with inputs
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
|
@ -14,26 +14,23 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use anyhow::{anyhow, Result};
|
||||
|
||||
use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType};
|
||||
use leo_package::{
|
||||
outputs::{ProvingKeyFile, VerificationKeyFile},
|
||||
source::{MAIN_FILENAME, SOURCE_DIRECTORY_NAME},
|
||||
};
|
||||
|
||||
use rand::thread_rng;
|
||||
use snarkvm_algorithms::snark::groth16::{Groth16, Parameters, PreparedVerifyingKey, VerifyingKey};
|
||||
use snarkvm_curves::bls12_377::{Bls12_377, Fr};
|
||||
use snarkvm_models::algorithms::snark::SNARK;
|
||||
|
||||
use structopt::StructOpt;
|
||||
|
||||
use super::build::Build;
|
||||
use tracing::span::Span;
|
||||
|
||||
/// Run setup ceremony for Leo program Command
|
||||
use super::build::Build;
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Run a program setup
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
pub struct Setup {
|
||||
|
@ -14,23 +14,21 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use std::{convert::TryFrom, path::PathBuf, time::Instant};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use structopt::StructOpt;
|
||||
|
||||
use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType};
|
||||
use leo_package::{
|
||||
inputs::*,
|
||||
outputs::{OutputsDirectory, OUTPUTS_DIRECTORY_NAME},
|
||||
source::{LibraryFile, MainFile, LIBRARY_FILENAME, MAIN_FILENAME, SOURCE_DIRECTORY_NAME},
|
||||
};
|
||||
|
||||
use snarkvm_curves::edwards_bls12::Fq;
|
||||
|
||||
use std::{convert::TryFrom, path::PathBuf, time::Instant};
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
/// Build program and run tests command
|
||||
#[derive(StructOpt, Debug, Default)]
|
||||
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
|
||||
|
@ -14,11 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, config::Config, context::Context, updater::Updater};
|
||||
use anyhow::{anyhow, Result};
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use crate::{commands::Command, config::Config, context::Context, updater::Updater};
|
||||
|
||||
/// Setting for automatic updates of Leo
|
||||
#[derive(Debug, StructOpt, PartialEq)]
|
||||
pub enum Sub {
|
||||
|
@ -14,15 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::{commands::Command, context::Context};
|
||||
use std::{sync::mpsc::channel, time::Duration};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
|
||||
use std::{sync::mpsc::channel, time::Duration};
|
||||
use structopt::StructOpt;
|
||||
use tracing::span::Span;
|
||||
|
||||
use super::build::Build;
|
||||
use tracing::span::Span;
|
||||
use crate::{commands::Command, context::Context};
|
||||
|
||||
const LEO_SOURCE_DIR: &str = "src/";
|
||||
|
||||
|
@ -14,10 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use anyhow::Error;
|
||||
use dirs::home_dir;
|
||||
use lazy_static::lazy_static;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
fs::{self, create_dir_all, File},
|
||||
io,
|
||||
@ -25,6 +21,11 @@ use std::{
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use anyhow::Error;
|
||||
use dirs::home_dir;
|
||||
use lazy_static::lazy_static;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub const LEO_CREDENTIALS_FILE: &str = "credentials";
|
||||
pub const LEO_CONFIG_FILE: &str = "config.toml";
|
||||
|
||||
|
@ -14,12 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use std::env::current_dir;
|
||||
use std::{convert::TryFrom, env::current_dir, path::PathBuf};
|
||||
|
||||
use crate::{api::Api, config};
|
||||
use anyhow::Result;
|
||||
use leo_package::root::Manifest;
|
||||
use std::{convert::TryFrom, path::PathBuf};
|
||||
|
||||
use crate::{api::Api, config};
|
||||
|
||||
pub const PACKAGE_MANAGER_URL: &str = "https://api.aleo.pm/";
|
||||
|
||||
|
@ -14,8 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use colored::Colorize;
|
||||
use std::fmt;
|
||||
|
||||
use colored::Colorize;
|
||||
use tracing::{event::Event, subscriber::Subscriber};
|
||||
use tracing_subscriber::{
|
||||
fmt::{format::*, time::*, FmtContext, FormattedFields},
|
||||
|
71
leo/main.rs
71
leo/main.rs
@ -22,9 +22,9 @@ pub mod logger;
|
||||
pub mod synthesizer;
|
||||
pub mod updater;
|
||||
|
||||
use anyhow::Error;
|
||||
use std::process::exit;
|
||||
|
||||
use anyhow::Error;
|
||||
use commands::{
|
||||
package::{Add, Login, Logout, Publish, Remove},
|
||||
Build,
|
||||
@ -41,7 +41,6 @@ use commands::{
|
||||
Update,
|
||||
Watch,
|
||||
};
|
||||
|
||||
use structopt::{clap::AppSettings, StructOpt};
|
||||
|
||||
/// CLI Arguments entry point - includes global parameters and subcommands
|
||||
@ -65,103 +64,103 @@ enum CommandOpts {
|
||||
#[structopt(about = "Init new Leo project command in current directory")]
|
||||
Init {
|
||||
#[structopt(flatten)]
|
||||
cmd: Init,
|
||||
command: Init,
|
||||
},
|
||||
|
||||
#[structopt(about = "Create new Leo project in new directory")]
|
||||
New {
|
||||
#[structopt(flatten)]
|
||||
cmd: New,
|
||||
command: New,
|
||||
},
|
||||
|
||||
#[structopt(about = "Compile current package as a program")]
|
||||
Build {
|
||||
#[structopt(flatten)]
|
||||
cmd: Build,
|
||||
command: Build,
|
||||
},
|
||||
|
||||
#[structopt(about = "Run a program setup")]
|
||||
Setup {
|
||||
#[structopt(flatten)]
|
||||
cmd: Setup,
|
||||
command: Setup,
|
||||
},
|
||||
|
||||
#[structopt(about = "Run the program and produce a proof")]
|
||||
Prove {
|
||||
#[structopt(flatten)]
|
||||
cmd: Prove,
|
||||
command: Prove,
|
||||
},
|
||||
|
||||
#[structopt(about = "Run a program with input variables")]
|
||||
Run {
|
||||
#[structopt(flatten)]
|
||||
cmd: Run,
|
||||
command: Run,
|
||||
},
|
||||
|
||||
#[structopt(about = "Clean current package: remove proof and circuits")]
|
||||
Clean {
|
||||
#[structopt(flatten)]
|
||||
cmd: Clean,
|
||||
command: Clean,
|
||||
},
|
||||
|
||||
#[structopt(about = "Watch for changes of Leo source files and run build")]
|
||||
Watch {
|
||||
#[structopt(flatten)]
|
||||
cmd: Watch,
|
||||
command: Watch,
|
||||
},
|
||||
|
||||
#[structopt(about = "Watch for changes of Leo source files and run build")]
|
||||
Update {
|
||||
#[structopt(flatten)]
|
||||
cmd: Update,
|
||||
command: Update,
|
||||
},
|
||||
|
||||
#[structopt(about = "Compile and run all tests in the current package")]
|
||||
Test {
|
||||
#[structopt(flatten)]
|
||||
cmd: Test,
|
||||
command: Test,
|
||||
},
|
||||
|
||||
#[structopt(about = "Import package from Aleo PM")]
|
||||
Add {
|
||||
#[structopt(flatten)]
|
||||
cmd: Add,
|
||||
command: Add,
|
||||
},
|
||||
|
||||
#[structopt(about = "Login to the package manager and store credentials")]
|
||||
Login {
|
||||
#[structopt(flatten)]
|
||||
cmd: Login,
|
||||
command: Login,
|
||||
},
|
||||
|
||||
#[structopt(about = "Logout - remove local credentials")]
|
||||
Logout {
|
||||
#[structopt(flatten)]
|
||||
cmd: Logout,
|
||||
command: Logout,
|
||||
},
|
||||
|
||||
#[structopt(about = "Publish package")]
|
||||
Publish {
|
||||
#[structopt(flatten)]
|
||||
cmd: Publish,
|
||||
command: Publish,
|
||||
},
|
||||
|
||||
#[structopt(about = "Remove imported package")]
|
||||
Remove {
|
||||
#[structopt(flatten)]
|
||||
cmd: Remove,
|
||||
command: Remove,
|
||||
},
|
||||
|
||||
#[structopt(about = "Lint package code (not implemented)")]
|
||||
Lint {
|
||||
#[structopt(flatten)]
|
||||
cmd: Lint,
|
||||
command: Lint,
|
||||
},
|
||||
|
||||
#[structopt(about = "Deploy the current package as a program to the network (*)")]
|
||||
Deploy {
|
||||
#[structopt(flatten)]
|
||||
cmd: Deploy,
|
||||
command: Deploy,
|
||||
},
|
||||
}
|
||||
|
||||
@ -178,25 +177,25 @@ fn main() {
|
||||
}
|
||||
|
||||
handle_error(match opt.command {
|
||||
CommandOpts::Init { cmd } => cmd.try_execute(),
|
||||
CommandOpts::New { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Build { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Setup { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Prove { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Test { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Run { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Clean { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Watch { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Update { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Init { command } => command.try_execute(),
|
||||
CommandOpts::New { command } => command.try_execute(),
|
||||
CommandOpts::Build { command } => command.try_execute(),
|
||||
CommandOpts::Setup { command } => command.try_execute(),
|
||||
CommandOpts::Prove { command } => command.try_execute(),
|
||||
CommandOpts::Test { command } => command.try_execute(),
|
||||
CommandOpts::Run { command } => command.try_execute(),
|
||||
CommandOpts::Clean { command } => command.try_execute(),
|
||||
CommandOpts::Watch { command } => command.try_execute(),
|
||||
CommandOpts::Update { command } => command.try_execute(),
|
||||
|
||||
CommandOpts::Add { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Login { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Logout { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Publish { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Remove { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Add { command } => command.try_execute(),
|
||||
CommandOpts::Login { command } => command.try_execute(),
|
||||
CommandOpts::Logout { command } => command.try_execute(),
|
||||
CommandOpts::Publish { command } => command.try_execute(),
|
||||
CommandOpts::Remove { command } => command.try_execute(),
|
||||
|
||||
CommandOpts::Lint { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Deploy { cmd } => cmd.try_execute(),
|
||||
CommandOpts::Lint { command } => command.try_execute(),
|
||||
CommandOpts::Deploy { command } => command.try_execute(),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,9 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use crate::synthesizer::{CircuitSynthesizer, SerializedField, SerializedIndex};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use snarkvm_curves::bls12_377::Bls12_377;
|
||||
use snarkvm_errors::curves::FieldError;
|
||||
use snarkvm_models::{
|
||||
@ -23,8 +24,7 @@ use snarkvm_models::{
|
||||
gadgets::r1cs::{ConstraintSystem, Index},
|
||||
};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::convert::TryFrom;
|
||||
use crate::synthesizer::{CircuitSynthesizer, SerializedField, SerializedIndex};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct SerializedCircuit {
|
||||
|
@ -14,12 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use snarkvm_errors::curves::FieldError;
|
||||
use snarkvm_models::curves::{Field, Fp256, Fp256Parameters};
|
||||
use std::{convert::TryFrom, str::FromStr};
|
||||
|
||||
use num_bigint::BigUint;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{convert::TryFrom, str::FromStr};
|
||||
use snarkvm_errors::curves::FieldError;
|
||||
use snarkvm_models::curves::{Field, Fp256, Fp256Parameters};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct SerializedField(pub String);
|
||||
|
@ -14,9 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use snarkvm_models::gadgets::r1cs::Index;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use snarkvm_models::gadgets::r1cs::Index;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum SerializedIndex {
|
||||
|
@ -14,6 +14,10 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::{
|
||||
commands::{
|
||||
package::{Login, Logout},
|
||||
@ -28,8 +32,6 @@ use crate::{
|
||||
},
|
||||
context::{create_context, Context},
|
||||
};
|
||||
use anyhow::Result;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Path to the only complex Leo program that we have
|
||||
/// - relative to source dir - where Cargo.toml is located
|
||||
|
@ -13,12 +13,12 @@
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
use crate::config::Config;
|
||||
use anyhow::{anyhow, Error};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use colored::Colorize;
|
||||
use self_update::{backends::github, version::bump_is_greater, Status};
|
||||
|
||||
use crate::config::Config;
|
||||
|
||||
pub struct Updater;
|
||||
|
||||
// TODO Add logic for users to easily select release versions.
|
||||
@ -28,7 +28,7 @@ impl Updater {
|
||||
const LEO_REPO_OWNER: &'static str = "AleoHQ";
|
||||
|
||||
/// Show all available releases for `leo`.
|
||||
pub fn show_available_releases() -> Result<(), Error> {
|
||||
pub fn show_available_releases() -> Result<()> {
|
||||
let releases = github::ReleaseList::configure()
|
||||
.repo_owner(Self::LEO_REPO_OWNER)
|
||||
.repo_name(Self::LEO_REPO_NAME)
|
||||
@ -47,7 +47,7 @@ impl Updater {
|
||||
}
|
||||
|
||||
/// Update `leo` to the latest release.
|
||||
pub fn update_to_latest_release(show_output: bool) -> Result<Status, Error> {
|
||||
pub fn update_to_latest_release(show_output: bool) -> Result<Status> {
|
||||
let status = github::Update::configure()
|
||||
.repo_owner(Self::LEO_REPO_OWNER)
|
||||
.repo_name(Self::LEO_REPO_NAME)
|
||||
@ -63,7 +63,7 @@ impl Updater {
|
||||
}
|
||||
|
||||
/// Check if there is an available update for `leo` and return the newest release.
|
||||
pub fn update_available() -> Result<String, Error> {
|
||||
pub fn update_available() -> Result<String> {
|
||||
let updater = github::Update::configure()
|
||||
.repo_owner(Self::LEO_REPO_OWNER)
|
||||
.repo_name(Self::LEO_REPO_NAME)
|
||||
|
Loading…
Reference in New Issue
Block a user