mirror of
https://github.com/AleoHQ/leo.git
synced 2024-09-11 15:05:33 +03:00
Migrate to workspace
This commit is contained in:
parent
7500f9a5fd
commit
1ec03fdb09
35
Cargo.lock
generated
35
Cargo.lock
generated
@ -604,6 +604,41 @@ dependencies = [
|
||||
"snarkos-models",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "leo-benchmark"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"from-pest",
|
||||
"lazy_static",
|
||||
"leo-program",
|
||||
"pest",
|
||||
"pest-ast",
|
||||
"pest_derive",
|
||||
"rand 0.7.3",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
"snarkos-errors",
|
||||
"snarkos-gadgets",
|
||||
"snarkos-models",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "leo-program"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"from-pest",
|
||||
"lazy_static",
|
||||
"pest",
|
||||
"pest-ast",
|
||||
"pest_derive",
|
||||
"rand 0.7.3",
|
||||
"snarkos-algorithms",
|
||||
"snarkos-curves",
|
||||
"snarkos-errors",
|
||||
"snarkos-gadgets",
|
||||
"snarkos-models",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.67"
|
||||
|
@ -6,11 +6,14 @@ edition = "2018"
|
||||
|
||||
[lib]
|
||||
name = "leo"
|
||||
path = "src/lib.rs"
|
||||
path = "program/src/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "leo"
|
||||
path = "src/main.rs"
|
||||
path = "benchmark/src/main.rs"
|
||||
|
||||
[workspace]
|
||||
members = [ "benchmark", "program" ]
|
||||
|
||||
[dependencies]
|
||||
snarkos-algorithms = { path = "../snarkOS/algorithms", version = "0.8.0" }
|
||||
|
21
benchmark/Cargo.toml
Normal file
21
benchmark/Cargo.toml
Normal file
@ -0,0 +1,21 @@
|
||||
[package]
|
||||
name = "leo-benchmark"
|
||||
version = "0.1.0"
|
||||
authors = ["The Aleo Team <hello@aleo.org>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
leo-program = { path = "../program", version = "0.1.0" }
|
||||
|
||||
snarkos-algorithms = { path = "../../snarkOS/algorithms", version = "0.8.0" }
|
||||
snarkos-curves = { path = "../../snarkOS/curves", version = "0.8.0" }
|
||||
snarkos-errors = { path = "../../snarkOS/errors", version = "0.8.0" }
|
||||
snarkos-gadgets = { path = "../../snarkOS/gadgets", version = "0.8.0" }
|
||||
snarkos-models = { path = "../../snarkOS/models", version = "0.8.0" }
|
||||
|
||||
from-pest = { version = "0.3.1" }
|
||||
lazy_static = { version = "1.3.0" }
|
||||
pest = { version = "2.0" }
|
||||
pest-ast = { version = "0.3.3" }
|
||||
pest_derive = { version = "2.0" }
|
||||
rand = { version = "0.7" }
|
@ -1,4 +1,4 @@
|
||||
use leo::*;
|
||||
use leo_program::{self, ast};
|
||||
|
||||
use snarkos_algorithms::snark::{
|
||||
create_random_proof, generate_random_parameters, prepare_verifying_key, verify_proof,
|
||||
@ -45,11 +45,11 @@ impl<F: Field + PrimeField> ConstraintSynthesizer<F> for Benchmark<F> {
|
||||
let syntax_tree = ast::File::from_pest(&mut file).expect("infallible");
|
||||
// println!("{:#?}", syntax_tree);
|
||||
|
||||
let program = program::Program::<'_, F>::from(syntax_tree);
|
||||
let program = leo_program::Program::<'_, F>::from(syntax_tree);
|
||||
println!(" compiled: {:#?}", program);
|
||||
|
||||
let program = program.name("simple".into());
|
||||
program::ResolvedProgram::generate_constraints(cs, program);
|
||||
leo_program::ResolvedProgram::generate_constraints(cs, program);
|
||||
|
||||
Ok(())
|
||||
}
|
19
program/Cargo.toml
Normal file
19
program/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "leo-program"
|
||||
version = "0.1.0"
|
||||
authors = ["The Aleo Team <hello@aleo.org>"]
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
snarkos-algorithms = { path = "../../snarkOS/algorithms", version = "0.8.0" }
|
||||
snarkos-curves = { path = "../../snarkOS/curves", version = "0.8.0" }
|
||||
snarkos-errors = { path = "../../snarkOS/errors", version = "0.8.0" }
|
||||
snarkos-gadgets = { path = "../../snarkOS/gadgets", version = "0.8.0" }
|
||||
snarkos-models = { path = "../../snarkOS/models", version = "0.8.0" }
|
||||
|
||||
from-pest = { version = "0.3.1" }
|
||||
lazy_static = { version = "1.3.0" }
|
||||
pest = { version = "2.0" }
|
||||
pest-ast = { version = "0.3.3" }
|
||||
pest_derive = { version = "2.0" }
|
||||
rand = { version = "0.7" }
|
1
program/README.md
Normal file
1
program/README.md
Normal file
@ -0,0 +1 @@
|
||||
# leo-program
|
@ -1,11 +1,7 @@
|
||||
//! Methods to enforce constraints on booleans in a resolved aleo program.
|
||||
//!
|
||||
//! @file boolean.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::program::{new_variable_from_variable, Parameter, Variable};
|
||||
use crate::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::{new_variable_from_variable, Parameter, Variable};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{
|
@ -1,12 +1,8 @@
|
||||
//! Methods to enforce constraints a resolved aleo program.
|
||||
//!
|
||||
//! @file constraints.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::ast;
|
||||
use crate::program::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||
use crate::program::{Expression, Function, Import, Program, Statement, Type};
|
||||
use crate::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||
use crate::{Expression, Function, Import, Program, Statement, Type};
|
||||
|
||||
use from_pest::FromPest;
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
@ -1,11 +1,7 @@
|
||||
//! Methods to enforce constraints on expressions in a resolved aleo program.
|
||||
//!
|
||||
//! @file expression.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||
use crate::program::{Expression, RangeOrExpression, SpreadOrExpression, StructMember, Variable};
|
||||
use crate::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||
use crate::{Expression, RangeOrExpression, SpreadOrExpression, StructMember, Variable};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::r1cs::ConstraintSystem;
|
@ -1,11 +1,7 @@
|
||||
//! Methods to enforce constraints on field elements in a resolved aleo program.
|
||||
//!
|
||||
//! @file field_element.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::program::{new_variable_from_variable, Parameter, Variable};
|
||||
use crate::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::{new_variable_from_variable, Parameter, Variable};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean};
|
@ -1,11 +1,7 @@
|
||||
//! Methods to enforce constraints on integers in a resolved aleo program.
|
||||
//!
|
||||
//! @file integer.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::program::{new_variable_from_variable, Integer, Parameter, Variable};
|
||||
use crate::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::{new_variable_from_variable, Integer, Parameter, Variable};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{
|
@ -1,8 +1,4 @@
|
||||
//! Module containing methods to enforce constraints in an aleo program
|
||||
//!
|
||||
//! @file constraints/mod.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
pub mod boolean;
|
||||
pub use boolean::*;
|
@ -1,11 +1,7 @@
|
||||
//! An in memory store to keep track of defined names when constraining an aleo program.
|
||||
//!
|
||||
//! @file resolved_program.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::constraints::ResolvedValue;
|
||||
use crate::program::types::Variable;
|
||||
use crate::constraints::ResolvedValue;
|
||||
use crate::types::Variable;
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::r1cs::ConstraintSystem;
|
@ -1,10 +1,6 @@
|
||||
//! The in memory stored value for a defined name in a resolved aleo program.
|
||||
//!
|
||||
//! @file resolved_value.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::types::{Function, Struct, StructMember, Type, Variable};
|
||||
use crate::types::{Function, Struct, StructMember, Type, Variable};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{utilities::boolean::Boolean, utilities::uint32::UInt32};
|
@ -1,11 +1,7 @@
|
||||
//! Methods to enforce constraints on statements in a resolved aleo program.
|
||||
//!
|
||||
//! @file statement.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||
use crate::program::{Assignee, Expression, Integer, RangeOrExpression, Statement, Type, Variable};
|
||||
use crate::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||
use crate::{Assignee, Expression, Integer, RangeOrExpression, Statement, Type, Variable};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{r1cs::ConstraintSystem, utilities::uint32::UInt32};
|
@ -1,8 +1,12 @@
|
||||
//! Module containing structs and types that make up an aleo program.
|
||||
//!
|
||||
//! @file aleo_program/mod.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
//! Module containing structs and types that make up an Leo program.
|
||||
|
||||
extern crate from_pest;
|
||||
#[macro_use] extern crate lazy_static;
|
||||
extern crate pest;
|
||||
extern crate pest_ast;
|
||||
#[macro_use] extern crate pest_derive;
|
||||
|
||||
pub mod ast;
|
||||
|
||||
pub mod constraints;
|
||||
pub use self::constraints::*;
|
@ -1,11 +1,7 @@
|
||||
//! A typed program in aleo consists of import, struct, and function definitions.
|
||||
//! Each defined type consists of typed statements and expressions.
|
||||
//!
|
||||
//! @file types.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::Import;
|
||||
use crate::Import;
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use std::collections::HashMap;
|
@ -1,10 +1,6 @@
|
||||
//! Format display functions for zokrates_program types.
|
||||
//!
|
||||
//! @file zokrates_program.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::program::{
|
||||
use crate::{
|
||||
Assignee, Expression, Function, FunctionName, Integer, Parameter, RangeOrExpression,
|
||||
SpreadOrExpression, Statement, Struct, StructField, Type, Variable,
|
||||
};
|
@ -1,11 +1,7 @@
|
||||
//! Logic to convert from an abstract syntax tree (ast) representation to a typed aleo program.
|
||||
//!
|
||||
//! @file types_from.rs
|
||||
//! @author Collin Chin <collin@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use crate::ast;
|
||||
use crate::program::{types, Import, PathString};
|
||||
use crate::{types, Import, PathString};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use std::collections::HashMap;
|
11
src/lib.rs
11
src/lib.rs
@ -1,11 +0,0 @@
|
||||
extern crate from_pest;
|
||||
extern crate pest;
|
||||
extern crate pest_ast;
|
||||
#[macro_use]
|
||||
extern crate pest_derive;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
pub mod ast;
|
||||
pub mod program;
|
Loading…
Reference in New Issue
Block a user