mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-26 02:53:08 +03:00
fix imports
This commit is contained in:
parent
d7167f5b2b
commit
dcd484a62f
@ -1,6 +1,7 @@
|
||||
use leo_compiler::errors::CompilerError;
|
||||
use leo_compiler::{self, ast, ParameterValue, Program};
|
||||
use leo_compiler::{self, ast, errors::CompilerError, ParameterValue, Program};
|
||||
|
||||
use from_pest::FromPest;
|
||||
use rand::thread_rng;
|
||||
use snarkos_algorithms::snark::{
|
||||
create_random_proof, generate_random_parameters, prepare_verifying_key, verify_proof,
|
||||
};
|
||||
@ -10,9 +11,6 @@ use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::r1cs::{ConstraintSynthesizer, ConstraintSystem},
|
||||
};
|
||||
|
||||
use from_pest::FromPest;
|
||||
use rand::thread_rng;
|
||||
use std::{
|
||||
fs,
|
||||
marker::PhantomData,
|
||||
|
@ -1,8 +1,4 @@
|
||||
//! Abstract syntax tree (ast) representation from leo.pest.
|
||||
//!
|
||||
//! @file zokrates_program.rs
|
||||
//! @author Howard Wu <howard@aleo.org>
|
||||
//! @date 2020
|
||||
|
||||
use from_pest::{ConversionError, FromPest, Void};
|
||||
use pest::{
|
||||
|
@ -1,5 +1,6 @@
|
||||
use crate::errors::CompilerError;
|
||||
use crate::{ast, ParameterValue, Program, ResolvedProgram, ResolvedValue};
|
||||
//! Compiles a Leo program from a file path.
|
||||
|
||||
use crate::{ast, errors::CompilerError, ParameterValue, Program, ResolvedProgram, ResolvedValue};
|
||||
|
||||
use snarkos_errors::gadgets::SynthesisError;
|
||||
use snarkos_models::{
|
||||
|
@ -1,13 +1,17 @@
|
||||
//! Methods to enforce constraints on booleans in a resolved aleo program.
|
||||
//! Methods to enforce constraints on booleans in a resolved Leo program.
|
||||
|
||||
use crate::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::{new_variable_from_variable, ParameterModel, ParameterValue, Variable};
|
||||
use crate::{
|
||||
constraints::{new_variable_from_variable, ResolvedProgram, ResolvedValue},
|
||||
types::{ParameterModel, ParameterValue, Variable},
|
||||
};
|
||||
|
||||
use snarkos_errors::gadgets::SynthesisError;
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{
|
||||
r1cs::ConstraintSystem,
|
||||
utilities::{alloc::AllocGadget, boolean::Boolean, eq::EqGadget},
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::{
|
||||
r1cs::ConstraintSystem,
|
||||
utilities::{alloc::AllocGadget, boolean::Boolean, eq::EqGadget},
|
||||
},
|
||||
};
|
||||
|
||||
impl<F: Field + PrimeField, CS: ConstraintSystem<F>> ResolvedProgram<F, CS> {
|
||||
|
@ -1,14 +1,17 @@
|
||||
//! Methods to enforce constraints on expressions in a resolved aleo program.
|
||||
//! Methods to enforce constraints on expressions in a resolved Leo program.
|
||||
|
||||
use crate::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||
use crate::{
|
||||
new_variable_from_variable, Expression, RangeOrExpression, ResolvedStructMember,
|
||||
SpreadOrExpression, StructMember, Variable,
|
||||
constraints::{
|
||||
new_scope_from_variable, new_variable_from_variable, ResolvedProgram, ResolvedStructMember,
|
||||
ResolvedValue,
|
||||
},
|
||||
types::{Expression, RangeOrExpression, SpreadOrExpression, StructMember, Variable},
|
||||
};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkos_models::gadgets::utilities::boolean::Boolean;
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean},
|
||||
};
|
||||
|
||||
impl<F: Field + PrimeField, CS: ConstraintSystem<F>> ResolvedProgram<F, CS> {
|
||||
/// Enforce a variable expression by getting the resolved value
|
||||
|
@ -1,13 +1,17 @@
|
||||
//! Methods to enforce constraints on field elements in a resolved aleo program.
|
||||
//! Methods to enforce constraints on field elements in a resolved Leo program.
|
||||
|
||||
use crate::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::{new_variable_from_variable, FieldElement, ParameterModel, ParameterValue, Variable};
|
||||
use crate::{
|
||||
constraints::{new_variable_from_variable, FieldElement, ResolvedProgram, ResolvedValue},
|
||||
types::{ParameterModel, ParameterValue, Variable},
|
||||
};
|
||||
|
||||
use snarkos_errors::gadgets::SynthesisError;
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{
|
||||
r1cs::{ConstraintSystem, LinearCombination, Variable as R1CSVariable},
|
||||
utilities::uint32::UInt32,
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::{
|
||||
r1cs::{ConstraintSystem, LinearCombination, Variable as R1CSVariable},
|
||||
utilities::uint32::UInt32,
|
||||
},
|
||||
};
|
||||
|
||||
impl<F: Field + PrimeField, CS: ConstraintSystem<F>> ResolvedProgram<F, CS> {
|
||||
|
@ -1,14 +1,17 @@
|
||||
//! Methods to enforce constraints on integers in a resolved aleo program.
|
||||
//! Methods to enforce constraints on integers in a resolved Leo program.
|
||||
|
||||
use crate::constraints::{ResolvedProgram, ResolvedValue};
|
||||
use crate::{new_variable_from_variable, Integer, ParameterModel, ParameterValue, Variable};
|
||||
use crate::{
|
||||
constraints::{new_variable_from_variable, ResolvedProgram, ResolvedValue},
|
||||
types::{Integer, ParameterModel, ParameterValue, Variable},
|
||||
};
|
||||
|
||||
use snarkos_errors::gadgets::SynthesisError;
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::utilities::eq::EqGadget;
|
||||
use snarkos_models::gadgets::{
|
||||
r1cs::ConstraintSystem,
|
||||
utilities::{alloc::AllocGadget, boolean::Boolean, uint32::UInt32},
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::{
|
||||
r1cs::ConstraintSystem,
|
||||
utilities::{alloc::AllocGadget, boolean::Boolean, eq::EqGadget, uint32::UInt32},
|
||||
},
|
||||
};
|
||||
|
||||
impl<F: Field + PrimeField, CS: ConstraintSystem<F>> ResolvedProgram<F, CS> {
|
||||
|
@ -1,4 +1,5 @@
|
||||
//! Methods to enforce constraints and construct a resolved aleo program.
|
||||
//! Methods to enforce the main function with arguments in
|
||||
//! a resolved Leo program.
|
||||
|
||||
use crate::{
|
||||
ast,
|
||||
@ -6,13 +7,15 @@ use crate::{
|
||||
new_scope, new_scope_from_variable, new_variable_from_variables, ResolvedProgram,
|
||||
ResolvedValue,
|
||||
},
|
||||
types::{Expression, Function, Program, Type},
|
||||
Import, ParameterValue,
|
||||
types::{Expression, Function, ParameterValue, Program, Type},
|
||||
Import,
|
||||
};
|
||||
|
||||
use from_pest::FromPest;
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::r1cs::ConstraintSystem;
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::r1cs::ConstraintSystem,
|
||||
};
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
@ -1,10 +1,10 @@
|
||||
//! Module containing methods to enforce constraints in an aleo program
|
||||
//! Module containing methods to enforce constraints in an Leo program
|
||||
|
||||
pub mod boolean;
|
||||
pub use boolean::*;
|
||||
|
||||
pub mod constraints;
|
||||
pub use constraints::*;
|
||||
pub mod main_function;
|
||||
pub use main_function::*;
|
||||
|
||||
pub mod expression;
|
||||
pub use expression::*;
|
||||
|
@ -1,12 +1,12 @@
|
||||
//! 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 a Leo program.
|
||||
|
||||
use crate::constraints::ResolvedValue;
|
||||
use crate::types::Variable;
|
||||
use crate::{constraints::ResolvedValue, types::Variable};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::r1cs::ConstraintSystem;
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::r1cs::ConstraintSystem,
|
||||
};
|
||||
use std::{collections::HashMap, marker::PhantomData};
|
||||
|
||||
pub struct ResolvedProgram<F: Field + PrimeField, CS: ConstraintSystem<F>> {
|
||||
pub resolved_names: HashMap<String, ResolvedValue<F>>,
|
||||
|
@ -1,10 +1,12 @@
|
||||
//! 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 Leo program.
|
||||
|
||||
use crate::types::{Function, Struct, Type, Variable};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{
|
||||
r1cs::Variable as R1CSVariable, utilities::boolean::Boolean, utilities::uint32::UInt32,
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::{
|
||||
r1cs::Variable as R1CSVariable, utilities::boolean::Boolean, utilities::uint32::UInt32,
|
||||
},
|
||||
};
|
||||
use std::fmt;
|
||||
|
||||
|
@ -1,14 +1,16 @@
|
||||
//! Methods to enforce constraints on statements in a resolved aleo program.
|
||||
//! Methods to enforce constraints on statements in a resolved Leo program.
|
||||
|
||||
use crate::constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue};
|
||||
use crate::{
|
||||
Assignee, ConditionalNestedOrEnd, ConditionalStatement, Expression, Integer, RangeOrExpression,
|
||||
Statement, Type, Variable,
|
||||
constraints::{new_scope_from_variable, ResolvedProgram, ResolvedValue},
|
||||
types::{
|
||||
Assignee, ConditionalNestedOrEnd, ConditionalStatement, Expression, Integer,
|
||||
RangeOrExpression, Statement, Type, Variable,
|
||||
},
|
||||
};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use snarkos_models::gadgets::{
|
||||
r1cs::ConstraintSystem, utilities::boolean::Boolean, utilities::uint32::UInt32,
|
||||
use snarkos_models::{
|
||||
curves::{Field, PrimeField},
|
||||
gadgets::{r1cs::ConstraintSystem, utilities::boolean::Boolean, utilities::uint32::UInt32},
|
||||
};
|
||||
|
||||
impl<F: Field + PrimeField, CS: ConstraintSystem<F>> ResolvedProgram<F, CS> {
|
||||
|
@ -1,3 +1,5 @@
|
||||
//! The Import type for a Leo program.
|
||||
|
||||
use crate::Variable;
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! Module containing structs and types that make up an Leo program.
|
||||
//! Module containing structs and types that make up a Leo program.
|
||||
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! A typed program in aleo consists of import, struct, and function definitions.
|
||||
//! A typed Leo program consists of import, struct, and function definitions.
|
||||
//! Each defined type consists of typed statements and expressions.
|
||||
|
||||
use crate::Import;
|
||||
|
@ -1,4 +1,4 @@
|
||||
//! Format display functions for zokrates_program types.
|
||||
//! Format display functions for Leo types.
|
||||
|
||||
use crate::{
|
||||
Assignee, ConditionalNestedOrEnd, ConditionalStatement, Expression, Function, FunctionName,
|
||||
|
@ -1,11 +1,9 @@
|
||||
//! 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 Leo program.
|
||||
|
||||
use crate::{ast, FunctionName};
|
||||
use crate::{types, Import, ImportSymbol};
|
||||
use crate::{ast, types, Import, ImportSymbol};
|
||||
|
||||
use snarkos_models::curves::{Field, PrimeField};
|
||||
use std::collections::HashMap;
|
||||
use std::marker::PhantomData;
|
||||
use std::{collections::HashMap, marker::PhantomData};
|
||||
|
||||
/// pest ast -> types::Variable
|
||||
|
||||
@ -730,7 +728,7 @@ impl<'ast, F: Field + PrimeField> types::Program<F> {
|
||||
);
|
||||
});
|
||||
|
||||
if let Some(main_function) = functions.get(&FunctionName("main".into())) {
|
||||
if let Some(main_function) = functions.get(&types::FunctionName("main".into())) {
|
||||
num_parameters = main_function.parameters.len();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user