From 384e9e6cfd5187dacfc2b97c0da32a6fd68a1a2a Mon Sep 17 00:00:00 2001 From: collin Date: Sat, 15 Aug 2020 18:36:39 -0700 Subject: [PATCH 1/7] impl annotations pest ast --- ast/src/annotations/annotation_arguments.rs | 14 ++++++++++++ ast/src/annotations/annotation_name.rs | 19 ++++++++++++++++ ast/src/annotations/annotation_symbol.rs | 13 +++++++++++ ast/src/annotations/annotations.rs | 20 +++++++++++++++++ ast/src/annotations/mod.rs | 11 +++++++++ ast/src/definitions/annotated_definition.rs | 15 +++++++++++++ ast/src/definitions/definition.rs | 2 ++ ast/src/definitions/mod.rs | 3 +++ ast/src/leo.pest | 25 ++++++++++++++++++++- ast/src/lib.rs | 1 + 10 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 ast/src/annotations/annotation_arguments.rs create mode 100644 ast/src/annotations/annotation_name.rs create mode 100644 ast/src/annotations/annotation_symbol.rs create mode 100644 ast/src/annotations/annotations.rs create mode 100644 ast/src/annotations/mod.rs create mode 100644 ast/src/definitions/annotated_definition.rs diff --git a/ast/src/annotations/annotation_arguments.rs b/ast/src/annotations/annotation_arguments.rs new file mode 100644 index 0000000000..182b7d617d --- /dev/null +++ b/ast/src/annotations/annotation_arguments.rs @@ -0,0 +1,14 @@ +use crate::{ast::Rule, common::Identifier, SpanDef}; + +use pest::Span; +use pest_ast::FromPest; +use serde::Serialize; + +#[derive(Clone, Debug, FromPest, PartialEq, Serialize)] +#[pest_ast(rule(Rule::annotation_arguments))] +pub struct AnnotationArguments<'ast> { + pub arguments: Vec>, + #[pest_ast(outer())] + #[serde(with = "SpanDef")] + pub span: Span<'ast>, +} diff --git a/ast/src/annotations/annotation_name.rs b/ast/src/annotations/annotation_name.rs new file mode 100644 index 0000000000..e5260cda85 --- /dev/null +++ b/ast/src/annotations/annotation_name.rs @@ -0,0 +1,19 @@ +use crate::{ast::Rule, SpanDef}; + +use pest::Span; +use pest_ast::FromPest; +use serde::Serialize; + +#[derive(Clone, Debug, FromPest, PartialEq, Serialize)] +#[pest_ast(rule(Rule::annotation_name))] +pub enum AnnotationName<'ast> { + Context(Context<'ast>), +} + +#[derive(Clone, Debug, FromPest, PartialEq, Serialize)] +#[pest_ast(rule(Rule::context))] +pub struct Context<'ast> { + #[pest_ast(outer())] + #[serde(with = "SpanDef")] + pub span: Span<'ast>, +} diff --git a/ast/src/annotations/annotation_symbol.rs b/ast/src/annotations/annotation_symbol.rs new file mode 100644 index 0000000000..b5e2b10bf5 --- /dev/null +++ b/ast/src/annotations/annotation_symbol.rs @@ -0,0 +1,13 @@ +use crate::{ast::Rule, SpanDef}; + +use pest::Span; +use pest_ast::FromPest; +use serde::Serialize; + +#[derive(Clone, Debug, FromPest, PartialEq, Serialize)] +#[pest_ast(rule(Rule::annotation_symbol))] +pub struct AnnotationSymbol<'ast> { + #[pest_ast(outer())] + #[serde(with = "SpanDef")] + pub span: Span<'ast>, +} diff --git a/ast/src/annotations/annotations.rs b/ast/src/annotations/annotations.rs new file mode 100644 index 0000000000..69b01558dd --- /dev/null +++ b/ast/src/annotations/annotations.rs @@ -0,0 +1,20 @@ +use crate::{ + annotations::{AnnotationArguments, AnnotationName, AnnotationSymbol}, + ast::Rule, + SpanDef, +}; + +use pest::Span; +use pest_ast::FromPest; +use serde::Serialize; + +#[derive(Clone, Debug, FromPest, PartialEq, Serialize)] +#[pest_ast(rule(Rule::annotation))] +pub struct Annotation<'ast> { + pub symbol: AnnotationSymbol<'ast>, + pub name: AnnotationName<'ast>, + pub arguments: AnnotationArguments<'ast>, + #[pest_ast(outer())] + #[serde(with = "SpanDef")] + pub span: Span<'ast>, +} diff --git a/ast/src/annotations/mod.rs b/ast/src/annotations/mod.rs new file mode 100644 index 0000000000..787b15ef19 --- /dev/null +++ b/ast/src/annotations/mod.rs @@ -0,0 +1,11 @@ +pub mod annotations; +pub use annotations::*; + +pub mod annotation_symbol; +pub use annotation_symbol::*; + +pub mod annotation_name; +pub use annotation_name::*; + +pub mod annotation_arguments; +pub use annotation_arguments::*; diff --git a/ast/src/definitions/annotated_definition.rs b/ast/src/definitions/annotated_definition.rs new file mode 100644 index 0000000000..8c3b15f6d8 --- /dev/null +++ b/ast/src/definitions/annotated_definition.rs @@ -0,0 +1,15 @@ +use crate::{annotations::Annotation, ast::Rule, definitions::Definition, SpanDef}; + +use pest::Span; +use pest_ast::FromPest; +use serde::Serialize; + +#[derive(Clone, Debug, FromPest, PartialEq, Serialize)] +#[pest_ast(rule(Rule::definition_annotated))] +pub struct AnnotatedDefinition<'ast> { + pub annotation: Annotation<'ast>, + pub definition: Box>, + #[pest_ast(outer())] + #[serde(with = "SpanDef")] + pub span: Span<'ast>, +} diff --git a/ast/src/definitions/definition.rs b/ast/src/definitions/definition.rs index 5f643f3cc0..c2858f4535 100644 --- a/ast/src/definitions/definition.rs +++ b/ast/src/definitions/definition.rs @@ -1,6 +1,7 @@ use crate::{ ast::Rule, circuits::Circuit, + definitions::AnnotatedDefinition, functions::{Function, TestFunction}, imports::Import, }; @@ -11,6 +12,7 @@ use serde::Serialize; #[derive(Clone, Debug, FromPest, PartialEq, Serialize)] #[pest_ast(rule(Rule::definition))] pub enum Definition<'ast> { + Annotated(AnnotatedDefinition<'ast>), Import(Import<'ast>), Circuit(Circuit<'ast>), Function(Function<'ast>), diff --git a/ast/src/definitions/mod.rs b/ast/src/definitions/mod.rs index c4cce58786..83cde009a3 100644 --- a/ast/src/definitions/mod.rs +++ b/ast/src/definitions/mod.rs @@ -1,2 +1,5 @@ +pub mod annotated_definition; +pub use annotated_definition::*; + pub mod definition; pub use definition::*; diff --git a/ast/src/leo.pest b/ast/src/leo.pest index 0ce0c2a3ec..5433a9e906 100644 --- a/ast/src/leo.pest +++ b/ast/src/leo.pest @@ -8,12 +8,16 @@ file = { SOI ~ NEWLINE* ~ definition* ~ NEWLINE* ~ EOI } // Declared in definitions/definition.rs definition = { - import + definition_annotated + | import | circuit | function | test_function } +// Declared in definitions/annotated_definition.rs +definition_annotated = { annotation ~ NEWLINE* ~ definition} + // Declared in common/identifier.rs identifier = @{ ((!protected_name ~ ASCII_ALPHA) | (protected_name ~ (ASCII_ALPHANUMERIC | "_"))) ~ (ASCII_ALPHANUMERIC | "_")* } protected_name = { @@ -457,3 +461,22 @@ debug = {"debug"} // Declared in macros/error.rs error = {"error"} +/// Annotations + +// Declared in annotations/annotation.rs +annotation = @{annotation_symbol ~ annotation_name ~ annotation_arguments} + +// Declared in annotations/annotation_symbol.rs +annotation_symbol = @{"@"} + +// Declared in annotations/annotation_name.rs +annotation_name = { + context +} + +// Declared in annotations/context.rs +context = {"context"} + +// Declared in annotations/annotation_argument.rs +annotation_arguments = !{"(" ~ NEWLINE* ~ identifier ~ ("," ~ NEWLINE* ~ identifier)* ~ ","? ~ NEWLINE* ~ ")"} + diff --git a/ast/src/lib.rs b/ast/src/lib.rs index 8585fcec6e..8b11d62b33 100644 --- a/ast/src/lib.rs +++ b/ast/src/lib.rs @@ -8,6 +8,7 @@ extern crate thiserror; mod ast; pub mod access; +pub mod annotations; pub mod circuits; pub mod common; pub mod definitions; From 779d926e6997f80cdc72c1278faae27b7e9d6b08 Mon Sep 17 00:00:00 2001 From: collin Date: Sat, 15 Aug 2020 19:20:41 -0700 Subject: [PATCH 2/7] impl annotations typed --- typed/src/annotation.rs | 58 ++++++++++++++++++++++++++++ typed/src/functions/test_function.rs | 12 ++++-- typed/src/lib.rs | 3 ++ typed/src/program.rs | 14 ++++++- 4 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 typed/src/annotation.rs diff --git a/typed/src/annotation.rs b/typed/src/annotation.rs new file mode 100644 index 0000000000..761dea19e3 --- /dev/null +++ b/typed/src/annotation.rs @@ -0,0 +1,58 @@ +use crate::{Circuit, Function, Identifier, Import, InputVariable, TestFunction}; +use leo_ast::{ + annotations::{Annotation, AnnotationArguments, AnnotationName}, + definitions::{AnnotatedDefinition, Definition}, +}; + +use std::collections::HashMap; + +pub fn load_annotation( + annotated_definition: AnnotatedDefinition, + _imports: &mut Vec, + _circuits: &mut HashMap, + _functions: &mut HashMap, + tests: &mut HashMap, + _expected: &mut Vec, +) { + let ast_annotation = annotated_definition.annotation; + let ast_definition = *annotated_definition.definition; + + match ast_definition { + Definition::Import(_) => unimplemented!("annotated imports are not supported yet"), + Definition::Circuit(_) => unimplemented!("annotated circuits are not supported yet"), + Definition::Function(_) => unimplemented!("annotated functions are not supported yet"), + Definition::TestFunction(ast_test) => { + let test = TestFunction::from(ast_test); + load_annotated_test(test, ast_annotation, tests) + } + Definition::Annotated(_) => unimplemented!("nested annotations are not supported yet"), + } +} + +pub fn load_annotated_test(test: TestFunction, annotation: Annotation, tests: &mut HashMap) { + let name = annotation.name; + let ast_arguments = annotation.arguments; + + match name { + AnnotationName::Context(_) => load_annotated_test_context(test, ast_arguments, tests), + } +} + +pub fn load_annotated_test_context( + mut test: TestFunction, + ast_arguments: AnnotationArguments, + tests: &mut HashMap, +) { + let arguments = ast_arguments.arguments; + + if arguments.len() != 1 { + panic!("text context annotation must have one argument identifier") + } + + let ast_input_file = arguments[0].to_owned(); + let input_file = Identifier::from(ast_input_file); + + test.input_file = Some(input_file); + + tests.insert(test.function.identifier.clone(), test); +} diff --git a/typed/src/functions/test_function.rs b/typed/src/functions/test_function.rs index cc20c13ad7..f82344afc2 100644 --- a/typed/src/functions/test_function.rs +++ b/typed/src/functions/test_function.rs @@ -1,13 +1,19 @@ -use crate::Function; +use crate::{Function, Identifier}; use leo_ast::functions::TestFunction as AstTestFunction; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct TestFunction(pub Function); +pub struct TestFunction { + pub function: Function, + pub input_file: Option, +} impl<'ast> From> for TestFunction { fn from(test: AstTestFunction) -> Self { - TestFunction(Function::from(test.function)) + TestFunction { + function: Function::from(test.function), + input_file: None, // pass custom input file with `@context` annotation + } } } diff --git a/typed/src/lib.rs b/typed/src/lib.rs index c1d90de64c..e52df4e8cb 100644 --- a/typed/src/lib.rs +++ b/typed/src/lib.rs @@ -1,6 +1,9 @@ //! A typed syntax tree is represented as a `Program` and consists of import, circuit, and function definitions. //! Each defined type consists of typed statements and expressions. +pub mod annotation; +pub use self::annotation::*; + pub mod circuits; pub use self::circuits::*; diff --git a/typed/src/program.rs b/typed/src/program.rs index c4964ffd10..abe5cb8bf0 100644 --- a/typed/src/program.rs +++ b/typed/src/program.rs @@ -1,7 +1,7 @@ //! A typed Leo program consists of import, circuit, and function definitions. //! Each defined type consists of typed statements and expressions. -use crate::{Circuit, Function, Identifier, Import, InputVariable, TestFunction}; +use crate::{load_annotation, Circuit, Function, Identifier, Import, InputVariable, TestFunction}; use leo_ast::{definitions::Definition, files::File}; use serde::{Deserialize, Serialize}; @@ -47,7 +47,17 @@ impl<'ast> Program { } Definition::TestFunction(test_def) => { let test = TestFunction::from(test_def); - tests.insert(test.0.identifier.clone(), test); + tests.insert(test.function.identifier.clone(), test); + } + Definition::Annotated(annotated_definition) => { + load_annotation( + annotated_definition, + &mut imports, + &mut circuits, + &mut functions, + &mut tests, + &mut expected_input, + ); } }); From fcd8de4a9d5785087aed1b093a29edc21c43bc4c Mon Sep 17 00:00:00 2001 From: collin Date: Sat, 15 Aug 2020 20:40:56 -0700 Subject: [PATCH 3/7] impl input state file pairs --- package/src/errors/inputs/directory.rs | 13 ++++- package/src/inputs/directory.rs | 15 +---- package/src/inputs/mod.rs | 3 + package/src/inputs/pairs.rs | 79 ++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 14 deletions(-) create mode 100644 package/src/inputs/pairs.rs diff --git a/package/src/errors/inputs/directory.rs b/package/src/errors/inputs/directory.rs index 398271b2fd..b18f1f1292 100644 --- a/package/src/errors/inputs/directory.rs +++ b/package/src/errors/inputs/directory.rs @@ -1,3 +1,5 @@ +use crate::{InputFileError, StateFileError}; + use std::{ffi::OsString, fs::FileType, io}; #[derive(Debug, Error)] @@ -11,15 +13,24 @@ pub enum InputsDirectoryError { #[error("file {:?} extension getting", _0)] GettingFileExtension(OsString), + #[error("file {:?} name getting", _0)] + GettingFileName(OsString), + #[error("file {:?} type getting: {}", _0, _1)] GettingFileType(OsString, io::Error), + #[error("{}", _0)] + InputFileError(#[from] InputFileError), + #[error("invalid file {:?} extension: {:?}", _0, _1)] - InvalidFileExtension(OsString, OsString), + InvalidFileExtension(String, OsString), #[error("invalid file {:?} type: {:?}", _0, _1)] InvalidFileType(OsString, FileType), #[error("reading: {}", _0)] Reading(io::Error), + + #[error("{}", _0)] + StateFileError(#[from] StateFileError), } diff --git a/package/src/inputs/directory.rs b/package/src/inputs/directory.rs index 8a9bd1d8a6..547be961d1 100644 --- a/package/src/inputs/directory.rs +++ b/package/src/inputs/directory.rs @@ -1,4 +1,4 @@ -use crate::{errors::InputsDirectoryError, inputs::INPUT_FILE_EXTENSION}; +use crate::errors::InputsDirectoryError; use std::{fs, path::PathBuf}; @@ -17,7 +17,7 @@ impl InputsDirectory { fs::create_dir_all(&path).map_err(InputsDirectoryError::Creating) } - /// Returns a list of files in the source directory. + /// Returns a list of files in the input directory. pub fn files(path: &PathBuf) -> Result, InputsDirectoryError> { let mut path = path.to_owned(); path.push(PathBuf::from(INPUTS_DIRECTORY_NAME)); @@ -39,17 +39,6 @@ impl InputsDirectory { )); } - // Verify that the file has the default file extension - let file_extension = file_path - .extension() - .ok_or_else(|| InputsDirectoryError::GettingFileExtension(file_path.as_os_str().to_owned()))?; - if file_extension != INPUT_FILE_EXTENSION { - return Err(InputsDirectoryError::InvalidFileExtension( - file_path.as_os_str().to_owned(), - file_extension.to_owned(), - )); - } - file_paths.push(file_path); } diff --git a/package/src/inputs/mod.rs b/package/src/inputs/mod.rs index 504289bc48..befb73256e 100644 --- a/package/src/inputs/mod.rs +++ b/package/src/inputs/mod.rs @@ -4,5 +4,8 @@ pub use directory::*; pub mod input; pub use input::*; +pub mod pairs; +pub use pairs::*; + pub mod state; pub use state::*; diff --git a/package/src/inputs/pairs.rs b/package/src/inputs/pairs.rs new file mode 100644 index 0000000000..5dbd35d175 --- /dev/null +++ b/package/src/inputs/pairs.rs @@ -0,0 +1,79 @@ +use crate::{ + inputs::{InputFile, InputsDirectory, StateFile, INPUT_FILE_EXTENSION, STATE_FILE_EXTENSION}, + InputsDirectoryError, +}; + +use std::{collections::HashMap, convert::TryFrom, path::PathBuf}; + +pub struct InputPairs { + /// Maps file names to input file pairs + pub pairs: HashMap, +} + +pub struct InputPair { + pub input_file: String, + pub state_file: String, +} + +impl InputPairs { + pub fn new() -> Self { + Self { pairs: HashMap::new() } + } +} + +impl TryFrom<&PathBuf> for InputPairs { + type Error = InputsDirectoryError; + + fn try_from(directory: &PathBuf) -> Result { + let files = InputsDirectory::files(directory)?; + + let mut pairs = HashMap::::new(); + + for file in files { + let file_extension = file + .extension() + .ok_or_else(|| InputsDirectoryError::GettingFileExtension(file.as_os_str().to_owned()))?; + + let file_name = file + .file_name() + .ok_or(InputsDirectoryError::GettingFileName(file.as_os_str().to_owned()))? + .to_str() + .ok_or(InputsDirectoryError::GettingFileName(file.as_os_str().to_owned()))?; + + if file_extension == INPUT_FILE_EXTENSION { + let input_file = InputFile::new(file_name).read_from(&file)?; + + if pairs.contains_key(file_name) { + let pair = pairs.get_mut(file_name).unwrap(); + pair.input_file = input_file; + } else { + let pair = InputPair { + input_file, + state_file: "".to_owned(), + }; + pairs.insert(file_name.to_owned(), pair); + } + } else if file_extension == STATE_FILE_EXTENSION { + let state_file = StateFile::new(file_name).read_from(&file)?; + + if pairs.contains_key(file_name) { + let pair = pairs.get_mut(file_name).unwrap(); + pair.state_file = state_file; + } else { + let pair = InputPair { + input_file: "".to_owned(), + state_file, + }; + pairs.insert(file_name.to_owned(), pair); + } + } else { + return Err(InputsDirectoryError::InvalidFileExtension( + file_name.to_owned(), + file_extension.to_owned(), + )); + } + } + + Ok(InputPairs { pairs }) + } +} From 5efa131c655a432bfc068febfe441a695412506d Mon Sep 17 00:00:00 2001 From: collin Date: Sat, 15 Aug 2020 22:09:22 -0700 Subject: [PATCH 4/7] impl test context with test inputs --- Cargo.lock | 1 + ast/src/annotations/annotation_arguments.rs | 17 +++++++- ast/src/leo.pest | 7 +-- compiler/Cargo.toml | 1 + compiler/src/compiler.rs | 5 ++- compiler/src/constraints/constraints.rs | 40 +++++++++++++++--- compiler/src/errors/compiler.rs | 6 +++ compiler/src/program/program.rs | 1 + leo/commands/publish.rs | 2 +- leo/commands/test.rs | 25 ++++------- package/src/inputs/directory.rs | 47 +++++++++++++-------- package/src/inputs/pairs.rs | 6 +-- typed/src/common/identifier.rs | 15 ++++++- typed/src/input/input.rs | 3 ++ 14 files changed, 125 insertions(+), 51 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 71b34d3eeb..fd65e5e2f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1014,6 +1014,7 @@ dependencies = [ "leo-ast", "leo-gadgets", "leo-input", + "leo-package", "leo-typed", "log", "num-bigint", diff --git a/ast/src/annotations/annotation_arguments.rs b/ast/src/annotations/annotation_arguments.rs index 182b7d617d..b25859a50b 100644 --- a/ast/src/annotations/annotation_arguments.rs +++ b/ast/src/annotations/annotation_arguments.rs @@ -1,4 +1,7 @@ -use crate::{ast::Rule, common::Identifier, SpanDef}; +use crate::{ + ast::{span_into_string, Rule}, + SpanDef, +}; use pest::Span; use pest_ast::FromPest; @@ -7,7 +10,17 @@ use serde::Serialize; #[derive(Clone, Debug, FromPest, PartialEq, Serialize)] #[pest_ast(rule(Rule::annotation_arguments))] pub struct AnnotationArguments<'ast> { - pub arguments: Vec>, + pub arguments: Vec>, + #[pest_ast(outer())] + #[serde(with = "SpanDef")] + pub span: Span<'ast>, +} + +#[derive(Clone, Debug, FromPest, PartialEq, Serialize)] +#[pest_ast(rule(Rule::annotation_argument))] +pub struct AnnotationArgument<'ast> { + #[pest_ast(outer(with(span_into_string)))] + pub value: String, #[pest_ast(outer())] #[serde(with = "SpanDef")] pub span: Span<'ast>, diff --git a/ast/src/leo.pest b/ast/src/leo.pest index 5433a9e906..44889394b5 100644 --- a/ast/src/leo.pest +++ b/ast/src/leo.pest @@ -464,10 +464,10 @@ error = {"error"} /// Annotations // Declared in annotations/annotation.rs -annotation = @{annotation_symbol ~ annotation_name ~ annotation_arguments} +annotation = ${annotation_symbol ~ annotation_name ~ annotation_arguments} // Declared in annotations/annotation_symbol.rs -annotation_symbol = @{"@"} +annotation_symbol = ${"@"} // Declared in annotations/annotation_name.rs annotation_name = { @@ -478,5 +478,6 @@ annotation_name = { context = {"context"} // Declared in annotations/annotation_argument.rs -annotation_arguments = !{"(" ~ NEWLINE* ~ identifier ~ ("," ~ NEWLINE* ~ identifier)* ~ ","? ~ NEWLINE* ~ ")"} +annotation_arguments = !{"(" ~ NEWLINE* ~ annotation_argument ~ ("," ~ NEWLINE* ~ annotation_argument)* ~ ","? ~ NEWLINE* ~ ")"} +annotation_argument = @{ (ASCII_ALPHANUMERIC | "_")+ } diff --git a/compiler/Cargo.toml b/compiler/Cargo.toml index 35bf31e318..a0ad8e3472 100644 --- a/compiler/Cargo.toml +++ b/compiler/Cargo.toml @@ -8,6 +8,7 @@ edition = "2018" leo-ast = { path = "../ast", version = "0.1.0" } leo-gadgets = { path = "../gadgets", version = "0.1.0" } leo-input = { path = "../input", version = "0.1.0" } +leo-package = { path = "../package", version = "0.1.0"} leo-typed = { path = "../typed", version = "0.1.0" } snarkos-curves = { git = "ssh://git@github.com/AleoHQ/snarkOS.git", package = "snarkos-curves", default-features = false } diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index bcde2061c4..2405efb79b 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -10,6 +10,7 @@ use crate::{ }; use leo_ast::LeoAst; use leo_input::LeoInputParser; +use leo_package::inputs::InputPairs; use leo_typed::{Input, LeoTypedAst, MainInput, Program}; use snarkos_errors::gadgets::SynthesisError; @@ -151,8 +152,8 @@ impl> Compiler { } /// Synthesizes the circuit for test functions with program input. - pub fn compile_test_constraints(self) -> Result<(), CompilerError> { - generate_test_constraints::(self.program, self.program_input, &self.imported_programs) + pub fn compile_test_constraints(self, input_pairs: InputPairs) -> Result<(), CompilerError> { + generate_test_constraints::(self.program, input_pairs, &self.imported_programs) } /// Calls the internal generate_constraints method with arguments diff --git a/compiler/src/constraints/constraints.rs b/compiler/src/constraints/constraints.rs index ba4aaec894..6fefa8f259 100644 --- a/compiler/src/constraints/constraints.rs +++ b/compiler/src/constraints/constraints.rs @@ -11,6 +11,8 @@ use crate::{ }; use leo_typed::{Input, Program}; +use leo_input::LeoInputParser; +use leo_package::inputs::InputPairs; use snarkos_models::{ curves::{Field, PrimeField}, gadgets::r1cs::{ConstraintSystem, TestConstraintSystem}, @@ -43,7 +45,7 @@ pub fn generate_constraints, CS: Constrai pub fn generate_test_constraints>( program: Program, - input: Input, + input: InputPairs, imported_programs: &ImportParser, ) -> Result<(), CompilerError> { let mut resolved_program = ConstrainedProgram::::new(); @@ -51,19 +53,45 @@ pub fn generate_test_constraints>( let tests = program.tests.clone(); + // Store definitions resolved_program.store_definitions(program, imported_programs)?; + // Get default input + let default = input.pairs.get(&program_name); + log::info!("Running {} tests", tests.len()); - for (test_name, test_function) in tests.into_iter() { + for (test_name, test) in tests.into_iter() { let cs = &mut TestConstraintSystem::::new(); let full_test_name = format!("{}::{}", program_name.clone(), test_name.to_string()); - let result = resolved_program.enforce_main_function( + // get input file name from annotation or use test_name + let input_pair = match test.input_file { + Some(file_name) => match input.pairs.get(&file_name.name) { + Some(pair) => pair.to_owned(), + None => return Err(CompilerError::InvalidTestContext(file_name.name)), + }, + None => default.ok_or(CompilerError::NoTestInput)?, + }; + + // parse input files to abstract syntax trees + let input_file = &input_pair.input_file; + let state_file = &input_pair.state_file; + + let input_ast = LeoInputParser::parse_file(input_file)?; + let state_ast = LeoInputParser::parse_file(state_file)?; + + // parse input files into input struct + let mut input = Input::new(); + input.parse_input(input_ast)?; + input.parse_state(state_ast)?; + + // run test function on new program with input + let result = resolved_program.clone().enforce_main_function( cs, program_name.clone(), - test_function.0, - input.clone(), // pass program input into every test + test.function, + input, // pass program input into every test ); if result.is_ok() { @@ -72,6 +100,8 @@ pub fn generate_test_constraints>( full_test_name, cs.is_satisfied() ); + + // write result to file } else { log::error!("test {} errored: {}", full_test_name, result.unwrap_err()); } diff --git a/compiler/src/errors/compiler.rs b/compiler/src/errors/compiler.rs index ff76268520..422ed81a09 100644 --- a/compiler/src/errors/compiler.rs +++ b/compiler/src/errors/compiler.rs @@ -13,6 +13,9 @@ pub enum CompilerError { #[error("{}", _0)] InputParserError(#[from] InputParserError), + #[error("Cannot find input files with context name `{}`", _0)] + InvalidTestContext(String), + #[error("{}", _0)] FunctionError(#[from] FunctionError), @@ -25,6 +28,9 @@ pub enum CompilerError { #[error("`main` must be a function")] NoMainFunction, + #[error("Failed to find input files for the current test")] + NoTestInput, + #[error("{}", _0)] OutputError(#[from] OutputFileError), diff --git a/compiler/src/program/program.rs b/compiler/src/program/program.rs index c8f97cf0ae..9aa4d85657 100644 --- a/compiler/src/program/program.rs +++ b/compiler/src/program/program.rs @@ -6,6 +6,7 @@ use snarkos_models::curves::{Field, PrimeField}; use std::collections::HashMap; +#[derive(Clone)] pub struct ConstrainedProgram> { pub identifiers: HashMap>, } diff --git a/leo/commands/publish.rs b/leo/commands/publish.rs index 8fbbe37f56..ec3925f942 100644 --- a/leo/commands/publish.rs +++ b/leo/commands/publish.rs @@ -1,7 +1,7 @@ use crate::{ cli::*, cli_types::*, - commands::{BuildCommand, LoginCommand}, + commands::LoginCommand, errors::{ commands::PublishError::{ConnectionUnavalaible, PackageNotPublished}, CLIError, diff --git a/leo/commands/test.rs b/leo/commands/test.rs index 458edfb241..1523c24761 100644 --- a/leo/commands/test.rs +++ b/leo/commands/test.rs @@ -63,27 +63,20 @@ impl CLI for TestCommand { let mut output_directory = package_path.clone(); output_directory.push(OUTPUTS_DIRECTORY_NAME); - // Load the input file at `package_name` - let input_string = InputFile::new(&package_name).read_from(&path)?; - - // Load the state file at `package_name.in` - let state_string = StateFile::new(&package_name).read_from(&path)?; - - // Compute the current program checksum - let program = Compiler::::parse_program_with_input( + // Parse the current main program file + let program = Compiler::::parse_program_without_input( package_name.clone(), main_file_path.clone(), output_directory, - &input_string, - &state_string, )?; - // Generate the program on the constraint system and verify correctness - { - let temporary_program = program.clone(); - let output = temporary_program.compile_test_constraints()?; - log::debug!("Compiled constraints - {:#?}", output); - } + // Parse all inputs as input pairs + let pairs = InputPairs::try_from(&package_path)?; + + // Run tests + let temporary_program = program.clone(); + let output = temporary_program.compile_test_constraints(pairs)?; + log::debug!("Compiled constraints - {:#?}", output); Ok(()) } diff --git a/package/src/inputs/directory.rs b/package/src/inputs/directory.rs index 547be961d1..4dc70b9e28 100644 --- a/package/src/inputs/directory.rs +++ b/package/src/inputs/directory.rs @@ -1,6 +1,6 @@ use crate::errors::InputsDirectoryError; -use std::{fs, path::PathBuf}; +use std::{fs, fs::ReadDir, path::PathBuf}; pub static INPUTS_DIRECTORY_NAME: &str = "inputs/"; @@ -24,24 +24,35 @@ impl InputsDirectory { let directory = fs::read_dir(&path).map_err(InputsDirectoryError::Reading)?; let mut file_paths = Vec::new(); - for file_entry in directory.into_iter() { - let file_entry = file_entry.map_err(InputsDirectoryError::GettingFileEntry)?; - let file_path = file_entry.path(); - - // Verify that the entry is structured as a valid file - let file_type = file_entry - .file_type() - .map_err(|error| InputsDirectoryError::GettingFileType(file_path.as_os_str().to_owned(), error))?; - if !file_type.is_file() { - return Err(InputsDirectoryError::InvalidFileType( - file_path.as_os_str().to_owned(), - file_type, - )); - } - - file_paths.push(file_path); - } + parse_file_paths(directory, &mut file_paths)?; Ok(file_paths) } } + +fn parse_file_paths(directory: ReadDir, file_paths: &mut Vec) -> Result<(), InputsDirectoryError> { + for file_entry in directory.into_iter() { + let file_entry = file_entry.map_err(InputsDirectoryError::GettingFileEntry)?; + let file_path = file_entry.path(); + + // Verify that the entry is structured as a valid file or directory + let file_type = file_entry + .file_type() + .map_err(|error| InputsDirectoryError::GettingFileType(file_path.as_os_str().to_owned(), error))?; + if file_type.is_dir() { + let directory = fs::read_dir(&file_path).map_err(InputsDirectoryError::Reading)?; + + parse_file_paths(directory, file_paths)?; + continue; + } else if !file_type.is_file() { + return Err(InputsDirectoryError::InvalidFileType( + file_path.as_os_str().to_owned(), + file_type, + )); + } + + file_paths.push(file_path); + } + + Ok(()) +} diff --git a/package/src/inputs/pairs.rs b/package/src/inputs/pairs.rs index 5dbd35d175..b41947cc46 100644 --- a/package/src/inputs/pairs.rs +++ b/package/src/inputs/pairs.rs @@ -35,12 +35,12 @@ impl TryFrom<&PathBuf> for InputPairs { .ok_or_else(|| InputsDirectoryError::GettingFileExtension(file.as_os_str().to_owned()))?; let file_name = file - .file_name() + .file_stem() .ok_or(InputsDirectoryError::GettingFileName(file.as_os_str().to_owned()))? .to_str() .ok_or(InputsDirectoryError::GettingFileName(file.as_os_str().to_owned()))?; - if file_extension == INPUT_FILE_EXTENSION { + if file_extension == INPUT_FILE_EXTENSION.trim_start_matches(".") { let input_file = InputFile::new(file_name).read_from(&file)?; if pairs.contains_key(file_name) { @@ -53,7 +53,7 @@ impl TryFrom<&PathBuf> for InputPairs { }; pairs.insert(file_name.to_owned(), pair); } - } else if file_extension == STATE_FILE_EXTENSION { + } else if file_extension == STATE_FILE_EXTENSION.trim_start_matches(".") { let state_file = StateFile::new(file_name).read_from(&file)?; if pairs.contains_key(file_name) { diff --git a/typed/src/common/identifier.rs b/typed/src/common/identifier.rs index 3a31e08599..777e404a4d 100644 --- a/typed/src/common/identifier.rs +++ b/typed/src/common/identifier.rs @@ -1,5 +1,9 @@ use crate::Span; -use leo_ast::{common::Identifier as AstIdentifier, imports::PackageName as AstPackageName}; +use leo_ast::{ + annotations::AnnotationArgument, + common::Identifier as AstIdentifier, + imports::PackageName as AstPackageName, +}; use leo_input::common::Identifier as InputAstIdentifier; use serde::{ @@ -55,6 +59,15 @@ impl<'ast> From> for Identifier { } } +impl<'ast> From> for Identifier { + fn from(argument: AnnotationArgument<'ast>) -> Self { + Self { + name: argument.value, + span: Span::from(argument.span), + } + } +} + impl fmt::Display for Identifier { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}", self.name) diff --git a/typed/src/input/input.rs b/typed/src/input/input.rs index cacc2d9d8f..8f1dd54bfc 100644 --- a/typed/src/input/input.rs +++ b/typed/src/input/input.rs @@ -6,6 +6,7 @@ use leo_input::{ #[derive(Clone, PartialEq, Eq)] pub struct Input { + name: String, program_input: ProgramInput, program_state: ProgramState, } @@ -13,6 +14,7 @@ pub struct Input { impl Input { pub fn new() -> Self { Self { + name: "default".to_owned(), program_input: ProgramInput::new(), program_state: ProgramState::new(), } @@ -25,6 +27,7 @@ impl Input { let state = self.program_state.empty(); Self { + name: self.name.clone(), program_input: input, program_state: state, } From 9a2fe61c6fd03b026ceef28da7de41f5deb826e0 Mon Sep 17 00:00:00 2001 From: collin Date: Sat, 15 Aug 2020 23:25:34 -0700 Subject: [PATCH 5/7] write test output to filename specified by context --- compiler/src/compiler.rs | 10 +++++++++- compiler/src/constraints/constraints.rs | 26 ++++++++++++++++++++----- compiler/src/output/output_file.rs | 1 - leo/commands/test.rs | 5 ++++- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index 2405efb79b..60ee516f8e 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -153,7 +153,12 @@ impl> Compiler { /// Synthesizes the circuit for test functions with program input. pub fn compile_test_constraints(self, input_pairs: InputPairs) -> Result<(), CompilerError> { - generate_test_constraints::(self.program, input_pairs, &self.imported_programs) + generate_test_constraints::( + self.program, + input_pairs, + &self.imported_programs, + &self.output_directory, + ) } /// Calls the internal generate_constraints method with arguments @@ -205,6 +210,9 @@ impl> ConstraintSynthesizer for Compil // Write results to file let output_file = OutputFile::new(&package_name); + + log::info!("Writing to output registers..."); + output_file.write(&output_directory, result.bytes()).unwrap(); Ok(()) diff --git a/compiler/src/constraints/constraints.rs b/compiler/src/constraints/constraints.rs index 6fefa8f259..5880bdadc7 100644 --- a/compiler/src/constraints/constraints.rs +++ b/compiler/src/constraints/constraints.rs @@ -8,6 +8,7 @@ use crate::{ GroupType, ImportParser, OutputBytes, + OutputFile, }; use leo_typed::{Input, Program}; @@ -17,6 +18,7 @@ use snarkos_models::{ curves::{Field, PrimeField}, gadgets::r1cs::{ConstraintSystem, TestConstraintSystem}, }; +use std::path::PathBuf; pub fn generate_constraints, CS: ConstraintSystem>( cs: &mut CS, @@ -47,6 +49,7 @@ pub fn generate_test_constraints>( program: Program, input: InputPairs, imported_programs: &ImportParser, + output_directory: &PathBuf, ) -> Result<(), CompilerError> { let mut resolved_program = ConstrainedProgram::::new(); let program_name = program.get_name(); @@ -64,13 +67,20 @@ pub fn generate_test_constraints>( for (test_name, test) in tests.into_iter() { let cs = &mut TestConstraintSystem::::new(); let full_test_name = format!("{}::{}", program_name.clone(), test_name.to_string()); + let mut output_file_name = program_name.clone(); // get input file name from annotation or use test_name let input_pair = match test.input_file { - Some(file_name) => match input.pairs.get(&file_name.name) { - Some(pair) => pair.to_owned(), - None => return Err(CompilerError::InvalidTestContext(file_name.name)), - }, + Some(file_id) => { + let file_name = file_id.name; + + output_file_name = file_name.clone(); + + match input.pairs.get(&file_name) { + Some(pair) => pair.to_owned(), + None => return Err(CompilerError::InvalidTestContext(file_name)), + } + } None => default.ok_or(CompilerError::NoTestInput)?, }; @@ -101,7 +111,13 @@ pub fn generate_test_constraints>( cs.is_satisfied() ); - // write result to file + // write result to file + let output = result?; + let output_file = OutputFile::new(&output_file_name); + + log::info!("\tWriting output to registers in `{}.out` ...", output_file_name); + + output_file.write(output_directory, output.bytes()).unwrap(); } else { log::error!("test {} errored: {}", full_test_name, result.unwrap_err()); } diff --git a/compiler/src/output/output_file.rs b/compiler/src/output/output_file.rs index d60f60321d..b495422919 100644 --- a/compiler/src/output/output_file.rs +++ b/compiler/src/output/output_file.rs @@ -40,7 +40,6 @@ impl OutputFile { // create output file let path = self.setup_file_path(path); let mut file = File::create(&path)?; - log::info!("Writing to output registers..."); Ok(file.write_all(bytes)?) } diff --git a/leo/commands/test.rs b/leo/commands/test.rs index 1523c24761..ec998675b2 100644 --- a/leo/commands/test.rs +++ b/leo/commands/test.rs @@ -6,7 +6,7 @@ use crate::{ use leo_compiler::{compiler::Compiler, group::targets::edwards_bls12::EdwardsGroupType}; use leo_package::{ inputs::*, - outputs::OUTPUTS_DIRECTORY_NAME, + outputs::{OutputsDirectory, OUTPUTS_DIRECTORY_NAME}, root::Manifest, source::{MainFile, MAIN_FILE_NAME, SOURCE_DIRECTORY_NAME}, }; @@ -63,6 +63,9 @@ impl CLI for TestCommand { let mut output_directory = package_path.clone(); output_directory.push(OUTPUTS_DIRECTORY_NAME); + // Create the output directory + OutputsDirectory::create(&package_path)?; + // Parse the current main program file let program = Compiler::::parse_program_without_input( package_name.clone(), From 14055407cf812a946715c280fc1d4c6284f91a73 Mon Sep 17 00:00:00 2001 From: collin Date: Sat, 15 Aug 2020 23:47:35 -0700 Subject: [PATCH 6/7] cargo lock --- Cargo.lock | 75 +++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd65e5e2f3..a34b7911cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -128,7 +128,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.3", + "generic-array 0.14.4", ] [[package]] @@ -220,9 +220,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "chrono" -version = "0.4.13" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" +checksum = "942f72db697d8767c22d46a598e01f2d3b475501ea43d0db4f16d90259182d0b" dependencies = [ "num-integer", "num-traits", @@ -420,7 +420,7 @@ checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", ] [[package]] @@ -438,7 +438,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.3", + "generic-array 0.14.4", ] [[package]] @@ -449,9 +449,9 @@ checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" [[package]] name = "either" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3" +checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f" [[package]] name = "encoding_rs" @@ -503,7 +503,7 @@ checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", "synstructure", ] @@ -677,9 +677,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60fb4bb6bba52f78a471264d9a3b7d026cc0af47b22cd2cffbc0b787ca003e63" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" dependencies = [ "typenum", "version_check", @@ -738,9 +738,9 @@ checksum = "d36fab90f82edc3c747f9d438e06cf0a491055896f2a279638bb5beed6c40177" [[package]] name = "hashbrown" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb" +checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" dependencies = [ "autocfg", ] @@ -846,9 +846,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b88cd59ee5f71fea89a62248fc8f387d44400cefe05ef548466d61ced9029a7" +checksum = "86b45e59b16c76b11bf9738fd5d38879d3bd28ad292d7b313608becb17ae2df9" dependencies = [ "autocfg", "hashbrown", @@ -1412,7 +1412,7 @@ dependencies = [ "pest_meta", "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", ] [[package]] @@ -1443,7 +1443,7 @@ checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", ] [[package]] @@ -1806,7 +1806,7 @@ checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", ] [[package]] @@ -1874,14 +1874,14 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" +checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "snarkos-algorithms" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "blake2", "derivative", @@ -1901,7 +1901,7 @@ dependencies = [ [[package]] name = "snarkos-curves" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "derivative", "rand", @@ -1916,17 +1916,17 @@ dependencies = [ [[package]] name = "snarkos-derives" version = "0.1.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", ] [[package]] name = "snarkos-dpc" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "blake2", "derivative", @@ -1947,7 +1947,7 @@ dependencies = [ [[package]] name = "snarkos-errors" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "base58", "bech32", @@ -1955,12 +1955,13 @@ dependencies = [ "hex", "jsonrpc-core", "thiserror", + "toml", ] [[package]] name = "snarkos-gadgets" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "derivative", "digest 0.8.1", @@ -1975,7 +1976,7 @@ dependencies = [ [[package]] name = "snarkos-models" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "bincode", "derivative", @@ -1991,7 +1992,7 @@ dependencies = [ [[package]] name = "snarkos-objects" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "base58", "bech32", @@ -2012,7 +2013,7 @@ dependencies = [ [[package]] name = "snarkos-parameters" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "hex", "snarkos-algorithms", @@ -2024,12 +2025,12 @@ dependencies = [ [[package]] name = "snarkos-profiler" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" [[package]] name = "snarkos-utilities" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#a0d7afb4398abc9b2eb7980811b8b9b808df4019" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" dependencies = [ "bincode", "rand", @@ -2074,9 +2075,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.36" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cdb98bcb1f9d81d07b536179c269ea15999b5d14ea958196413869445bb5250" +checksum = "e69abc24912995b3038597a7a593be5053eb0fb44f3cc5beec0deb421790c1f4" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", @@ -2091,7 +2092,7 @@ checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", "unicode-xid 0.2.1", ] @@ -2144,7 +2145,7 @@ checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", ] [[package]] @@ -2407,7 +2408,7 @@ dependencies = [ "log", "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", "wasm-bindgen-shared", ] @@ -2441,7 +2442,7 @@ checksum = "841a6d1c35c6f596ccea1f82504a192a60378f64b3bb0261904ad8f2f5657556" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.36", + "syn 1.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From 748ffcca3bd698b5f56f5bca021f1b12f020c764 Mon Sep 17 00:00:00 2001 From: collin Date: Sun, 16 Aug 2020 12:10:16 -0700 Subject: [PATCH 7/7] update snarkos --- Cargo.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a34b7911cc..4bb4ca45e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1881,7 +1881,7 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "snarkos-algorithms" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "blake2", "derivative", @@ -1901,7 +1901,7 @@ dependencies = [ [[package]] name = "snarkos-curves" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "derivative", "rand", @@ -1916,7 +1916,7 @@ dependencies = [ [[package]] name = "snarkos-derives" version = "0.1.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "proc-macro2 1.0.19", "quote 1.0.7", @@ -1926,7 +1926,7 @@ dependencies = [ [[package]] name = "snarkos-dpc" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "blake2", "derivative", @@ -1947,7 +1947,7 @@ dependencies = [ [[package]] name = "snarkos-errors" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "base58", "bech32", @@ -1961,7 +1961,7 @@ dependencies = [ [[package]] name = "snarkos-gadgets" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "derivative", "digest 0.8.1", @@ -1976,7 +1976,7 @@ dependencies = [ [[package]] name = "snarkos-models" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "bincode", "derivative", @@ -1992,7 +1992,7 @@ dependencies = [ [[package]] name = "snarkos-objects" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "base58", "bech32", @@ -2013,7 +2013,7 @@ dependencies = [ [[package]] name = "snarkos-parameters" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "hex", "snarkos-algorithms", @@ -2025,12 +2025,12 @@ dependencies = [ [[package]] name = "snarkos-profiler" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" [[package]] name = "snarkos-utilities" version = "0.8.0" -source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#87d9993a366274482961461e11a2a356e5087896" +source = "git+ssh://git@github.com/AleoHQ/snarkOS.git#57fef6a27035419e0b22fee5b72ca6639e15e1ac" dependencies = [ "bincode", "rand",