mirror of
https://github.com/ProvableHQ/leo.git
synced 2024-12-25 03:04:13 +03:00
merge master
This commit is contained in:
commit
9e163428a9
35
Cargo.lock
generated
35
Cargo.lock
generated
@ -604,6 +604,41 @@ dependencies = [
|
|||||||
"snarkos-models",
|
"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]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.67"
|
version = "0.2.67"
|
||||||
|
@ -6,11 +6,14 @@ edition = "2018"
|
|||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "leo"
|
name = "leo"
|
||||||
path = "src/lib.rs"
|
path = "program/src/lib.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "leo"
|
name = "leo"
|
||||||
path = "src/main.rs"
|
path = "benchmark/src/main.rs"
|
||||||
|
|
||||||
|
[workspace]
|
||||||
|
members = [ "benchmark", "program" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
snarkos-algorithms = { path = "../snarkOS/algorithms", version = "0.8.0" }
|
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::{
|
use snarkos_algorithms::snark::{
|
||||||
create_random_proof, generate_random_parameters, prepare_verifying_key, verify_proof,
|
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");
|
let syntax_tree = ast::File::from_pest(&mut file).expect("infallible");
|
||||||
// println!("{:#?}", syntax_tree);
|
// println!("{:#?}", syntax_tree);
|
||||||
|
|
||||||
let program = program::Program::<'_, F>::from(syntax_tree);
|
let program = leo_program::Program::<'_, F>::from(syntax_tree);
|
||||||
println!(" compiled: {:#?}", program);
|
println!(" compiled: {:#?}", program);
|
||||||
|
|
||||||
let program = program.name("simple".into());
|
let program = program.name("simple".into());
|
||||||
program::ResolvedProgram::generate_constraints(cs, program);
|
leo_program::ResolvedProgram::generate_constraints(cs, program);
|
||||||
|
|
||||||
Ok(())
|
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.
|
//! 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::constraints::{ResolvedProgram, ResolvedValue};
|
||||||
use crate::program::{new_variable_from_variable, Parameter, Variable};
|
use crate::{new_variable_from_variable, Parameter, Variable};
|
||||||
|
|
||||||
use snarkos_models::curves::{Field, PrimeField};
|
use snarkos_models::curves::{Field, PrimeField};
|
||||||
use snarkos_models::gadgets::{
|
use snarkos_models::gadgets::{
|
@ -1,12 +1,8 @@
|
|||||||
//! Methods to enforce constraints a resolved aleo program.
|
//! Methods to enforce constraints a resolved aleo program.
|
||||||
//!
|
|
||||||
//! @file constraints.rs
|
|
||||||
//! @author Collin Chin <collin@aleo.org>
|
|
||||||
//! @date 2020
|
|
||||||
|
|
||||||
use crate::ast;
|
use crate::ast;
|
||||||
use crate::program::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
use crate::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||||
use crate::program::{Expression, Function, Import, Program, Statement, Type};
|
use crate::{Expression, Function, Import, Program, Statement, Type};
|
||||||
|
|
||||||
use from_pest::FromPest;
|
use from_pest::FromPest;
|
||||||
use snarkos_models::curves::{Field, PrimeField};
|
use snarkos_models::curves::{Field, PrimeField};
|
@ -1,11 +1,7 @@
|
|||||||
//! Methods to enforce constraints on expressions in a resolved aleo program.
|
//! 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::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||||
use crate::program::{
|
use crate::{
|
||||||
Expression, RangeOrExpression, ResolvedStructMember, SpreadOrExpression, StructMember, Variable,
|
Expression, RangeOrExpression, ResolvedStructMember, SpreadOrExpression, StructMember, Variable,
|
||||||
};
|
};
|
||||||
|
|
@ -1,11 +1,7 @@
|
|||||||
//! Methods to enforce constraints on field elements in a resolved aleo program.
|
//! 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::constraints::{ResolvedProgram, ResolvedValue};
|
||||||
use crate::program::{new_variable_from_variable, Parameter, Variable};
|
use crate::{new_variable_from_variable, Parameter, Variable};
|
||||||
|
|
||||||
use snarkos_models::curves::{Field, PrimeField};
|
use snarkos_models::curves::{Field, PrimeField};
|
||||||
use snarkos_models::gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean};
|
use snarkos_models::gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean};
|
@ -1,11 +1,7 @@
|
|||||||
//! Methods to enforce constraints on integers in a resolved aleo program.
|
//! 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::constraints::{ResolvedProgram, ResolvedValue};
|
||||||
use crate::program::{new_variable_from_variable, Integer, Parameter, Variable};
|
use crate::{new_variable_from_variable, Integer, Parameter, Variable};
|
||||||
|
|
||||||
use snarkos_models::curves::{Field, PrimeField};
|
use snarkos_models::curves::{Field, PrimeField};
|
||||||
use snarkos_models::gadgets::{
|
use snarkos_models::gadgets::{
|
@ -1,8 +1,4 @@
|
|||||||
//! Module containing methods to enforce constraints in an aleo program
|
//! 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 mod boolean;
|
||||||
pub use boolean::*;
|
pub use boolean::*;
|
@ -1,11 +1,7 @@
|
|||||||
//! An in memory store to keep track of defined names when constraining an aleo program.
|
//! 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::constraints::ResolvedValue;
|
||||||
use crate::program::types::Variable;
|
use crate::types::Variable;
|
||||||
|
|
||||||
use snarkos_models::curves::{Field, PrimeField};
|
use snarkos_models::curves::{Field, PrimeField};
|
||||||
use snarkos_models::gadgets::r1cs::ConstraintSystem;
|
use snarkos_models::gadgets::r1cs::ConstraintSystem;
|
@ -1,10 +1,6 @@
|
|||||||
//! The in memory stored value for a defined name in a resolved aleo program.
|
//! 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, Type, Variable};
|
use crate::types::{Function, Struct, Type, Variable};
|
||||||
|
|
||||||
use snarkos_models::curves::{Field, PrimeField};
|
use snarkos_models::curves::{Field, PrimeField};
|
||||||
use snarkos_models::gadgets::{utilities::boolean::Boolean, utilities::uint32::UInt32};
|
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.
|
//! 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::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||||
use crate::program::{Assignee, Expression, Integer, RangeOrExpression, Statement, Type, Variable};
|
use crate::{Assignee, Expression, Integer, RangeOrExpression, Statement, Type, Variable};
|
||||||
|
|
||||||
use snarkos_models::curves::{Field, PrimeField};
|
use snarkos_models::curves::{Field, PrimeField};
|
||||||
use snarkos_models::gadgets::{r1cs::ConstraintSystem, utilities::uint32::UInt32};
|
use snarkos_models::gadgets::{r1cs::ConstraintSystem, utilities::uint32::UInt32};
|
@ -1,8 +1,14 @@
|
|||||||
//! Module containing structs and types that make up an aleo program.
|
//! Module containing structs and types that make up an Leo program.
|
||||||
//!
|
|
||||||
//! @file aleo_program/mod.rs
|
extern crate from_pest;
|
||||||
//! @author Collin Chin <collin@aleo.org>
|
#[macro_use]
|
||||||
//! @date 2020
|
extern crate lazy_static;
|
||||||
|
extern crate pest;
|
||||||
|
extern crate pest_ast;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate pest_derive;
|
||||||
|
|
||||||
|
pub mod ast;
|
||||||
|
|
||||||
pub mod constraints;
|
pub mod constraints;
|
||||||
pub use self::constraints::*;
|
pub use self::constraints::*;
|
@ -1,11 +1,7 @@
|
|||||||
//! A typed program in aleo consists of import, struct, and function definitions.
|
//! A typed program in aleo consists of import, struct, and function definitions.
|
||||||
//! Each defined type consists of typed statements and expressions.
|
//! 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 snarkos_models::curves::{Field, PrimeField};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
@ -1,10 +1,6 @@
|
|||||||
//! Format display functions for zokrates_program types.
|
//! 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,
|
Assignee, Expression, Function, FunctionName, Integer, Parameter, RangeOrExpression,
|
||||||
SpreadOrExpression, Statement, Struct, StructField, Type, Variable,
|
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.
|
//! 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::ast;
|
||||||
use crate::program::{types, Import, PathString};
|
use crate::{types, Import, PathString};
|
||||||
|
|
||||||
use snarkos_models::curves::{Field, PrimeField};
|
use snarkos_models::curves::{Field, PrimeField};
|
||||||
use std::collections::HashMap;
|
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