From d1a1b258ec892808403951e48310a95ec6029e16 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 10:07:35 -0400 Subject: [PATCH 01/23] Remove InputAST from compiler --- compiler/ast/src/input/definition.rs | 29 ------ compiler/ast/src/input/input_ast.rs | 108 ----------------------- compiler/ast/src/input/input_value.rs | 71 --------------- compiler/ast/src/input/mod.rs | 37 -------- compiler/ast/src/input/program_input.rs | 44 --------- compiler/ast/src/input/section.rs | 32 ------- compiler/ast/src/lib.rs | 3 - compiler/compiler/src/compiler.rs | 36 +------- compiler/compiler/src/options.rs | 2 - compiler/compiler/tests/compile.rs | 1 - compiler/compiler/tests/execute.rs | 1 - compiler/parser/examples/input_parser.rs | 70 --------------- compiler/parser/src/parser/input.rs | 76 ---------------- compiler/parser/src/parser/mod.rs | 13 --- leo/cli/commands/build.rs | 3 +- 15 files changed, 3 insertions(+), 523 deletions(-) delete mode 100644 compiler/ast/src/input/definition.rs delete mode 100644 compiler/ast/src/input/input_ast.rs delete mode 100644 compiler/ast/src/input/input_value.rs delete mode 100644 compiler/ast/src/input/mod.rs delete mode 100644 compiler/ast/src/input/program_input.rs delete mode 100644 compiler/ast/src/input/section.rs delete mode 100644 compiler/parser/examples/input_parser.rs delete mode 100644 compiler/parser/src/parser/input.rs diff --git a/compiler/ast/src/input/definition.rs b/compiler/ast/src/input/definition.rs deleted file mode 100644 index fc8a683de9..0000000000 --- a/compiler/ast/src/input/definition.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; -use crate::{Expression, Identifier, Mode, Type}; - -/// A single definition inside a section in a state or an input file. -/// Definitions should be structured as: `: = ;` -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] -pub struct Definition { - pub mode: Mode, - pub type_: Type, - pub name: Identifier, - pub value: Expression, - pub span: Span, -} diff --git a/compiler/ast/src/input/input_ast.rs b/compiler/ast/src/input/input_ast.rs deleted file mode 100644 index 1329dab746..0000000000 --- a/compiler/ast/src/input/input_ast.rs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{normalize_json_value, remove_key_from_json, Expression, Struct, Type}; - -use super::*; -use leo_errors::{AstError, Result}; - -/// Input data which includes [`ProgramInput`]. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct InputData { - pub program_input: ProgramInput, -} - -impl InputData { - /// Serializes the ast into a JSON string. - pub fn to_json_string(&self) -> Result { - Ok(serde_json::to_string_pretty(&self).map_err(|e| AstError::failed_to_convert_ast_to_json_string(&e))?) - } -} - -/// A raw unprocessed input or state file data. Used for future conversion -/// into [`ProgramInput`]. -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct InputAst { - pub sections: Vec
, -} - -impl InputAst { - /// Returns all values of the input AST for execution with `leo run`. - pub fn program_inputs(&self, program_name: &str, structs: IndexMap) -> Vec { - self.sections - .iter() - .filter(|section| section.name() == program_name) - .flat_map(|section| { - section.definitions.iter().map(|definition| match &definition.type_ { - // Handle case where the input may be record. - Type::Identifier(identifier) => { - match structs.get(&identifier.name) { - // TODO: Better error handling. - None => panic!( - "Input error: A struct or record declaration does not exist for {}.", - identifier.name - ), - Some(struct_) => match struct_.is_record { - false => definition.value.to_string(), - true => match &definition.value { - // Print out the record interface with visibility. - Expression::Struct(struct_expression) => struct_expression.to_record_string(), - _ => panic!("Input error: Expected a struct expression."), - }, - }, - } - } - _ => definition.value.to_string(), - }) - }) - .collect::>() - } - - /// Serializes the `Input` into a JSON Value. - pub fn to_json_value(&self) -> Result { - Ok(serde_json::to_value(self).map_err(|e| AstError::failed_to_convert_ast_to_json_value(&e))?) - } - - /// Serializes the input into a JSON file. - pub fn to_json_file(&self, mut path: std::path::PathBuf, file_name: &str) -> Result<()> { - path.push(file_name); - let file = std::fs::File::create(&path).map_err(|e| AstError::failed_to_create_ast_json_file(&path, &e))?; - let writer = std::io::BufWriter::new(file); - Ok(serde_json::to_writer_pretty(writer, &self) - .map_err(|e| AstError::failed_to_write_ast_to_json_file(&path, &e))?) - } - - /// Serializes the `Input` into a JSON value and removes keys from object mappings before writing to a file. - pub fn to_json_file_without_keys( - &self, - mut path: std::path::PathBuf, - file_name: &str, - excluded_keys: &[&str], - ) -> Result<()> { - path.push(file_name); - let file = std::fs::File::create(&path).map_err(|e| AstError::failed_to_create_ast_json_file(&path, &e))?; - let writer = std::io::BufWriter::new(file); - - let mut value = self.to_json_value().unwrap(); - for key in excluded_keys { - value = remove_key_from_json(value, key); - } - value = normalize_json_value(value); - - Ok(serde_json::to_writer_pretty(writer, &value) - .map_err(|e| AstError::failed_to_write_ast_to_json_file(&path, &e))?) - } -} diff --git a/compiler/ast/src/input/input_value.rs b/compiler/ast/src/input/input_value.rs deleted file mode 100644 index 8b89efefce..0000000000 --- a/compiler/ast/src/input/input_value.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::{Expression, GroupLiteral, IntegerType, Literal, Node, Type, UnaryOperation}; -use leo_errors::{InputError, LeoError, Result}; - -use serde::{Deserialize, Serialize}; -use std::fmt; - -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub enum InputValue { - Address(String), - Boolean(bool), - Field(String), - Group(GroupLiteral), - Integer(IntegerType, String), -} - -impl TryFrom<(Type, Expression)> for InputValue { - type Error = LeoError; - - fn try_from(value: (Type, Expression)) -> Result { - Ok(match value { - (type_, Expression::Literal(lit)) => match (type_, lit) { - (Type::Address, Literal::Address(value, _, _)) => Self::Address(value), - (Type::Boolean, Literal::Boolean(value, _, _)) => Self::Boolean(value), - (Type::Field, Literal::Field(value, _, _)) => Self::Field(value), - (Type::Group, Literal::Group(value)) => Self::Group(*value), - (Type::Integer(expected), Literal::Integer(actual, value, span, _)) => { - if expected == actual { - Self::Integer(expected, value) - } else { - return Err(InputError::unexpected_type(expected.to_string(), actual, span).into()); - } - } - (x, y) => { - return Err(InputError::unexpected_type(x, &y, y.span()).into()); - } - }, - (type_, Expression::Unary(unary)) if unary.op == UnaryOperation::Negate => { - InputValue::try_from((type_, *unary.receiver))? - } - (_type_, expr) => return Err(InputError::illegal_expression(&expr, expr.span()).into()), - }) - } -} - -impl fmt::Display for InputValue { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - InputValue::Address(ref address) => write!(f, "{address}"), - InputValue::Boolean(ref boolean) => write!(f, "{boolean}"), - InputValue::Group(ref group) => write!(f, "{group}"), - InputValue::Field(ref field) => write!(f, "{field}"), - InputValue::Integer(ref type_, ref number) => write!(f, "{number}{type_:?}"), - } - } -} diff --git a/compiler/ast/src/input/mod.rs b/compiler/ast/src/input/mod.rs deleted file mode 100644 index a7800a5517..0000000000 --- a/compiler/ast/src/input/mod.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -pub mod definition; -pub use definition::*; - -pub mod input_ast; -pub use input_ast::*; - -pub mod input_value; -pub use input_value::*; - -pub mod program_input; -pub use program_input::*; - -pub mod section; -pub use section::*; - -use indexmap::IndexMap; -use leo_errors::{InputError, LeoError, Result}; -use leo_span::{sym, Span, Symbol}; -use serde::{Deserialize, Serialize}; - -type Definitions = IndexMap; diff --git a/compiler/ast/src/input/program_input.rs b/compiler/ast/src/input/program_input.rs deleted file mode 100644 index 0490bfe6f7..0000000000 --- a/compiler/ast/src/input/program_input.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; - -/// Processed Program input. -#[derive(Debug, Clone, Default, Serialize, Deserialize)] -pub struct ProgramInput { - pub main: Definitions, -} - -impl TryFrom for ProgramInput { - type Error = LeoError; - - fn try_from(input: InputAst) -> Result { - let mut main = IndexMap::new(); - - for section in input.sections { - let target = match section.name { - sym::main => &mut main, - _ => return Err(InputError::unexpected_section(&["main"], section.name, section.span).into()), - }; - - for definition in section.definitions { - target.insert(definition.name.name, InputValue::try_from((definition.type_, definition.value))?); - } - } - - Ok(ProgramInput { main }) - } -} diff --git a/compiler/ast/src/input/section.rs b/compiler/ast/src/input/section.rs deleted file mode 100644 index b0530e4953..0000000000 --- a/compiler/ast/src/input/section.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; - -/// A single section in an input or a state file. -/// An example of a section would be: `[main]`. -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct Section { - pub name: Symbol, - pub definitions: Vec, - pub span: Span, -} - -impl Section { - pub fn name(&self) -> String { - self.name.to_string() - } -} diff --git a/compiler/ast/src/lib.rs b/compiler/ast/src/lib.rs index 3e7b234b73..19ef53784a 100644 --- a/compiler/ast/src/lib.rs +++ b/compiler/ast/src/lib.rs @@ -40,9 +40,6 @@ pub use self::functions::*; pub mod groups; pub use self::groups::*; -pub mod input; -pub use self::input::*; - pub mod mapping; pub use self::mapping::*; diff --git a/compiler/compiler/src/compiler.rs b/compiler/compiler/src/compiler.rs index 20f18b37e8..1a46d166d9 100644 --- a/compiler/compiler/src/compiler.rs +++ b/compiler/compiler/src/compiler.rs @@ -17,7 +17,7 @@ //! The compiler for Leo programs. //! //! The [`Compiler`] type compiles Leo programs into R1CS circuits. -pub use leo_ast::{Ast, InputAst}; +pub use leo_ast::Ast; use leo_ast::{NodeBuilder, Program, Stub}; use leo_errors::{emitter::Handler, CompilerError, Result}; pub use leo_passes::SymbolTable; @@ -45,8 +45,6 @@ pub struct Compiler<'a> { pub network: String, /// The AST for the program. pub ast: Ast, - /// The input ast for the program if it exists. - pub input_ast: Option, /// Options configuring compilation. compiler_options: CompilerOptions, /// The `NodeCounter` used to generate sequentially increasing `NodeID`s. @@ -80,7 +78,6 @@ impl<'a> Compiler<'a> { program_name, network, ast: Ast::new(Program::default()), - input_ast: None, compiler_options: compiler_options.unwrap_or_default(), node_builder, assigner, @@ -141,37 +138,6 @@ impl<'a> Compiler<'a> { self.parse_program_from_string(&program_string, FileName::Real(self.main_file_path.clone())) } - /// Parses and stores the input file, constructs a syntax tree, and generates a program input. - pub fn parse_input(&mut self, input_file_path: PathBuf) -> Result<()> { - if input_file_path.exists() { - // Load the input file into the source map. - let input_sf = with_session_globals(|s| s.source_map.load_file(&input_file_path)) - .map_err(|e| CompilerError::file_read_error(&input_file_path, e))?; - - // Parse and serialize it. - let input_ast = - leo_parser::parse_input(self.handler, &self.node_builder, &input_sf.src, input_sf.start_pos)?; - if self.compiler_options.output.initial_ast { - // Write the input AST snapshot post parsing. - if self.compiler_options.output.ast_spans_enabled { - input_ast.to_json_file( - self.output_directory.clone(), - &format!("{}.initial_input_ast.json", self.program_name), - )?; - } else { - input_ast.to_json_file_without_keys( - self.output_directory.clone(), - &format!("{}.initial_input_ast.json", self.program_name), - &["span"], - )?; - } - } - - self.input_ast = Some(input_ast); - } - Ok(()) - } - /// Runs the symbol table pass. pub fn symbol_table_pass(&self) -> Result { let symbol_table = SymbolTableCreator::do_pass((&self.ast, self.handler))?; diff --git a/compiler/compiler/src/options.rs b/compiler/compiler/src/options.rs index 0e25f739d2..693e85f9cf 100644 --- a/compiler/compiler/src/options.rs +++ b/compiler/compiler/src/options.rs @@ -44,8 +44,6 @@ pub struct OutputOptions { pub ast_spans_enabled: bool, /// If enabled writes the AST after parsing. pub initial_ast: bool, - /// If enabled writes the input AST after parsing. - pub initial_input_ast: bool, /// If enabled writes the AST after loop unrolling. pub unrolled_ast: bool, /// If enabled writes the AST after static single assignment. diff --git a/compiler/compiler/tests/compile.rs b/compiler/compiler/tests/compile.rs index 6f9c573e24..ba20f842fe 100644 --- a/compiler/compiler/tests/compile.rs +++ b/compiler/compiler/tests/compile.rs @@ -91,7 +91,6 @@ fn run_test(test: Test, handler: &Handler, buf: &BufferEmitter) -> Result Result. - -#![forbid(unsafe_code)] - -use leo_ast::NodeBuilder; -use leo_errors::{emitter::Handler, Result}; -use leo_span::symbol::create_session_if_not_set_then; - -use clap::Parser; -use std::{ - fs, - path::{Path, PathBuf}, -}; - -#[derive(Debug, Parser)] -#[clap(name = "input parser", about = "Parse an Input file and save its JSON representation")] -struct Opt { - /// Path to the input file. - input_path: PathBuf, - - /// Optional path to the output directory. - out_dir_path: Option, - - /// Whether to print result to STDOUT. - #[clap(short, long)] - print_stdout: bool, -} - -fn main() -> Result<(), String> { - let opt = Opt::parse(); - let input_tree = create_session_if_not_set_then(|s| { - let input_string = s.source_map.load_file(&opt.input_path).expect("failed to open an input file"); - - Handler::with(|handler| { - let node_builder = NodeBuilder::default(); - let input = - leo_parser::parse_program_inputs(handler, &node_builder, &input_string.src, input_string.start_pos)?; - input.to_json_string() - }) - .map_err(|e| e.to_string()) - })?; - - if opt.print_stdout { - println!("{input_tree}"); - } - - let out_path = if let Some(out_dir) = opt.out_dir_path { - format!("{}/{}.json", out_dir.as_path().display(), opt.input_path.file_stem().unwrap().to_str().unwrap()) - } else { - format!("./{}.json", opt.input_path.file_stem().unwrap().to_str().unwrap()) - }; - - fs::write(Path::new(&out_path), input_tree).expect("failed to write output"); - - Ok(()) -} diff --git a/compiler/parser/src/parser/input.rs b/compiler/parser/src/parser/input.rs deleted file mode 100644 index 4a02c9c720..0000000000 --- a/compiler/parser/src/parser/input.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use super::*; - -use leo_errors::{ParserError, Result}; - -impl ParserContext<'_> { - /// Returns a [`ParsedInputFile`] struct filled with the data acquired in the file. - pub(crate) fn parse_input_file(&mut self) -> Result { - // Allow underscores in identifiers for input record declarations. - self.allow_identifier_underscores = true; - let mut sections = Vec::new(); - - while self.has_next() { - if self.check(&Token::LeftSquare) { - sections.push(self.parse_section()?); - } else { - return Err(ParserError::unexpected_token(self.token.token.clone(), self.token.span).into()); - } - } - - // Do not allow underscores in identifiers outside of input files. - self.allow_identifier_underscores = false; - - Ok(InputAst { sections }) - } - - /// Parses particular section in the Input or State file. - /// ` - /// [] - /// <...definition> - /// ` - /// Returns [`Section`]. - fn parse_section(&mut self) -> Result
{ - self.expect(&Token::LeftSquare)?; - let section = self.expect_identifier()?; - self.expect(&Token::RightSquare)?; - - let mut definitions = Vec::new(); - while let Token::Constant | Token::Public | Token::Identifier(_) = self.token.token { - definitions.push(self.parse_input_definition()?); - } - - Ok(Section { name: section.name, span: section.span, definitions }) - } - - /// Parses a single parameter definition: - /// ` : = ;` - /// Returns [`Definition`]. - fn parse_input_definition(&mut self) -> Result { - let mode = self.parse_mode()?; - - let name = self.expect_identifier()?; - self.expect(&Token::Colon)?; - let (type_, span) = self.parse_type()?; - self.expect(&Token::Assign)?; - let value = self.parse_unary_expression()?; - self.expect(&Token::Semicolon)?; - - Ok(Definition { mode, name, type_, value, span }) - } -} diff --git a/compiler/parser/src/parser/mod.rs b/compiler/parser/src/parser/mod.rs index 038cf80c5d..b906c66c69 100644 --- a/compiler/parser/src/parser/mod.rs +++ b/compiler/parser/src/parser/mod.rs @@ -34,7 +34,6 @@ pub(super) use context::ParserContext; mod expression; mod file; -mod input; mod statement; pub(super) mod type_; @@ -44,15 +43,3 @@ pub fn parse(handler: &Handler, node_builder: &NodeBuilder, source: &str, start_ tokens.parse_program() } - -/// Parses an input file at the given file `path` and `source` code text. -pub fn parse_input( - handler: &Handler, - node_builder: &NodeBuilder, - source: &str, - start_pos: BytePos, -) -> Result { - let mut tokens = ParserContext::new(handler, node_builder, crate::tokenize(source, start_pos)?); - - tokens.parse_input_file() -} diff --git a/leo/cli/commands/build.rs b/leo/cli/commands/build.rs index 5727132dfb..e00ce5b74d 100644 --- a/leo/cli/commands/build.rs +++ b/leo/cli/commands/build.rs @@ -17,8 +17,9 @@ use super::*; use leo_ast::{NodeBuilder, Struct, Stub}; -use leo_compiler::{Compiler, CompilerOptions, InputAst, OutputOptions}; +use leo_compiler::{Compiler, CompilerOptions, OutputOptions}; use leo_package::{build::BuildDirectory, inputs::InputFile, outputs::OutputsDirectory, source::SourceDirectory}; + use leo_span::{symbol::with_session_globals, Symbol}; use snarkvm::{ From 61eede48d74d7e3b6c33f89e058849b9ce480d98 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 10:07:52 -0400 Subject: [PATCH 02/23] Remove input AST parser --- compiler/parser/src/lib.rs | 15 +-------------- compiler/parser/src/test.rs | 13 ------------- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/compiler/parser/src/lib.rs b/compiler/parser/src/lib.rs index f04fe69ddf..4a9470b08c 100644 --- a/compiler/parser/src/lib.rs +++ b/compiler/parser/src/lib.rs @@ -31,7 +31,7 @@ pub(crate) use tokenizer::*; pub mod parser; pub use parser::*; -use leo_ast::{input::InputData, Ast, NodeBuilder, ProgramInput}; +use leo_ast::{Ast, NodeBuilder}; use leo_errors::{emitter::Handler, Result}; #[cfg(test)] @@ -41,16 +41,3 @@ mod test; pub fn parse_ast(handler: &Handler, node_builder: &NodeBuilder, source: &str, start_pos: BytePos) -> Result { Ok(Ast::new(parser::parse(handler, node_builder, source, start_pos)?)) } - -/// Parses program inputs from the input file path -pub fn parse_program_inputs( - handler: &Handler, - node_builder: &NodeBuilder, - input_string: &str, - start_pos: BytePos, -) -> Result { - let program_input: ProgramInput = - parser::parse_input(handler, node_builder, input_string, start_pos)?.try_into()?; - - Ok(InputData { program_input }) -} diff --git a/compiler/parser/src/test.rs b/compiler/parser/src/test.rs index 5c02a5b3c4..9d9bb420d9 100644 --- a/compiler/parser/src/test.rs +++ b/compiler/parser/src/test.rs @@ -202,18 +202,6 @@ impl Namespace for SerializeNamespace { } } -struct InputNamespace; - -impl Namespace for InputNamespace { - fn parse_type(&self) -> ParseType { - ParseType::Whole - } - - fn run_test(&self, test: Test) -> Result { - create_session_if_not_set_then(|s| with_handler(tokenize(test, s)?, |p| p.parse_input_file()).map(yaml_or_fail)) - } -} - struct TestRunner; impl Runner for TestRunner { @@ -223,7 +211,6 @@ impl Runner for TestRunner { "ParseExpression" => Box::new(ParseExpressionNamespace), "ParseStatement" => Box::new(ParseStatementNamespace), "Serialize" => Box::new(SerializeNamespace), - "Input" => Box::new(InputNamespace), "Token" => Box::new(TokenNamespace), _ => return None, }) From bb49ecc929d7e0d8f0248b4d185dd6ca9a6d10ee Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 10:08:11 -0400 Subject: [PATCH 03/23] Update CLI --- leo/cli/commands/build.rs | 23 ++--------------------- leo/cli/commands/execute.rs | 12 ++---------- leo/cli/commands/mod.rs | 4 +--- leo/cli/commands/run.rs | 12 ++---------- 4 files changed, 7 insertions(+), 44 deletions(-) diff --git a/leo/cli/commands/build.rs b/leo/cli/commands/build.rs index e00ce5b74d..2966249d29 100644 --- a/leo/cli/commands/build.rs +++ b/leo/cli/commands/build.rs @@ -49,7 +49,6 @@ impl From for CompilerOptions { type_checked_symbol_table: options.enable_type_checked_symbol_table_snapshot, unrolled_symbol_table: options.enable_unrolled_symbol_table_snapshot, ast_spans_enabled: options.enable_ast_spans, - initial_input_ast: options.enable_initial_input_ast_snapshot, initial_ast: options.enable_initial_ast_snapshot, unrolled_ast: options.enable_unrolled_ast_snapshot, ssa_ast: options.enable_ssa_ast_snapshot, @@ -60,7 +59,6 @@ impl From for CompilerOptions { }, }; if options.enable_all_ast_snapshots { - out_options.output.initial_input_ast = true; out_options.output.initial_ast = true; out_options.output.unrolled_ast = true; out_options.output.ssa_ast = true; @@ -83,7 +81,7 @@ pub struct Build { impl Command for Build { type Input = (); - type Output = (Option, IndexMap); + type Output = (); fn log_span(&self) -> Span { tracing::span!(tracing::Level::INFO, "Leo") @@ -159,23 +157,6 @@ impl Command for Build { retriever.process_local(dependency)?; } - // Load the input file at `package_name.in` - let input_file_path = InputFile::new(&manifest.program_id().name().to_string()).setup_file_path(&package_path); - - // Parse the input file. - let input_ast = if input_file_path.exists() { - // Load the input file into the source map. - let input_sf = with_session_globals(|s| s.source_map.load_file(&input_file_path)) - .map_err(|e| CompilerError::file_read_error(&input_file_path, e))?; - - // TODO: This is a hack to notify the user that something is wrong with the input file. Redesign. - leo_parser::parse_input(&handler, &node_builder, &input_sf.src, input_sf.start_pos) - .map_err(|_e| println!("Warning: Failed to parse input file")) - .ok() - } else { - None - }; - // `Package::open` checks that the build directory and that `main.aleo` and all imported files are well-formed. Package::::open(&build_directory).map_err(CliError::failed_to_execute_build)?; @@ -197,7 +178,7 @@ impl Command for Build { // // Log the result of the build // tracing::info!("{}", result); - Ok((input_ast, structs)) + Ok(()) } } diff --git a/leo/cli/commands/execute.rs b/leo/cli/commands/execute.rs index 2df5b01510..9870af8a70 100644 --- a/leo/cli/commands/execute.rs +++ b/leo/cli/commands/execute.rs @@ -51,16 +51,8 @@ impl Command for Execute { (Build { options: self.compiler_options.clone() }).execute(context) } - fn apply(self, context: Context, input: Self::Input) -> Result { - // If input values are provided, then run the program with those inputs. - // Otherwise, use the input file. - let mut inputs = match self.inputs.is_empty() { - true => match input { - (Some(input_ast), circuits) => input_ast.program_inputs(&self.name, circuits), - _ => Vec::new(), - }, - false => self.inputs, - }; + fn apply(self, context: Context, _: Self::Input) -> Result { + let mut inputs = self.inputs; // Compose the `execute` command. let mut arguments = vec![SNARKVM_COMMAND.to_string(), self.name]; diff --git a/leo/cli/commands/mod.rs b/leo/cli/commands/mod.rs index a06cf64560..fc606785b8 100644 --- a/leo/cli/commands/mod.rs +++ b/leo/cli/commands/mod.rs @@ -49,7 +49,7 @@ pub use update::Update; use super::*; use crate::cli::helpers::context::*; -use leo_errors::{emitter::Handler, CliError, CompilerError, PackageError, Result}; +use leo_errors::{emitter::Handler, CliError, PackageError, Result}; use leo_package::{build::*, outputs::OutputsDirectory, package::*}; use clap::Parser; @@ -138,8 +138,6 @@ pub struct BuildOptions { pub enable_dce: bool, #[clap(long, help = "Writes all AST snapshots for the different compiler phases.")] pub enable_all_ast_snapshots: bool, - #[clap(long, help = "Writes Input AST snapshot of the initial parse.")] - pub enable_initial_input_ast_snapshot: bool, #[clap(long, help = "Writes AST snapshot of the initial parse.")] pub enable_initial_ast_snapshot: bool, #[clap(long, help = "Writes AST snapshot of the unrolled AST.")] diff --git a/leo/cli/commands/run.rs b/leo/cli/commands/run.rs index ab8d243625..cebecaf292 100644 --- a/leo/cli/commands/run.rs +++ b/leo/cli/commands/run.rs @@ -43,16 +43,8 @@ impl Command for Run { (Build { options: self.compiler_options.clone() }).execute(context) } - fn apply(self, context: Context, input: Self::Input) -> Result { - // If input values are provided, then run the program with those inputs. - // Otherwise, use the input file. - let mut inputs = match self.inputs.is_empty() { - true => match input { - (Some(input_ast), circuits) => input_ast.program_inputs(&self.name, circuits), - _ => Vec::new(), - }, - false => self.inputs, - }; + fn apply(self, context: Context, _: Self::Input) -> Result { + let mut inputs = self.inputs; // Compose the `run` command. let mut arguments = vec![SNARKVM_COMMAND.to_string(), self.name]; From a322fcb7acb3f088e79bf713e0e8abe8727491d4 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 10:08:23 -0400 Subject: [PATCH 04/23] Update test framework --- tests/test-framework/benches/leo_compiler.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test-framework/benches/leo_compiler.rs b/tests/test-framework/benches/leo_compiler.rs index 995075f507..12fc29f449 100644 --- a/tests/test-framework/benches/leo_compiler.rs +++ b/tests/test-framework/benches/leo_compiler.rs @@ -97,7 +97,6 @@ fn new_compiler(handler: &Handler) -> Compiler<'_> { unrolled_symbol_table: false, ast_spans_enabled: false, initial_ast: false, - initial_input_ast: false, unrolled_ast: false, ssa_ast: false, flattened_ast: false, From b6a482a3a7bed40e7197986d2d0f08f96b1afbfc Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 10:09:49 -0400 Subject: [PATCH 05/23] Clippy --- leo/cli/commands/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/leo/cli/commands/build.rs b/leo/cli/commands/build.rs index 2966249d29..e856239474 100644 --- a/leo/cli/commands/build.rs +++ b/leo/cli/commands/build.rs @@ -18,9 +18,10 @@ use super::*; use leo_ast::{NodeBuilder, Struct, Stub}; use leo_compiler::{Compiler, CompilerOptions, OutputOptions}; -use leo_package::{build::BuildDirectory, inputs::InputFile, outputs::OutputsDirectory, source::SourceDirectory}; +use leo_package::{build::BuildDirectory, outputs::OutputsDirectory, source::SourceDirectory}; + +use leo_span::{Symbol}; -use leo_span::{symbol::with_session_globals, Symbol}; use snarkvm::{ package::Package, From ce39d9a3f53c10ad7cf858ae2e9947df9791207b Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 10:21:49 -0400 Subject: [PATCH 06/23] Remove requirement for input files in InputsDirectory --- leo/package/src/inputs/input.rs | 94 --------------------------------- leo/package/src/inputs/mod.rs | 3 -- leo/package/src/package.rs | 18 +------ 3 files changed, 1 insertion(+), 114 deletions(-) delete mode 100644 leo/package/src/inputs/input.rs diff --git a/leo/package/src/inputs/input.rs b/leo/package/src/inputs/input.rs deleted file mode 100644 index e7e47e0098..0000000000 --- a/leo/package/src/inputs/input.rs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -//! The `program.in` file. - -use crate::inputs::INPUTS_DIRECTORY_NAME; - -use leo_errors::{PackageError, Result}; - -use serde::Deserialize; -use std::{ - borrow::Cow, - fs::{ - File, - {self}, - }, - io::Write, - path::Path, -}; - -pub static INPUT_FILE_EXTENSION: &str = ".in"; - -#[derive(Deserialize)] -pub struct InputFile { - pub package_name: String, -} - -impl InputFile { - pub fn new(package_name: &str) -> Self { - Self { package_name: package_name.to_string() } - } - - pub fn filename(&self) -> String { - format!("{INPUTS_DIRECTORY_NAME}{}{INPUT_FILE_EXTENSION}", self.package_name) - } - - pub fn exists_at(&self, path: &Path) -> bool { - let path = self.setup_file_path(path); - path.exists() - } - - /// Reads the program input variables from the given file path if it exists. - pub fn read_from<'a>(&self, path: &'a Path) -> Result<(String, Cow<'a, Path>)> { - let path = self.setup_file_path(path); - - let input = fs::read_to_string(&path) - .map_err(|_| PackageError::failed_to_read_input_file(path.clone().into_owned()))?; - Ok((input, path)) - } - - /// Writes the standard input format to a file. - pub fn write_to(self, path: &Path) -> Result<()> { - let path = self.setup_file_path(path); - let mut file = File::create(path).map_err(PackageError::io_error_input_file)?; - - file.write_all(self.template().as_bytes()).map_err(PackageError::io_error_input_file)?; - Ok(()) - } - - fn template(&self) -> String { - format!( - r#"// The program input for {}/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; -"#, - self.package_name - ) - } - - pub fn setup_file_path<'a>(&self, path: &'a Path) -> Cow<'a, Path> { - let mut path = Cow::from(path); - if path.is_dir() { - if !path.ends_with(INPUTS_DIRECTORY_NAME) { - path.to_mut().push(INPUTS_DIRECTORY_NAME); - } - path.to_mut().push(format!("{}{INPUT_FILE_EXTENSION}", self.package_name)); - } - path - } -} diff --git a/leo/package/src/inputs/mod.rs b/leo/package/src/inputs/mod.rs index eaba0a04ee..1019418a80 100644 --- a/leo/package/src/inputs/mod.rs +++ b/leo/package/src/inputs/mod.rs @@ -16,6 +16,3 @@ pub mod directory; pub use directory::*; - -pub mod input; -pub use input::*; diff --git a/leo/package/src/package.rs b/leo/package/src/package.rs index 31f354394f..fc67f4de82 100644 --- a/leo/package/src/package.rs +++ b/leo/package/src/package.rs @@ -16,7 +16,7 @@ use crate::{ build::BuildDirectory, - inputs::{InputFile, InputsDirectory}, + inputs::InputsDirectory, root::{Env, Gitignore}, source::{MainFile, SourceDirectory}, }; @@ -97,13 +97,6 @@ impl Package { let mut result = true; let mut existing_files = vec![]; - // Check if the input file already exists. - let input_file = InputFile::new(package_name); - if input_file.exists_at(path) { - existing_files.push(input_file.filename()); - result = false; - } - // Check if the main file already exists. if MainFile::exists_at(path) { existing_files.push(MainFile::filename()); @@ -124,12 +117,6 @@ impl Package { return false; } - // Check if the input file exists. - let input_file = InputFile::new(package_name); - if !input_file.exists_at(path) { - return false; - } - // Check if the main file exists. if !MainFile::exists_at(path) { return false; @@ -161,9 +148,6 @@ impl Package { // Create the Leo build/ directory BuildDirectory::create(path)?; - // Create the input file in the inputs directory. - InputFile::new(package_name).write_to(path)?; - // Create the main file in the source directory. MainFile::new(package_name).write_to(path)?; From a38c407ea0ac65dc7fa6754b4cae0d5cf9293359 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 10:45:55 -0400 Subject: [PATCH 07/23] Remove parser components related input files --- compiler/parser/src/parser/context.rs | 3 -- compiler/parser/src/parser/expression.rs | 13 +----- errors/src/errors/input/input_errors.rs | 58 ------------------------ errors/src/errors/input/mod.rs | 19 -------- examples/auction/inputs/auction.in | 39 ---------------- 5 files changed, 2 insertions(+), 130 deletions(-) delete mode 100644 errors/src/errors/input/input_errors.rs delete mode 100644 errors/src/errors/input/mod.rs delete mode 100644 examples/auction/inputs/auction.in diff --git a/compiler/parser/src/parser/context.rs b/compiler/parser/src/parser/context.rs index 5e42aa28c9..3554c0b4c0 100644 --- a/compiler/parser/src/parser/context.rs +++ b/compiler/parser/src/parser/context.rs @@ -39,8 +39,6 @@ pub(crate) struct ParserContext<'a> { pub(crate) prev_token: SpannedToken, /// true if parsing an expression for if and loop statements -- means struct inits are not legal pub(crate) disallow_struct_construction: bool, - /// true if parsing an identifier inside an input file. - pub(crate) allow_identifier_underscores: bool, } /// Dummy span used to appease borrow checker. @@ -59,7 +57,6 @@ impl<'a> ParserContext<'a> { handler, node_builder, disallow_struct_construction: false, - allow_identifier_underscores: false, prev_token: token.clone(), token, tokens, diff --git a/compiler/parser/src/parser/expression.rs b/compiler/parser/src/parser/expression.rs index 03e5c7a314..fe6a5217b7 100644 --- a/compiler/parser/src/parser/expression.rs +++ b/compiler/parser/src/parser/expression.rs @@ -17,7 +17,7 @@ use super::*; use leo_errors::{ParserError, Result}; -use leo_span::{sym, Symbol}; +use leo_span::sym; use snarkvm::console::{account::Address, network::Testnet3}; const INT_TYPES: &[Token] = &[ @@ -623,16 +623,7 @@ impl ParserContext<'_> { } fn parse_struct_member(&mut self) -> Result { - let identifier = if self.allow_identifier_underscores && self.eat(&Token::Underscore) { - // Allow `_nonce` for struct records. - let identifier_without_underscore = self.expect_identifier()?; - Identifier::new( - Symbol::intern(&format!("_{}", identifier_without_underscore.name)), - self.node_builder.next_id(), - ) - } else { - self.expect_identifier()? - }; + let identifier = self.expect_identifier()?; let (expression, span) = if self.eat(&Token::Colon) { // Parse individual struct variable declarations. diff --git a/errors/src/errors/input/input_errors.rs b/errors/src/errors/input/input_errors.rs deleted file mode 100644 index b9b03fc8d6..0000000000 --- a/errors/src/errors/input/input_errors.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::create_messages; -use std::fmt::{Debug, Display}; - -create_messages!( - /// InputError enum that represents all the errors for the inputs part of `leo-ast` crate. - InputError, - code_mask: 1000i32, - code_prefix: "INP", - - /// For when declared variable type mismatches actual type. - @formatted - unexpected_type { - args: (expected: impl Display, received: impl Display), - msg: format!( - "unexpected type, expected: '{expected}', received: '{received}'", - ), - help: None, - } - - /// For when the expression is not allowed in an input file. - @formatted - illegal_expression { - args: (expr: impl Display), - msg: format!("expression '{expr}' is not allowed in inputs"), - help: None, - } - - /// For when section name is not an allowed one. - @formatted - unexpected_section { - args: (expected: &[impl Display], received: impl Display), - msg: format!( - "unexpected section: expected {} -- got '{received}'", - expected - .iter() - .map(|x| format!("'{x}'")) - .collect::>() - .join(", ") - ), - help: None, - } -); diff --git a/errors/src/errors/input/mod.rs b/errors/src/errors/input/mod.rs deleted file mode 100644 index 80b2eac545..0000000000 --- a/errors/src/errors/input/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -/// This module contains the Input error definitions. -pub mod input_errors; -pub use self::input_errors::*; diff --git a/examples/auction/inputs/auction.in b/examples/auction/inputs/auction.in deleted file mode 100644 index 468e9d44c1..0000000000 --- a/examples/auction/inputs/auction.in +++ /dev/null @@ -1,39 +0,0 @@ -// The program input for auction/src/main.leo -[place_bid] -// Note that `bidder` must have the same address as the caller (refer to `program.json`). -// Swapping the below lines, will result in an error. -// bidder: address = aleo1y7065c2jxkra5yzu9jfxq55klweqev0zas89lt9nxmfrqrafmq9qw2ktdg; -bidder: address = aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh; -amount: u64 = 90u64; - -[resolve] -first: Bid = Bid { - owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh, - bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh, - amount: 10u64, - is_winner: false, - _nonce: 6480683131255842390406647532838179519970794442201387718334686863304493823461group, -}; -second: Bid = Bid { - owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh, - bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh, - amount: 90u64, - is_winner: false, - _nonce: 1511010328912449299156978046557700301564153667442988008615502964863620401388group, -}; - -[finish] -bid: Bid = Bid { - owner: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh, - bidder: aleo1fxs9s0w97lmkwlcmgn0z3nuxufdee5yck9wqrs0umevp7qs0sg9q5xxxzh, - amount: 90u64, - is_winner: false, - _nonce: 4195536711021629817871261453343069023119119274215827022954896024118351555272group, -}; - - - - - - - From e990b7ca66df380513b1dab8f73993415dc2dea9 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 10:46:36 -0400 Subject: [PATCH 08/23] Remove input errors --- errors/ERROR_INDEX.md | 2 -- errors/README.md | 8 ------- errors/src/errors/mod.rs | 10 +-------- errors/src/errors/state/mod.rs | 19 ---------------- errors/src/errors/state/state_errors.rs | 29 ------------------------- 5 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 errors/src/errors/state/mod.rs delete mode 100644 errors/src/errors/state/state_errors.rs diff --git a/errors/ERROR_INDEX.md b/errors/ERROR_INDEX.md index 039d20d286..01ec5214ab 100644 --- a/errors/ERROR_INDEX.md +++ b/errors/ERROR_INDEX.md @@ -2,8 +2,6 @@ ## Parser Errors: Error Code Range 370_000 - 370_999 -## State Errors: Error Code Range 371_000 - 371_999 - ## AST Errors: Error Code Range 372_000 - 372_999 ## ASG Errors: Error Code Range 373_000 - 373_999 diff --git a/errors/README.md b/errors/README.md index 392b6a83f1..90c0528a0c 100644 --- a/errors/README.md +++ b/errors/README.md @@ -49,10 +49,6 @@ The errors for the `leo-compiler` crate. Its error codes will range from 6_000-6 The errors for the `leo-imports` crate. Its error codes will range from 4_000-4_999 and be prefixed with the characters `IMP`. -### Input - -The errors for the `leo-ast` crate. Its error codes will range from 8_000-8_999 and be prefixed with the characters `INP`. - ### Loop Unrolling The errors for loop unrolling in the `leo-passes` crate. Its error codes will range from 9_000-9_999 and be prefixed with the characters `LUN`. @@ -70,10 +66,6 @@ The errors for the `leo-parser` crate. Its error codes will range from 0-999 and The errors from SnarkVM that bubble up into Leo in some situations. For right now, they have an exit code of 1. When SnarkVM implements better error codes and messages, we can bubble them up. -### State - -The errors for the `leo-state` crate. Its error codes will range from 1_000-1_999 and be prefixed with the characters `STA`. - ### Utils The errors related to dependency retrieval in the `utils` crate. Its error codes will range from 10_000-10_999 and be prefixed with the characters `DEP`. diff --git a/errors/src/errors/mod.rs b/errors/src/errors/mod.rs index a747a1bef6..80b84cd314 100644 --- a/errors/src/errors/mod.rs +++ b/errors/src/errors/mod.rs @@ -33,10 +33,7 @@ pub use self::compiler::*; pub mod flattener; pub use self::flattener::*; -/// Contains the Input error definitions. -pub mod input; -pub use self::input::*; - +/// Contains the Loop Unroller error definitions. pub mod loop_unroller; pub use self::loop_unroller::*; @@ -69,9 +66,6 @@ pub enum LeoError { /// Represents an Compiler Error in a Leo Error. #[error(transparent)] CompilerError(#[from] CompilerError), - /// Represents an Input Error in a Leo Error. - #[error(transparent)] - InputError(#[from] InputError), /// Represents an Package Error in a Leo Error. #[error(transparent)] PackageError(#[from] PackageError), @@ -108,7 +102,6 @@ impl LeoError { AstError(error) => error.error_code(), CompilerError(error) => error.error_code(), CliError(error) => error.error_code(), - InputError(error) => error.error_code(), ParserError(error) => error.error_code(), PackageError(error) => error.error_code(), TypeCheckerError(error) => error.error_code(), @@ -128,7 +121,6 @@ impl LeoError { AstError(error) => error.exit_code(), CompilerError(error) => error.exit_code(), CliError(error) => error.exit_code(), - InputError(error) => error.exit_code(), ParserError(error) => error.exit_code(), PackageError(error) => error.exit_code(), TypeCheckerError(error) => error.exit_code(), diff --git a/errors/src/errors/state/mod.rs b/errors/src/errors/state/mod.rs deleted file mode 100644 index d67880f7c0..0000000000 --- a/errors/src/errors/state/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -/// This module contains the State error definitions. -pub mod state_errors; -pub use self::state_errors::*; diff --git a/errors/src/errors/state/state_errors.rs b/errors/src/errors/state/state_errors.rs deleted file mode 100644 index fe29e529e5..0000000000 --- a/errors/src/errors/state/state_errors.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (C) 2019-2023 Aleo Systems Inc. -// This file is part of the Leo library. - -// The Leo library is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// The Leo library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with the Leo library. If not, see . - -use crate::create_errors; - -use std::{ - error::Error as ErrorArg, - fmt::{Debug, Display}, -}; - -create_errors!( - /// StateError enum that represents all the errors for the `leo-state` crate. - StateError, - exit_code_mask: 1000i32, - error_code_prefix: "STA", -); From e4ddfcda25d55860256394b55aeaf2ad9c1d0345 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 11:13:12 -0400 Subject: [PATCH 09/23] Remove input files written in leo example --- examples/basic_bank/inputs/basic_bank.in | 21 ------------ examples/battleship/inputs/battleship.in | 4 --- .../interest/inputs/{interest.in => fixed.in} | 0 examples/lottery/inputs/lottery.in | 2 -- .../inputs/{simple_token.in => transfer.in} | 0 examples/token/inputs/token.in | 34 ------------------- examples/vote/inputs/{vote.in => propose.in} | 0 leo/cli/commands/example.rs | 18 ---------- leo/cli/commands/execute.rs | 2 +- leo/cli/commands/run.rs | 4 +-- 10 files changed, 3 insertions(+), 82 deletions(-) delete mode 100644 examples/basic_bank/inputs/basic_bank.in delete mode 100644 examples/battleship/inputs/battleship.in rename examples/interest/inputs/{interest.in => fixed.in} (100%) delete mode 100644 examples/lottery/inputs/lottery.in rename examples/simple_token/inputs/{simple_token.in => transfer.in} (100%) delete mode 100644 examples/token/inputs/token.in rename examples/vote/inputs/{vote.in => propose.in} (100%) diff --git a/examples/basic_bank/inputs/basic_bank.in b/examples/basic_bank/inputs/basic_bank.in deleted file mode 100644 index 69429846bb..0000000000 --- a/examples/basic_bank/inputs/basic_bank.in +++ /dev/null @@ -1,21 +0,0 @@ -// Inputs for the `issue` function. -[issue] -owner: address = aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a; -amount: u64 = 1234u64; - -// Inputs for the `deposit` function. -[deposit] -token: Token = Token { - owner: aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a, - amount: 1234u64, - _nonce: 0group, -}; -amount: u64 = 321u64; - -// Inputs for the `withdraw` function. -[withdraw] -recipient: address = aleo1t0uer3jgtsgmx5tq6x6f9ecu8tr57rzzfnc2dgmcqldceal0ls9qf6st7a; -amount: u64 = 321u64; -rate: u64 = 1500u64; -periods: u64 = 10u64; - diff --git a/examples/battleship/inputs/battleship.in b/examples/battleship/inputs/battleship.in deleted file mode 100644 index a62118476f..0000000000 --- a/examples/battleship/inputs/battleship.in +++ /dev/null @@ -1,4 +0,0 @@ -// The program input for battleship/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; diff --git a/examples/interest/inputs/interest.in b/examples/interest/inputs/fixed.in similarity index 100% rename from examples/interest/inputs/interest.in rename to examples/interest/inputs/fixed.in diff --git a/examples/lottery/inputs/lottery.in b/examples/lottery/inputs/lottery.in deleted file mode 100644 index 5d7b241d61..0000000000 --- a/examples/lottery/inputs/lottery.in +++ /dev/null @@ -1,2 +0,0 @@ -// The program input for lottery/src/main.leo -[play] diff --git a/examples/simple_token/inputs/simple_token.in b/examples/simple_token/inputs/transfer.in similarity index 100% rename from examples/simple_token/inputs/simple_token.in rename to examples/simple_token/inputs/transfer.in diff --git a/examples/token/inputs/token.in b/examples/token/inputs/token.in deleted file mode 100644 index fd1d929747..0000000000 --- a/examples/token/inputs/token.in +++ /dev/null @@ -1,34 +0,0 @@ -// The program input for token/src/main.leo -[mint_public] -receiver: address = aleo1ptqvxu4gjfge8tuhgq2pqap0u5pms4p97gwhu7dwngxshpfzcszsswzpzd; -amount: u64 = 100u64; - -[mint_private] -receiver: address = aleo1ptqvxu4gjfge8tuhgq2pqap0u5pms4p97gwhu7dwngxshpfzcszsswzpzd; -amount: u64 = 100u64; - -[transfer_public] -receiver: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; -amount: u64 = 50u64; - -[transfer_private] -sender: token = token { - owner: aleo1ptqvxu4gjfge8tuhgq2pqap0u5pms4p97gwhu7dwngxshpfzcszsswzpzd, - amount: 100u64, - _nonce: 0group, -}; -receiver: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; -amount: u64 = 50u64; - -[transfer_private_to_public] -sender: token = token { - owner: aleo1ptqvxu4gjfge8tuhgq2pqap0u5pms4p97gwhu7dwngxshpfzcszsswzpzd, - amount: 100u64, - _nonce: 0group, -}; -receiver: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; -amount: u64 = 50u64; - -[transfer_public_to_private] -receiver: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; -amount: u64 = 50u64; diff --git a/examples/vote/inputs/vote.in b/examples/vote/inputs/propose.in similarity index 100% rename from examples/vote/inputs/vote.in rename to examples/vote/inputs/propose.in diff --git a/leo/cli/commands/example.rs b/leo/cli/commands/example.rs index bb16dffdd1..7952cfa85f 100644 --- a/leo/cli/commands/example.rs +++ b/leo/cli/commands/example.rs @@ -48,10 +48,6 @@ impl Command for Example { let main_file_path = package_dir.join("src").join("main.leo"); fs::write(main_file_path, self.main_file_string()).map_err(CliError::failed_to_write_file)?; - // Write the input file. - let input_file_path = package_dir.join("inputs").join(format!("{}.in", self.name())); - fs::write(input_file_path, self.input_file_string()).map_err(CliError::failed_to_write_file)?; - // Write the README file. let readme_file_path = package_dir.join("README.md"); let readme_file_path_string = readme_file_path.display().to_string(); @@ -94,20 +90,6 @@ impl Example { } } - fn input_file_string(&self) -> String { - match self { - Self::Lottery => { - include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/lottery/inputs/lottery.in")).to_string() - } - Self::TicTacToe => { - include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/tictactoe/inputs/tictactoe.in")).to_string() - } - Self::Token => { - include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/examples/token/inputs/token.in")).to_string() - } - } - } - fn readme_file_string(&self) -> String { match self { Self::Lottery => { diff --git a/leo/cli/commands/execute.rs b/leo/cli/commands/execute.rs index 9870af8a70..3f148b4221 100644 --- a/leo/cli/commands/execute.rs +++ b/leo/cli/commands/execute.rs @@ -24,7 +24,7 @@ pub struct Execute { #[clap(name = "NAME", help = "The name of the program to execute.", default_value = "main")] name: String, - #[clap(name = "INPUTS", help = "The inputs to the program. If none are provided, the input file is used.")] + #[clap(name = "INPUTS", help = "The inputs to the program.")] inputs: Vec, #[clap( diff --git a/leo/cli/commands/run.rs b/leo/cli/commands/run.rs index cebecaf292..222baf8d83 100644 --- a/leo/cli/commands/run.rs +++ b/leo/cli/commands/run.rs @@ -24,8 +24,8 @@ pub struct Run { #[clap(name = "NAME", help = "The name of the program to run.", default_value = "main")] pub(crate) name: String, - #[clap(name = "INPUTS", help = "The inputs to the program. If none are provided, the input file is used.")] - pub(crate) inputs: Vec, + #[clap(name = "INPUTS", help = "The inputs to the program.")] + inputs: Vec, #[clap(flatten)] pub(crate) compiler_options: BuildOptions, From e8a46b76289039605688c4f436fa772c79a136f3 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 11:13:49 -0400 Subject: [PATCH 10/23] WIP removing input files from examples --- examples/README.md | 16 ++++---- examples/auction/README.md | 8 ---- examples/basic_bank/README.md | 16 -------- examples/bubblesort/inputs/bubblesort.in | 11 +----- examples/core/inputs/core.in | 4 +- examples/fibonacci/inputs/fibonacci.in | 4 +- examples/groups/inputs/groups.in | 5 +-- .../ntzdebruijn/inputs/ntzdebruijn.in | 4 +- .../ntzgaudet/inputs/ntzgaudet.in | 4 +- .../ntzloops/inputs/ntzloops.in | 4 +- .../ntzmasks/inputs/ntzmasks.in | 4 +- .../ntzreisers/inputs/ntzreisers.in | 4 +- .../ntzseals/inputs/ntzseals.in | 4 +- .../ntzsearchtree/inputs/ntzsearchtree.in | 4 +- .../ntzsmallvals/inputs/ntzsmallvals.in | 4 +- examples/helloworld/inputs/helloworld.in | 5 +-- examples/interest/inputs/bounded.in | 1 + examples/interest/inputs/fixed.in | 10 +---- examples/message/inputs/message.in | 8 +--- examples/simple_token/inputs/mint.in | 1 + examples/simple_token/inputs/transfer.in | 12 +----- examples/tictactoe/README.md | 10 ----- examples/tictactoe/inputs/tictactoe.in | 16 +------- examples/twoadicity/inputs/twoadicity.in | 12 +----- examples/vote/inputs/argree.in | 5 +++ examples/vote/inputs/new_ticket.in | 1 + examples/vote/inputs/propose.in | 24 +----------- tests/README.md | 38 +------------------ 28 files changed, 39 insertions(+), 200 deletions(-) create mode 100644 examples/interest/inputs/bounded.in create mode 100644 examples/simple_token/inputs/mint.in create mode 100644 examples/vote/inputs/argree.in create mode 100644 examples/vote/inputs/new_ticket.in diff --git a/examples/README.md b/examples/README.md index 854f260608..375b786211 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,26 +1,26 @@ # Leo Examples -This directory includes the following Leo code examples: +This directory includes the following Leo code including: 1. Hello World -> Basic Sum of two u32 2. Groups -> Basic operations over groups 3. Core -> Core functions over a field type 4. Bubblesort -> Sorting algorithms over a tuple -5. Import point -> Import code from another file -6. Message -> Initialization of a struct -7. Token -> Record example +5. Message -> Initialization of a struct +6. Token -> Record example + +along with many more. ## Run Guide To run each program, run: ```bash -leo run main +leo run main ``` -This command will look in the input file inputs/*.in where should find a section [main] and use the variables as inputs to the program. ## Execute Guide To execute each program call, run: ```bash -leo execute main --endpoint -``` \ No newline at end of file +leo execute main +``` diff --git a/examples/auction/README.md b/examples/auction/README.md index 16001a6196..bb9c5041b0 100644 --- a/examples/auction/README.md +++ b/examples/auction/README.md @@ -36,7 +36,6 @@ The auction is conducted in a series of stages. ## Running the Program Leo provides users with a command line interface for compiling and running Leo programs. -Users may either specify input values via the command line or provide an input file in `inputs/`. ### Configuring Accounts The `.env` file contains a private key. @@ -50,16 +49,9 @@ To generate a new account, navigate to [aleo.tools](https://aleo.tools). ### Providing inputs via the command line. -1. Run ```bash leo run ... ``` See `./run.sh` for an example. -### Using an input file. -1. Modify `inputs/auction.in` with the desired inputs. -2. Run -```bash -leo run -``` diff --git a/examples/basic_bank/README.md b/examples/basic_bank/README.md index d84cf19285..6d54308036 100644 --- a/examples/basic_bank/README.md +++ b/examples/basic_bank/README.md @@ -37,7 +37,6 @@ Can you find any others? ## Running the Program Leo provides users with a command line interface for compiling and running Leo programs. -Users may either specify input values via the command line or provide an input file in `inputs/`. ### Configuring Accounts The `.env` file contains a private key. @@ -50,22 +49,7 @@ The [Aleo SDK](https://github.com/AleoHQ/leo/tree/testnet3) provides an interfac To generate a new account, navigate to [aleo.tools](https://aleo.tools). ### Providing inputs via the command line. -1. Run ```bash leo run ... ``` See `./run.sh` for an example. - - -### Using an input file. -1. Modify `inputs/auction.in` with the desired inputs. -2. Run -```bash -leo run -``` -For example, -```bash -leo run issue -leo run deposit -leo run withdraw -``` diff --git a/examples/bubblesort/inputs/bubblesort.in b/examples/bubblesort/inputs/bubblesort.in index a435f71f0e..e4cf310a79 100644 --- a/examples/bubblesort/inputs/bubblesort.in +++ b/examples/bubblesort/inputs/bubblesort.in @@ -1,12 +1,3 @@ -// The program input for bubblesort_tuple/src/main.leo -[bubble_sort] -arr0: u32 = 13u32; -arr1: u32 = 2u32; -arr2: u32 = 4u32; -arr3: u32 = 3u32; -arr4: u32 = 5u32; -arr5: u32 = 10u32; -arr6: u32 = 7u32; -arr7: u32 = 1u32; +13u32 2u32 4u32 3u32 5u32 10u32 7u32 1u32 diff --git a/examples/core/inputs/core.in b/examples/core/inputs/core.in index b270c2ace9..336793ee4e 100644 --- a/examples/core/inputs/core.in +++ b/examples/core/inputs/core.in @@ -1,4 +1,2 @@ -// The program input for core/src/main.leo -[main] -public a: field = 1field; +1field diff --git a/examples/fibonacci/inputs/fibonacci.in b/examples/fibonacci/inputs/fibonacci.in index 5a7b84c071..9ba1528650 100644 --- a/examples/fibonacci/inputs/fibonacci.in +++ b/examples/fibonacci/inputs/fibonacci.in @@ -1,3 +1 @@ -// The program input for fibonacci/src/main.leo -[fibonacci] -public n: u8 = 63u8; +63u8 diff --git a/examples/groups/inputs/groups.in b/examples/groups/inputs/groups.in index e3e45c9c2c..8fd3c23e6d 100644 --- a/examples/groups/inputs/groups.in +++ b/examples/groups/inputs/groups.in @@ -1,4 +1 @@ -// The program input for groups/src/main.leo -// Leo will use provided string as the x coordinate and attempt to recover the y coordinate to form a group. -[main] -a: group = 1817767092074430972953743941103352519057913259183777531581123188265134806220group; +1817767092074430972953743941103352519057913259183777531581123188265134806220group diff --git a/examples/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in b/examples/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in index 6ccda493e8..b140da3eb3 100644 --- a/examples/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in +++ b/examples/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in @@ -1,3 +1 @@ -// The program input for ntzdebruijn/src/main.leo -[main] -public x: u32 = 2147483648u32; +2147483648u32 diff --git a/examples/hackers-delight/ntzgaudet/inputs/ntzgaudet.in b/examples/hackers-delight/ntzgaudet/inputs/ntzgaudet.in index f740df6320..b140da3eb3 100644 --- a/examples/hackers-delight/ntzgaudet/inputs/ntzgaudet.in +++ b/examples/hackers-delight/ntzgaudet/inputs/ntzgaudet.in @@ -1,3 +1 @@ -// The program input for ntzgaudet/src/main.leo -[main] -public x: u32 = 2147483648u32; +2147483648u32 diff --git a/examples/hackers-delight/ntzloops/inputs/ntzloops.in b/examples/hackers-delight/ntzloops/inputs/ntzloops.in index 9b472e4e7c..b140da3eb3 100644 --- a/examples/hackers-delight/ntzloops/inputs/ntzloops.in +++ b/examples/hackers-delight/ntzloops/inputs/ntzloops.in @@ -1,3 +1 @@ -// The program input for ntzloops/src/main.leo -[main] -public x: u32 = 2147483648u32; +2147483648u32 diff --git a/examples/hackers-delight/ntzmasks/inputs/ntzmasks.in b/examples/hackers-delight/ntzmasks/inputs/ntzmasks.in index cf8aad75a4..8a4354d07d 100644 --- a/examples/hackers-delight/ntzmasks/inputs/ntzmasks.in +++ b/examples/hackers-delight/ntzmasks/inputs/ntzmasks.in @@ -1,3 +1 @@ -// The program input for ntzmasks/src/main.leo -[main] -public x: u32 = 1073741824u32; +1073741824u32 diff --git a/examples/hackers-delight/ntzreisers/inputs/ntzreisers.in b/examples/hackers-delight/ntzreisers/inputs/ntzreisers.in index e32704ee31..b140da3eb3 100644 --- a/examples/hackers-delight/ntzreisers/inputs/ntzreisers.in +++ b/examples/hackers-delight/ntzreisers/inputs/ntzreisers.in @@ -1,3 +1 @@ -// The program input for ntzreisers/src/main.leo -[main] -public x: u32 = 2147483648u32; +2147483648u32 diff --git a/examples/hackers-delight/ntzseals/inputs/ntzseals.in b/examples/hackers-delight/ntzseals/inputs/ntzseals.in index 74ddc44340..b140da3eb3 100644 --- a/examples/hackers-delight/ntzseals/inputs/ntzseals.in +++ b/examples/hackers-delight/ntzseals/inputs/ntzseals.in @@ -1,3 +1 @@ -// The program input for nztseals/src/main.leo -[main] -public x: u32 = 2147483648u32; +2147483648u32 diff --git a/examples/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in b/examples/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in index 19caf1bdb5..b140da3eb3 100644 --- a/examples/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in +++ b/examples/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in @@ -1,3 +1 @@ -// The program input for ntzsearchtree/src/main.leo -[main] -public z: u32 = 2147483648u32; +2147483648u32 diff --git a/examples/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in b/examples/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in index 5f84301885..b140da3eb3 100644 --- a/examples/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in +++ b/examples/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in @@ -1,3 +1 @@ -// The program input for ntzsmallvals/src/main.leo -[main] -public x: u32 = 2147483648u32; +2147483648u32 diff --git a/examples/helloworld/inputs/helloworld.in b/examples/helloworld/inputs/helloworld.in index 89e24a5ea8..35ea052c38 100644 --- a/examples/helloworld/inputs/helloworld.in +++ b/examples/helloworld/inputs/helloworld.in @@ -1,4 +1 @@ -// The program input for helloworld/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; // Input variable `b` is private by default. \ No newline at end of file +1u32 2u32 diff --git a/examples/interest/inputs/bounded.in b/examples/interest/inputs/bounded.in new file mode 100644 index 0000000000..01909ddbde --- /dev/null +++ b/examples/interest/inputs/bounded.in @@ -0,0 +1 @@ +80u32 5u32 10u8 diff --git a/examples/interest/inputs/fixed.in b/examples/interest/inputs/fixed.in index 2017b5c613..95572d3936 100644 --- a/examples/interest/inputs/fixed.in +++ b/examples/interest/inputs/fixed.in @@ -1,9 +1 @@ -// The program input for interest/src/main.leo -[fixed_iteration_interest] -capital: u32 = 80u32; -rate: u32 = 5u32; // 5% - -[bounded_iteration_interest] -capital: u32 = 80u32; -rate: u32 = 5u32; // 5% -iterations: u8 = 10u8; +80u32 5u32 diff --git a/examples/message/inputs/message.in b/examples/message/inputs/message.in index cb5293db1b..c5c26e2850 100644 --- a/examples/message/inputs/message.in +++ b/examples/message/inputs/message.in @@ -1,7 +1 @@ -// The program input for message/src/main.leo -// To pass "m" into the "main" function we -// 1. Define the "Message" type. -// 2. Use brackets `{ }` to enclose the struct members. -// 3. Define each struct member `name : value`. -[main] -m: Message = Message { first: 2field, second: 3field }; +"{ first: 2field, second: 3field }" diff --git a/examples/simple_token/inputs/mint.in b/examples/simple_token/inputs/mint.in new file mode 100644 index 0000000000..e157dbe766 --- /dev/null +++ b/examples/simple_token/inputs/mint.in @@ -0,0 +1 @@ +aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 100u64 diff --git a/examples/simple_token/inputs/transfer.in b/examples/simple_token/inputs/transfer.in index 6110325743..20d69398c9 100644 --- a/examples/simple_token/inputs/transfer.in +++ b/examples/simple_token/inputs/transfer.in @@ -1,13 +1,5 @@ -// The program input for simple_token/src/main.leo -[mint] -owner: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; -amount: u64 = 100u64; - -[transfer] -token: Token = Token { +"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, amount: 100u64, _nonce: 0group, -}; -to: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; -amount: u64 = 50u64; +}" aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 50u64 diff --git a/examples/tictactoe/README.md b/examples/tictactoe/README.md index 84d6f7f33c..1696d144a7 100644 --- a/examples/tictactoe/README.md +++ b/examples/tictactoe/README.md @@ -27,23 +27,13 @@ An alternative representation would be to use an array, however, these are not y ## Running the Program Leo provides users with a command line interface for compiling and running Leo programs. -Users may either specify input values via the command line or provide an input file in `inputs/`. ### Providing inputs via the command line. -1. Run ```bash leo run ... ``` See `./run.sh` for an example. - -### Using an input file. -1. Modify `inputs/tictactoe.in` with the desired inputs. -2. Run -```bash -leo run -``` - ## Executing the Program ```bash leo execute ... diff --git a/examples/tictactoe/inputs/tictactoe.in b/examples/tictactoe/inputs/tictactoe.in index aff78f3ac5..1e8ccb36ed 100644 --- a/examples/tictactoe/inputs/tictactoe.in +++ b/examples/tictactoe/inputs/tictactoe.in @@ -1,18 +1,6 @@ -// The `new` function does not take any inputs. -[new] - -// Inputs for the `make_move` function. -// - `player` : A u8 representing the player making the move. 1 for player 1, 2 for player 2. -// - `row` : A u8 representing the row to make the move in. -// - `column` : A u8 representing the column to make the move in. -// - `board` : A representation of the board state. -[make_move] -player: u8 = 1u8; -row: u8 = 1u8; -col: u8 = 1u8; -board: Board = Board { +1u8 1u8 1u8 "{ r1: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, r2: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, r3: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, -}; +}" diff --git a/examples/twoadicity/inputs/twoadicity.in b/examples/twoadicity/inputs/twoadicity.in index 2cc7860439..c01cac0720 100644 --- a/examples/twoadicity/inputs/twoadicity.in +++ b/examples/twoadicity/inputs/twoadicity.in @@ -1,11 +1 @@ -// The program input for twoadicity/src/main.leo -[main] -// Here is a made-up example. -// public a: field = 391995973843653359517682711560178397928211734490775552field; -// (comes from: 2field.pow(41) * 178259130663561045147472537592047227885001field) - -// This example is (maxfield - 1). -// The output for this can be seen in the Pratt certificate -// for bls12-377-scalar-field-prime -// as the number of factors of 2 in (bls12-377-scalar-field-prime - 1). -public a: field = 8444461749428370424248824938781546531375899335154063827935233455917409239040field; +8444461749428370424248824938781546531375899335154063827935233455917409239040field diff --git a/examples/vote/inputs/argree.in b/examples/vote/inputs/argree.in new file mode 100644 index 0000000000..2b345cce76 --- /dev/null +++ b/examples/vote/inputs/argree.in @@ -0,0 +1,5 @@ +"{ + owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, + pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field, + _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group +}" diff --git a/examples/vote/inputs/new_ticket.in b/examples/vote/inputs/new_ticket.in new file mode 100644 index 0000000000..4cbadd2fce --- /dev/null +++ b/examples/vote/inputs/new_ticket.in @@ -0,0 +1 @@ +2264670486490520844857553240576860973319410481267184439818180411609250173817field aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau diff --git a/examples/vote/inputs/propose.in b/examples/vote/inputs/propose.in index ac94c9b3f2..d2eedd15a9 100644 --- a/examples/vote/inputs/propose.in +++ b/examples/vote/inputs/propose.in @@ -1,25 +1,5 @@ -// The program input for vote/src/main.leo -[propose] -info: ProposalInfo = ProposalInfo { +"{ title: 2077160157502449938194577302446444field, content: 1452374294790018907888397545906607852827800436field, proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2, -}; - -[new_ticket] -pid: field = 2264670486490520844857553240576860973319410481267184439818180411609250173817field; -voter: address = aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau; - -[agree] -ticket: Ticket = Ticket { - owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, - pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field, - _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group -}; - -[disagree] -ticket: Ticket = Ticket { - owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, - pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field, - _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group -}; +}" diff --git a/tests/README.md b/tests/README.md index 96ce6ddd62..a061c3d83f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -61,45 +61,9 @@ Parser Directory namespaces: - `ParseExpression` - Test a file line by line to check that each line is a valid Leo expression. - `ParseStatement` - Test a file consuming multiple lines till a blank line to check that it contains a valid Leo statement. - `Serialize` - Test a file to check that it can be serialized to JSON. -- `Input` - Test an input file to check that it is a valid Leo input file. - `Token` - Test a file line by line to check that it contains zero or more valid Leo parser tokens. Compiler Directory namespaces: - `Compiler` - Test a file to check that it is a valid Leo program, and it can be compiled without errors. - -### expectation - -```yaml -- Mandatory: yes -- Namespace: all -- Values: Pass / Fail -``` - -This setting indicates whether the tested code is supposed to succeed or to fail. -If the test was marked as `Pass` but it actually failed, -you'll know that something went wrong and the test or the compiler/parser needs fixing. - -### input_file (Compile) - -```yaml -- Mandatory: no -- Namespace: Compile -- Values: , ... -``` - -This setting allows using one or more input files for the Leo program. -The program will be run with every provided input. -See this example: - -```yaml -/* -namespace: Compile -expectation: Pass -input_file: - - inputs/a_0.in - - inputs/a_1.in -*/ - -function main(a: u32) {} -``` +- `Execute` - Test a file to check that it is a valid Leo program, and it can be compiled and executed without errors. From 7e145728e0d8fb07ef1aa403e39b316b99fc8bf6 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 12:25:30 -0400 Subject: [PATCH 11/23] Update CI and examples --- .circleci/test-examples.sh | 508 +++++++++++------------ examples/bubblesort/inputs/bubblesort.in | 2 - examples/simple_token/inputs/transfer.in | 6 +- examples/tictactoe/inputs/tictactoe.in | 7 +- examples/token/.env | 4 +- examples/vote/inputs/argree.in | 6 +- examples/vote/inputs/disagree.in | 1 + examples/vote/inputs/propose.in | 6 +- examples/vote/run.sh | 8 +- 9 files changed, 256 insertions(+), 292 deletions(-) create mode 100644 examples/vote/inputs/disagree.in diff --git a/.circleci/test-examples.sh b/.circleci/test-examples.sh index c6ca854af6..bb4f0efcb5 100755 --- a/.circleci/test-examples.sh +++ b/.circleci/test-examples.sh @@ -4,255 +4,249 @@ leo() { $LEO "$@" } -# Build and run the auction Leo program. -echo "Building and running the \`auction\` program..." -( - cd $EXAMPLES/auction || exit - $LEO run place_bid || exit - $LEO run resolve || exit - $LEO run finish || exit - - chmod +x $EXAMPLES/auction/run.sh || exit - export -f leo || exit - $EXAMPLES/auction/run.sh || exit -) -# Check that the auction program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`auction\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the basic_bank Leo program. -echo "Building and running the \`basic_bank\` program..." -( - cd $EXAMPLES/basic_bank || exit - $LEO run issue || exit - $LEO run deposit || exit - $LEO run withdraw || exit - - chmod +x $EXAMPLES/basic_bank/run.sh || exit - export -f leo || exit - $EXAMPLES/basic_bank/run.sh || exit -) -# Check that the basic_bank program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`basic_bank\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the battleship Leo program. -echo "Building and running the \`battleship\` program..." -which leo -( - cd $EXAMPLES/battleship || exit - - chmod +x $EXAMPLES/battleship/run.sh || exit - export -f leo || exit - $EXAMPLES/battleship/run.sh || exit -) -# Check that the battleship program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`battleship\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the bubblesort Leo program. -echo "Building and running the \`bubblesort\` program..." -( - cd $EXAMPLES/bubblesort || exit - $LEO run bubble_sort || exit -) -# Check that the bubblesort program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`bubblesort\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the core example Leo program. -echo "Building and running the \`core\` program..." -( - cd $EXAMPLES/core || exit - $LEO run main || exit -) -# Check that the core program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`core\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the groups example Leo program. -echo "Building and running the \`groups\` program..." -( - cd $EXAMPLES/groups || exit - $LEO run main || exit -) -# Check that the groups program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`groups\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the hackers-delight/ntzdebruijn program. -echo "Building and running the \`hackers-delight/ntzdebruijn\` program..." -( - cd $EXAMPLES/hackers-delight/ntzdebruijn || exit - $LEO run || exit -) -# Check that the hackers-delight/ntzdebruijn program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`hackers-delight/ntzdebruijn\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the hackers-delight/ntzgaudet program. -echo "Building and running the \`hackers-delight/ntzgaudet\` program..." -( - cd $EXAMPLES/hackers-delight/ntzgaudet || exit - $LEO run || exit -) -# Check that the hackers-delight/ntzgaudet program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`hackers-delight/ntzgaudet\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the hackers-delight/ntzloops program. -echo "Building and running the \`hackers-delight/ntzloops\` program..." -( - cd $EXAMPLES/hackers-delight/ntzloops || exit - $LEO run || exit -) -# Check that the hackers-delight/ntzloops program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`hackers-delight/ntzloops\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the hackers-delight/ntzmasks program. -echo "Building and running the \`hackers-delight/ntzmasks\` program..." -( - cd $EXAMPLES/hackers-delight/ntzmasks || exit - $LEO run || exit -) -# Check that the hackers-delight/ntzmasks program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`hackers-delight/ntzmasks\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the hackers-delight/ntzreisers program. -echo "Building and running the \`hackers-delight/ntzreisers\` program..." -( - cd $EXAMPLES/hackers-delight/ntzreisers || exit - $LEO run || exit -) -# Check that the hackers-delight/ntzreisers program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`hackers-delight/ntzreisers\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the hackers-delight/ntzseals program. -echo "Building and running the \`hackers-delight/ntzseals\` program..." -( - cd $EXAMPLES/hackers-delight/ntzseals || exit - $LEO run || exit -) -# Check that the hackers-delight/ntzseals program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`hackers-delight/ntzseals\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the hackers-delight/ntzsearchtree program. -echo "Building and running the \`hackers-delight/ntzsearchtree\` program..." -( - cd $EXAMPLES/hackers-delight/ntzsearchtree || exit - $LEO run || exit -) -# Check that the hackers-delight/ntzsearchtree program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`hackers-delight/ntzsearchtree\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the hackers-delight/ntzsmallvals program. -echo "Building and running the \`hackers-delight/ntzsmallvals\` program..." -( - cd $EXAMPLES/hackers-delight/ntzsmallvals || exit - $LEO run || exit -) -# Check that the hackers-delight/ntzsmallvals program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`hackers-delight/ntzsmallvals\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the helloworld Leo program. -echo "Building and running the \`helloworld\` program..." -( - cd $EXAMPLES/helloworld || exit - $LEO run main || exit -) -# Check that the helloworld program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`helloworld\` program failed to run successfully." - exit $EXITCODE -fi - - -# Build and run the interest example Leo programs. -echo "Building and running the \`interest\` programs..." -( - cd $EXAMPLES/interest || exit - - # Run the fixed period interest program. - $LEO run fixed_iteration_interest || exit - - # Run the bounded period interest program. - $LEO run bounded_iteration_interest || exit -) -# Check that the interest programs ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`interest\` program failed to run successfully." - exit $EXITCODE -fi - -# Build and run the message example Leo program. -echo "Building and running the \`message\` program..." -( - cd $EXAMPLES/message || exit - $LEO run main || exit -) -# Check that the message program ran successfully. -EXITCODE=$? -if [ $EXITCODE -ne 0 ]; then - echo "The \`message\` program failed to run successfully." - exit $EXITCODE -fi +## Build and run the auction Leo program. +#echo "Building and running the \`auction\` program..." +#( +# cd $EXAMPLES/auction || exit +# +# chmod +x $EXAMPLES/auction/run.sh || exit +# export -f leo || exit +# $EXAMPLES/auction/run.sh || exit +#) +## Check that the auction program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`auction\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the basic_bank Leo program. +#echo "Building and running the \`basic_bank\` program..." +#( +# cd $EXAMPLES/basic_bank || exit +# +# chmod +x $EXAMPLES/basic_bank/run.sh || exit +# export -f leo || exit +# $EXAMPLES/basic_bank/run.sh || exit +#) +## Check that the basic_bank program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`basic_bank\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the battleship Leo program. +#echo "Building and running the \`battleship\` program..." +#which leo +#( +# cd $EXAMPLES/battleship || exit +# +# chmod +x $EXAMPLES/battleship/run.sh || exit +# export -f leo || exit +# $EXAMPLES/battleship/run.sh || exit +#) +## Check that the battleship program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`battleship\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the bubblesort Leo program. +#echo "Building and running the \`bubblesort\` program..." +#( +# cd $EXAMPLES/bubblesort || exit +# cat $EXAMPLES/bubblesort/inputs/bubblesort.in | xargs $LEO run bubble_sort || exit +#) +## Check that the bubblesort program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`bubblesort\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the core example Leo program. +#echo "Building and running the \`core\` program..." +#( +# cd $EXAMPLES/core || exit +# cat $EXAMPLES/core/inputs/core.in | xargs $LEO run main || exit +#) +## Check that the core program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`core\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the groups example Leo program. +#echo "Building and running the \`groups\` program..." +#( +# cd $EXAMPLES/groups || exit +# cat $EXAMPLES/groups/inputs/groups.in | xargs $LEO run main || exit +#) +## Check that the groups program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`groups\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the hackers-delight/ntzdebruijn program. +#echo "Building and running the \`hackers-delight/ntzdebruijn\` program..." +#( +# cd $EXAMPLES/hackers-delight/ntzdebruijn || exit +# cat $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in | xargs $LEO run main || exit +#) +## Check that the hackers-delight/ntzdebruijn program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`hackers-delight/ntzdebruijn\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the hackers-delight/ntzgaudet program. +#echo "Building and running the \`hackers-delight/ntzgaudet\` program..." +#( +# cd $EXAMPLES/hackers-delight/ntzgaudet || exit +# cat $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in | xargs $LEO run main || exit +#) +## Check that the hackers-delight/ntzgaudet program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`hackers-delight/ntzgaudet\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the hackers-delight/ntzloops program. +#echo "Building and running the \`hackers-delight/ntzloops\` program..." +#( +# cd $EXAMPLES/hackers-delight/ntzloops || exit +# cat $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in | xargs $LEO run main || exit +#) +## Check that the hackers-delight/ntzloops program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`hackers-delight/ntzloops\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the hackers-delight/ntzmasks program. +#echo "Building and running the \`hackers-delight/ntzmasks\` program..." +#( +# cd $EXAMPLES/hackers-delight/ntzmasks || exit +# cat $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in | xargs $LEO run main || exit +#) +## Check that the hackers-delight/ntzmasks program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`hackers-delight/ntzmasks\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the hackers-delight/ntzreisers program. +#echo "Building and running the \`hackers-delight/ntzreisers\` program..." +#( +# cd $EXAMPLES/hackers-delight/ntzreisers || exit +# cat $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in | xargs $LEO run main || exit +#) +## Check that the hackers-delight/ntzreisers program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`hackers-delight/ntzreisers\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the hackers-delight/ntzseals program. +#echo "Building and running the \`hackers-delight/ntzseals\` program..." +#( +# cd $EXAMPLES/hackers-delight/ntzseals || exit +# cat $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in | xargs $LEO run main || exit +#) +## Check that the hackers-delight/ntzseals program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`hackers-delight/ntzseals\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the hackers-delight/ntzsearchtree program. +#echo "Building and running the \`hackers-delight/ntzsearchtree\` program..." +#( +# cd $EXAMPLES/hackers-delight/ntzsearchtree || exit +# cat $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in | xargs $LEO run main || exit +#) +## Check that the hackers-delight/ntzsearchtree program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`hackers-delight/ntzsearchtree\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the hackers-delight/ntzsmallvals program. +#echo "Building and running the \`hackers-delight/ntzsmallvals\` program..." +#( +# cd $EXAMPLES/hackers-delight/ntzsmallvals || exit +# cat $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in | xargs $LEO run main || exit +#) +## Check that the hackers-delight/ntzsmallvals program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`hackers-delight/ntzsmallvals\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the helloworld Leo program. +#echo "Building and running the \`helloworld\` program..." +#( +# cd $EXAMPLES/helloworld || exit +# cat $EXAMPLES/helloworld/inputs/helloworld.in | xargs $LEO run main || exit +#) +## Check that the helloworld program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`helloworld\` program failed to run successfully." +# exit $EXITCODE +#fi +# +# +## Build and run the interest example Leo programs. +#echo "Building and running the \`interest\` programs..." +#( +# cd $EXAMPLES/interest || exit +# +# # Run the fixed period interest program. +# cat $EXAMPLES/interest/inputs/fixed.in | xargs $LEO run fixed_iteration_interest || exit +# +# # Run the bounded period interest program. +# cat $EXAMPLES/interest/inputs/bounded.in | xargs $LEO run bounded_iteration_interest || exit +#) +## Check that the interest programs ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`interest\` program failed to run successfully." +# exit $EXITCODE +#fi +# +## Build and run the message example Leo program. +#echo "Building and running the \`message\` program..." +#( +# cd $EXAMPLES/message || exit +# cat $EXAMPLES/message/inputs/message.in | xargs $LEO run main || exit +#) +## Check that the message program ran successfully. +#EXITCODE=$? +#if [ $EXITCODE -ne 0 ]; then +# echo "The \`message\` program failed to run successfully." +# exit $EXITCODE +#fi # Build and run the tic tac toe example Leo program. echo "Building and running the \`tictactoe\` program..." ( cd $EXAMPLES/tictactoe || exit $LEO run new || exit - $LEO run make_move || exit + cat $EXAMPLES/tictactoe/inputs/tictactoe.in | xargs $LEO run make_move || exit chmod +x $EXAMPLES/tictactoe/run.sh || exit export -f leo @@ -271,10 +265,10 @@ echo "Building and running the \`simple_token\` programs..." cd $EXAMPLES/simple_token || exit # Run the mint program. - $LEO run mint + cat $EXAMPLES/simple_token/inputs/mint.in | xargs $LEO run mint || exit # Run the transfer program. - $LEO run transfer + cat $EXAMPLES/simple_token/inputs/transfer.in | xargs $LEO run transfer || exit ) # Check that the simple token programs ran successfully. EXITCODE=$? @@ -288,23 +282,9 @@ echo "Building and running the \`token\` program..." ( cd $EXAMPLES/token || exit - # Run the mint_public function. - $LEO run mint_public || exit - - # Run the mint_private function. - $LEO run mint_private || exit - - # Run the transfer_public function. - $LEO run transfer_public || exit - - # Run the transfer_private function. - $LEO run transfer_private || exit - - # Run the transfer_private_to_public function. - $LEO run transfer_private_to_public || exit - - # Run the transfer_public_to_private function. - $LEO run transfer_public_to_private || exit + chmod +x $EXAMPLES/token/run.sh || exit + export -f leo + $EXAMPLES/token/run.sh || exit ) # Check that the token program ran successfully. EXITCODE=$? @@ -317,7 +297,7 @@ fi echo "Building and running the \`twoadicity\` program..." ( cd $EXAMPLES/twoadicity || exit - $LEO run main || exit + cat $EXAMPLES/twoadicity/inputs/twoadicity.in | xargs $LEO run main || exit ) # Check that the two-adicity program ran successfully. EXITCODE=$? @@ -356,4 +336,4 @@ EXITCODE=$? if [ $EXITCODE -ne 0 ]; then echo "The \`lottery\` program failed to run successfully." exit $EXITCODE -fi \ No newline at end of file +fi diff --git a/examples/bubblesort/inputs/bubblesort.in b/examples/bubblesort/inputs/bubblesort.in index e4cf310a79..d0152c0bdd 100644 --- a/examples/bubblesort/inputs/bubblesort.in +++ b/examples/bubblesort/inputs/bubblesort.in @@ -1,3 +1 @@ 13u32 2u32 4u32 3u32 5u32 10u32 7u32 1u32 - - diff --git a/examples/simple_token/inputs/transfer.in b/examples/simple_token/inputs/transfer.in index 20d69398c9..a36dc2af97 100644 --- a/examples/simple_token/inputs/transfer.in +++ b/examples/simple_token/inputs/transfer.in @@ -1,5 +1 @@ -"{ - owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, - amount: 100u64, - _nonce: 0group, -}" aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 50u64 +"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, amount: 100u64.private, _nonce: 0group.public }" aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 50u64 diff --git a/examples/tictactoe/inputs/tictactoe.in b/examples/tictactoe/inputs/tictactoe.in index 1e8ccb36ed..d42512d6b8 100644 --- a/examples/tictactoe/inputs/tictactoe.in +++ b/examples/tictactoe/inputs/tictactoe.in @@ -1,6 +1 @@ -1u8 1u8 1u8 "{ - r1: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, - r2: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, - r3: Row { c1: 0u8, c2: 0u8, c3: 0u8 }, -}" - +1u8 1u8 1u8 "{ r1: { c1: 0u8, c2: 0u8, c3: 0u8 }, r2: { c1: 0u8, c2: 0u8, c3: 0u8 }, r3: { c1: 0u8, c2: 0u8, c3: 0u8 } }" diff --git a/examples/token/.env b/examples/token/.env index 2c5429aaed..e86f465a56 100644 --- a/examples/token/.env +++ b/examples/token/.env @@ -1,2 +1,4 @@ + NETWORK=testnet3 -PRIVATE_KEY=APrivateKey1zkpGZsYM8WQJMDDrzeAhB2SB3N9WcGt9Ks6NLBKCWyiMKv8 +PRIVATE_KEY=APrivateKey1zkp1w8PTxrRgGfAtfKUSq43iQyVbdQHfhGbiNPEg2LVSEXR + diff --git a/examples/vote/inputs/argree.in b/examples/vote/inputs/argree.in index 2b345cce76..487d82267c 100644 --- a/examples/vote/inputs/argree.in +++ b/examples/vote/inputs/argree.in @@ -1,5 +1 @@ -"{ - owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau, - pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field, - _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group -}" +"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public }" diff --git a/examples/vote/inputs/disagree.in b/examples/vote/inputs/disagree.in new file mode 100644 index 0000000000..487d82267c --- /dev/null +++ b/examples/vote/inputs/disagree.in @@ -0,0 +1 @@ +"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public }" diff --git a/examples/vote/inputs/propose.in b/examples/vote/inputs/propose.in index d2eedd15a9..b179c062b0 100644 --- a/examples/vote/inputs/propose.in +++ b/examples/vote/inputs/propose.in @@ -1,5 +1 @@ -"{ - title: 2077160157502449938194577302446444field, - content: 1452374294790018907888397545906607852827800436field, - proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2, -}" +"{ title: 2077160157502449938194577302446444field.private, content: 1452374294790018907888397545906607852827800436field.private, proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2.private }" diff --git a/examples/vote/run.sh b/examples/vote/run.sh index 2b8bec9398..3e6c9eb923 100755 --- a/examples/vote/run.sh +++ b/examples/vote/run.sh @@ -21,7 +21,7 @@ echo " " # Run the `propose` program function ( - leo run propose || exit + cat ./inputs/propose.in | xargs leo run propose || exit ) echo " @@ -39,7 +39,7 @@ echo " " # Run the `new_ticket` program function ( - leo run new_ticket || exit + cat ./inputs/new_ticket.in | xargs leo run new_ticket || exit ) echo " @@ -57,6 +57,6 @@ echo " " # Run the `agree` or `disagree` program function ( - leo run agree || exit - # leo run disagree || exit + cat ./inputs/agree.in | xargs leo run agree || exit + #cat ./inputs/disagree.in | xargs leo run disagree || exit ) From 829a1e801e12afa6a67cc9a34aa489a595ed9096 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 12:59:41 -0400 Subject: [PATCH 12/23] Clean up tests --- examples/vote/inputs/{argree.in => agree.in} | 0 tests/test-framework/src/unused/repeated.leo | 1 - tests/test-framework/src/unused/return.leo | 1 - tests/test-framework/src/unused/string/neq.leo | 16 ---------------- tests/test-framework/src/unused/string/out.leo | 16 ---------------- .../test-framework/src/unused/string/string.leo | 4 +--- tests/tests/compiler/records/declaration.leo | 1 - .../statements/operations/add_assign.leo | 1 - .../statements/operations/and_assign.leo | 1 - .../statements/operations/bitand_assign.leo | 1 - .../statements/operations/bitor_assign.leo | 1 - .../statements/operations/bitxor_assign.leo | 1 - .../statements/operations/div_assign.leo | 1 - .../statements/operations/mul_assign.leo | 1 - .../compiler/statements/operations/or_assign.leo | 1 - .../statements/operations/pow_assign.leo | 1 - .../statements/operations/rem_assign.leo | 1 - .../statements/operations/shl_assign.leo | 1 - .../statements/operations/shr_assign.leo | 1 - .../statements/operations/sub_assign.leo | 1 - tests/tests/parser/statement/all_loops.leo | 3 +-- tests/tests/parser/statement/cond_mut.leo | 1 - tests/tests/parser/statement/for_loop.leo | 1 - .../parser/statement/function_input_mut.leo | 1 - tests/tests/parser/statement/import_circuit.leo | 4 +--- .../parser/statement/iteration_repeated.leo | 1 - .../parser/statement/iteration_variable.leo | 1 - tests/tests/parser/statement/let_mut_nested.leo | 1 - 28 files changed, 3 insertions(+), 62 deletions(-) rename examples/vote/inputs/{argree.in => agree.in} (100%) diff --git a/examples/vote/inputs/argree.in b/examples/vote/inputs/agree.in similarity index 100% rename from examples/vote/inputs/argree.in rename to examples/vote/inputs/agree.in diff --git a/tests/test-framework/src/unused/repeated.leo b/tests/test-framework/src/unused/repeated.leo index 5e2c751b69..f82ceb200a 100644 --- a/tests/test-framework/src/unused/repeated.leo +++ b/tests/test-framework/src/unused/repeated.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/dummy.in */ function one(x: bool) -> bool { diff --git a/tests/test-framework/src/unused/return.leo b/tests/test-framework/src/unused/return.leo index 69233233e8..635a81de00 100644 --- a/tests/test-framework/src/unused/return.leo +++ b/tests/test-framework/src/unused/return.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/dummy.in */ function one() -> u32 { diff --git a/tests/test-framework/src/unused/string/neq.leo b/tests/test-framework/src/unused/string/neq.leo index 01fbb00773..0fc1fe66d7 100644 --- a/tests/test-framework/src/unused/string/neq.leo +++ b/tests/test-framework/src/unused/string/neq.leo @@ -1,22 +1,6 @@ /* namespace: Compile expectation: Fail -input_file: - - inputs/ascii.in - - inputs/escaped_unicode1.in - - inputs/escaped_unicode2.in - - inputs/escaped_unicode3.in - - inputs/escaped_unicode4.in - - inputs/escaped_unicode5.in - - inputs/escaped_unicode6.in - - inputs/escaped.in - - inputs/hex1.in - - inputs/hex2.in - - inputs/unicode1.in - - inputs/unicode2.in - - inputs/unicode3.in - - inputs/unicode4.in - - inputs/unicode5.in */ function main(character: char) -> char { diff --git a/tests/test-framework/src/unused/string/out.leo b/tests/test-framework/src/unused/string/out.leo index 7ff7d60124..53bf1e2f7e 100644 --- a/tests/test-framework/src/unused/string/out.leo +++ b/tests/test-framework/src/unused/string/out.leo @@ -1,22 +1,6 @@ /* namespace: Compile expectation: Fail -input_file: - - inputs/ascii.in - - inputs/escaped_unicode1.in - - inputs/escaped_unicode2.in - - inputs/escaped_unicode3.in - - inputs/escaped_unicode4.in - - inputs/escaped_unicode5.in - - inputs/escaped_unicode6.in - - inputs/escaped.in - - inputs/hex1.in - - inputs/hex2.in - - inputs/unicode1.in - - inputs/unicode2.in - - inputs/unicode3.in - - inputs/unicode4.in - - inputs/unicode5.in */ function main(character: char) -> char { console.log("{}", character); diff --git a/tests/test-framework/src/unused/string/string.leo b/tests/test-framework/src/unused/string/string.leo index b7997680e2..1488256345 100644 --- a/tests/test-framework/src/unused/string/string.leo +++ b/tests/test-framework/src/unused/string/string.leo @@ -1,11 +1,9 @@ /* namespace: Compile expectation: Pass -input_file: - - inputs/string.in */ function main(hello: string) -> string { let world: string = "world"; return world; -} \ No newline at end of file +} diff --git a/tests/tests/compiler/records/declaration.leo b/tests/tests/compiler/records/declaration.leo index d9563653ce..70979a9304 100644 --- a/tests/tests/compiler/records/declaration.leo +++ b/tests/tests/compiler/records/declaration.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: inputs/add.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/add_assign.leo b/tests/tests/compiler/statements/operations/add_assign.leo index 85d73019a5..d644d9525c 100644 --- a/tests/tests/compiler/statements/operations/add_assign.leo +++ b/tests/tests/compiler/statements/operations/add_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/u8.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/and_assign.leo b/tests/tests/compiler/statements/operations/and_assign.leo index 58e0b22800..2d4bebdc45 100644 --- a/tests/tests/compiler/statements/operations/and_assign.leo +++ b/tests/tests/compiler/statements/operations/and_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/dummy.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/bitand_assign.leo b/tests/tests/compiler/statements/operations/bitand_assign.leo index ce69b28413..44d7b48cad 100644 --- a/tests/tests/compiler/statements/operations/bitand_assign.leo +++ b/tests/tests/compiler/statements/operations/bitand_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/u8.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/bitor_assign.leo b/tests/tests/compiler/statements/operations/bitor_assign.leo index 102adcd0d4..6b3b62d637 100644 --- a/tests/tests/compiler/statements/operations/bitor_assign.leo +++ b/tests/tests/compiler/statements/operations/bitor_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/u8.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/bitxor_assign.leo b/tests/tests/compiler/statements/operations/bitxor_assign.leo index d303e9b658..6ffb6e0d0d 100644 --- a/tests/tests/compiler/statements/operations/bitxor_assign.leo +++ b/tests/tests/compiler/statements/operations/bitxor_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/u8.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/div_assign.leo b/tests/tests/compiler/statements/operations/div_assign.leo index 79be92cf43..2e9d3caac0 100644 --- a/tests/tests/compiler/statements/operations/div_assign.leo +++ b/tests/tests/compiler/statements/operations/div_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/u8.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/mul_assign.leo b/tests/tests/compiler/statements/operations/mul_assign.leo index 079c8006d5..029b5abfd6 100644 --- a/tests/tests/compiler/statements/operations/mul_assign.leo +++ b/tests/tests/compiler/statements/operations/mul_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/u8.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/or_assign.leo b/tests/tests/compiler/statements/operations/or_assign.leo index a67a665634..05d7452ba1 100644 --- a/tests/tests/compiler/statements/operations/or_assign.leo +++ b/tests/tests/compiler/statements/operations/or_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/dummy.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/pow_assign.leo b/tests/tests/compiler/statements/operations/pow_assign.leo index 35b039cb81..b10a925be1 100644 --- a/tests/tests/compiler/statements/operations/pow_assign.leo +++ b/tests/tests/compiler/statements/operations/pow_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/shift_and_pow.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/rem_assign.leo b/tests/tests/compiler/statements/operations/rem_assign.leo index d0036289e0..3840f7aa1a 100644 --- a/tests/tests/compiler/statements/operations/rem_assign.leo +++ b/tests/tests/compiler/statements/operations/rem_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/u8.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/shl_assign.leo b/tests/tests/compiler/statements/operations/shl_assign.leo index f9f567874f..842812737f 100644 --- a/tests/tests/compiler/statements/operations/shl_assign.leo +++ b/tests/tests/compiler/statements/operations/shl_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/shift_and_pow.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/shr_assign.leo b/tests/tests/compiler/statements/operations/shr_assign.leo index e95f0c006d..40697bdea5 100644 --- a/tests/tests/compiler/statements/operations/shr_assign.leo +++ b/tests/tests/compiler/statements/operations/shr_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/shift_and_pow.in */ program test.aleo { diff --git a/tests/tests/compiler/statements/operations/sub_assign.leo b/tests/tests/compiler/statements/operations/sub_assign.leo index 33302b6e83..049568e0a4 100644 --- a/tests/tests/compiler/statements/operations/sub_assign.leo +++ b/tests/tests/compiler/statements/operations/sub_assign.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_files: ../inputs/u8.in */ program test.aleo { diff --git a/tests/tests/parser/statement/all_loops.leo b/tests/tests/parser/statement/all_loops.leo index d11de29a0e..81a62003ab 100644 --- a/tests/tests/parser/statement/all_loops.leo +++ b/tests/tests/parser/statement/all_loops.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/dummy.in */ function main(k: bool) -> bool { @@ -16,4 +15,4 @@ function main(k: bool) -> bool { } return (reverse == forward) && k; -} \ No newline at end of file +} diff --git a/tests/tests/parser/statement/cond_mut.leo b/tests/tests/parser/statement/cond_mut.leo index cf488c8304..9d73e942cd 100644 --- a/tests/tests/parser/statement/cond_mut.leo +++ b/tests/tests/parser/statement/cond_mut.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/dummy.in */ function main(y: bool) -> bool { diff --git a/tests/tests/parser/statement/for_loop.leo b/tests/tests/parser/statement/for_loop.leo index 245f4eb7a2..22e420674b 100644 --- a/tests/tests/parser/statement/for_loop.leo +++ b/tests/tests/parser/statement/for_loop.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/u32_3.in */ function main(x: u32) -> bool { diff --git a/tests/tests/parser/statement/function_input_mut.leo b/tests/tests/parser/statement/function_input_mut.leo index 8ab536faf9..7b0c81ac83 100644 --- a/tests/tests/parser/statement/function_input_mut.leo +++ b/tests/tests/parser/statement/function_input_mut.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/dummy.in */ // Function input are mutable by default. diff --git a/tests/tests/parser/statement/import_circuit.leo b/tests/tests/parser/statement/import_circuit.leo index d126dbfd1e..70e6524e9d 100644 --- a/tests/tests/parser/statement/import_circuit.leo +++ b/tests/tests/parser/statement/import_circuit.leo @@ -1,11 +1,9 @@ /* namespace: Compile expectation: Pass -input_file: inputs/u32_3.in -cwd: statement */ import foo.leo; function main(a: u32) -> Foo { return Foo { a: a }; -} \ No newline at end of file +} diff --git a/tests/tests/parser/statement/iteration_repeated.leo b/tests/tests/parser/statement/iteration_repeated.leo index 434f8bbd1b..864673de06 100644 --- a/tests/tests/parser/statement/iteration_repeated.leo +++ b/tests/tests/parser/statement/iteration_repeated.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/dummy.in */ function iteration() -> u32 { diff --git a/tests/tests/parser/statement/iteration_variable.leo b/tests/tests/parser/statement/iteration_variable.leo index c7d1ec9f9a..4c426782aa 100644 --- a/tests/tests/parser/statement/iteration_variable.leo +++ b/tests/tests/parser/statement/iteration_variable.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/u32_3.in */ function main(x: u32) -> bool { diff --git a/tests/tests/parser/statement/let_mut_nested.leo b/tests/tests/parser/statement/let_mut_nested.leo index 0def80befb..97e24534d6 100644 --- a/tests/tests/parser/statement/let_mut_nested.leo +++ b/tests/tests/parser/statement/let_mut_nested.leo @@ -1,7 +1,6 @@ /* namespace: Compile expectation: Pass -input_file: inputs/dummy.in */ function main(a: bool) -> bool { From 5fea268d04803efe46ae6813ef9baad7bfe04249 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 13:00:07 -0400 Subject: [PATCH 13/23] Update examples and CI --- .circleci/leo-clean.sh | 2 +- .circleci/leo-example.sh | 30 +- .circleci/leo-new.sh | 2 +- .circleci/test-examples.sh | 472 +++++++++--------- Cargo.toml | 3 - README.md | 2 +- examples/bubblesort/README.md | 4 +- examples/core/README.md | 4 +- examples/fibonacci/README.md | 6 +- examples/groups/README.md | 4 +- .../hackers-delight/ntzdebruijn/README.md | 2 +- examples/hackers-delight/ntzgaudet/README.md | 2 +- examples/hackers-delight/ntzloops/README.md | 2 +- examples/hackers-delight/ntzmasks/README.md | 2 +- examples/hackers-delight/ntzreisers/README.md | 2 +- examples/hackers-delight/ntzseals/README.md | 2 +- .../hackers-delight/ntzsearchtree/README.md | 2 +- .../hackers-delight/ntzsmallvals/README.md | 2 +- examples/helloworld/README.md | 4 +- examples/interest/README.md | 6 +- examples/lottery/README.md | 4 +- examples/message/README.md | 4 +- examples/simple_token/README.md | 8 +- examples/twoadicity/README.md | 4 +- examples/vote/README.md | 8 +- examples/vote/inputs/propose.in | 2 +- 26 files changed, 288 insertions(+), 297 deletions(-) diff --git a/.circleci/leo-clean.sh b/.circleci/leo-clean.sh index 895bcfb5bf..b66929a172 100755 --- a/.circleci/leo-clean.sh +++ b/.circleci/leo-clean.sh @@ -4,7 +4,7 @@ ls -la cd foo && ls -la # Run `leo run`. -$LEO run || exit +$LEO run main 0u32 1u32 || exit # Assert that the 'build' folder exists. if [ "$(ls -A build)" ]; then diff --git a/.circleci/leo-example.sh b/.circleci/leo-example.sh index d757fb4324..2e794f8121 100755 --- a/.circleci/leo-example.sh +++ b/.circleci/leo-example.sh @@ -4,11 +4,10 @@ ls -la cd lottery && ls -la - # Run the play function. - $LEO run play || exit - - # Execute the play function. - $LEO execute play || exit + # Run the script. + chmod +x ./run.sh || exit + export -f leo + ./run.sh || exit ) ( @@ -17,14 +16,10 @@ ls -la cd tictactoe && ls -la - # Create a new game. - $LEO run new || exit - - # Run the make_move function. - $LEO run make_move || exit - - # Execute the make_move function. - $LEO execute make_move || exit + # Run the script. + chmod +x ./run.sh || exit + export -f leo + ./run.sh || exit ) ( @@ -33,9 +28,8 @@ ls -la cd token && ls -la - # Run the mint_public function. - $LEO run mint_public || exit - - # Execute the mint_public function. - $LEO execute mint_public || exit + # Run the script. + chmod +x ./run.sh || exit + export -f leo + ./run.sh || exit ) diff --git a/.circleci/leo-new.sh b/.circleci/leo-new.sh index d152c8a3ce..8ce8de6de8 100755 --- a/.circleci/leo-new.sh +++ b/.circleci/leo-new.sh @@ -20,7 +20,7 @@ do done # Try to run `leo run`. -$LEO run || exit +$LEO run main 0u32 1u32 || exit # Remove the dummy program. cd .. && rm -rf dummy diff --git a/.circleci/test-examples.sh b/.circleci/test-examples.sh index bb4f0efcb5..1d32e49398 100755 --- a/.circleci/test-examples.sh +++ b/.circleci/test-examples.sh @@ -4,242 +4,242 @@ leo() { $LEO "$@" } -## Build and run the auction Leo program. -#echo "Building and running the \`auction\` program..." -#( -# cd $EXAMPLES/auction || exit -# -# chmod +x $EXAMPLES/auction/run.sh || exit -# export -f leo || exit -# $EXAMPLES/auction/run.sh || exit -#) -## Check that the auction program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`auction\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the basic_bank Leo program. -#echo "Building and running the \`basic_bank\` program..." -#( -# cd $EXAMPLES/basic_bank || exit -# -# chmod +x $EXAMPLES/basic_bank/run.sh || exit -# export -f leo || exit -# $EXAMPLES/basic_bank/run.sh || exit -#) -## Check that the basic_bank program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`basic_bank\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the battleship Leo program. -#echo "Building and running the \`battleship\` program..." -#which leo -#( -# cd $EXAMPLES/battleship || exit -# -# chmod +x $EXAMPLES/battleship/run.sh || exit -# export -f leo || exit -# $EXAMPLES/battleship/run.sh || exit -#) -## Check that the battleship program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`battleship\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the bubblesort Leo program. -#echo "Building and running the \`bubblesort\` program..." -#( -# cd $EXAMPLES/bubblesort || exit -# cat $EXAMPLES/bubblesort/inputs/bubblesort.in | xargs $LEO run bubble_sort || exit -#) -## Check that the bubblesort program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`bubblesort\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the core example Leo program. -#echo "Building and running the \`core\` program..." -#( -# cd $EXAMPLES/core || exit -# cat $EXAMPLES/core/inputs/core.in | xargs $LEO run main || exit -#) -## Check that the core program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`core\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the groups example Leo program. -#echo "Building and running the \`groups\` program..." -#( -# cd $EXAMPLES/groups || exit -# cat $EXAMPLES/groups/inputs/groups.in | xargs $LEO run main || exit -#) -## Check that the groups program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`groups\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the hackers-delight/ntzdebruijn program. -#echo "Building and running the \`hackers-delight/ntzdebruijn\` program..." -#( -# cd $EXAMPLES/hackers-delight/ntzdebruijn || exit -# cat $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in | xargs $LEO run main || exit -#) -## Check that the hackers-delight/ntzdebruijn program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`hackers-delight/ntzdebruijn\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the hackers-delight/ntzgaudet program. -#echo "Building and running the \`hackers-delight/ntzgaudet\` program..." -#( -# cd $EXAMPLES/hackers-delight/ntzgaudet || exit -# cat $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in | xargs $LEO run main || exit -#) -## Check that the hackers-delight/ntzgaudet program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`hackers-delight/ntzgaudet\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the hackers-delight/ntzloops program. -#echo "Building and running the \`hackers-delight/ntzloops\` program..." -#( -# cd $EXAMPLES/hackers-delight/ntzloops || exit -# cat $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in | xargs $LEO run main || exit -#) -## Check that the hackers-delight/ntzloops program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`hackers-delight/ntzloops\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the hackers-delight/ntzmasks program. -#echo "Building and running the \`hackers-delight/ntzmasks\` program..." -#( -# cd $EXAMPLES/hackers-delight/ntzmasks || exit -# cat $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in | xargs $LEO run main || exit -#) -## Check that the hackers-delight/ntzmasks program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`hackers-delight/ntzmasks\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the hackers-delight/ntzreisers program. -#echo "Building and running the \`hackers-delight/ntzreisers\` program..." -#( -# cd $EXAMPLES/hackers-delight/ntzreisers || exit -# cat $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in | xargs $LEO run main || exit -#) -## Check that the hackers-delight/ntzreisers program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`hackers-delight/ntzreisers\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the hackers-delight/ntzseals program. -#echo "Building and running the \`hackers-delight/ntzseals\` program..." -#( -# cd $EXAMPLES/hackers-delight/ntzseals || exit -# cat $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in | xargs $LEO run main || exit -#) -## Check that the hackers-delight/ntzseals program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`hackers-delight/ntzseals\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the hackers-delight/ntzsearchtree program. -#echo "Building and running the \`hackers-delight/ntzsearchtree\` program..." -#( -# cd $EXAMPLES/hackers-delight/ntzsearchtree || exit -# cat $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in | xargs $LEO run main || exit -#) -## Check that the hackers-delight/ntzsearchtree program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`hackers-delight/ntzsearchtree\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the hackers-delight/ntzsmallvals program. -#echo "Building and running the \`hackers-delight/ntzsmallvals\` program..." -#( -# cd $EXAMPLES/hackers-delight/ntzsmallvals || exit -# cat $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in | xargs $LEO run main || exit -#) -## Check that the hackers-delight/ntzsmallvals program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`hackers-delight/ntzsmallvals\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the helloworld Leo program. -#echo "Building and running the \`helloworld\` program..." -#( -# cd $EXAMPLES/helloworld || exit -# cat $EXAMPLES/helloworld/inputs/helloworld.in | xargs $LEO run main || exit -#) -## Check that the helloworld program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`helloworld\` program failed to run successfully." -# exit $EXITCODE -#fi -# -# -## Build and run the interest example Leo programs. -#echo "Building and running the \`interest\` programs..." -#( -# cd $EXAMPLES/interest || exit -# -# # Run the fixed period interest program. -# cat $EXAMPLES/interest/inputs/fixed.in | xargs $LEO run fixed_iteration_interest || exit -# -# # Run the bounded period interest program. -# cat $EXAMPLES/interest/inputs/bounded.in | xargs $LEO run bounded_iteration_interest || exit -#) -## Check that the interest programs ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`interest\` program failed to run successfully." -# exit $EXITCODE -#fi -# -## Build and run the message example Leo program. -#echo "Building and running the \`message\` program..." -#( -# cd $EXAMPLES/message || exit -# cat $EXAMPLES/message/inputs/message.in | xargs $LEO run main || exit -#) -## Check that the message program ran successfully. -#EXITCODE=$? -#if [ $EXITCODE -ne 0 ]; then -# echo "The \`message\` program failed to run successfully." -# exit $EXITCODE -#fi +# Build and run the auction Leo program. +echo "Building and running the \`auction\` program..." +( + cd $EXAMPLES/auction || exit + + chmod +x $EXAMPLES/auction/run.sh || exit + export -f leo || exit + $EXAMPLES/auction/run.sh || exit +) +# Check that the auction program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`auction\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the basic_bank Leo program. +echo "Building and running the \`basic_bank\` program..." +( + cd $EXAMPLES/basic_bank || exit + + chmod +x $EXAMPLES/basic_bank/run.sh || exit + export -f leo || exit + $EXAMPLES/basic_bank/run.sh || exit +) +# Check that the basic_bank program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`basic_bank\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the battleship Leo program. +echo "Building and running the \`battleship\` program..." +which leo +( + cd $EXAMPLES/battleship || exit + + chmod +x $EXAMPLES/battleship/run.sh || exit + export -f leo || exit + $EXAMPLES/battleship/run.sh || exit +) +# Check that the battleship program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`battleship\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the bubblesort Leo program. +echo "Building and running the \`bubblesort\` program..." +( + cd $EXAMPLES/bubblesort || exit + cat $EXAMPLES/bubblesort/inputs/bubblesort.in | xargs $LEO run bubble_sort || exit +) +# Check that the bubblesort program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`bubblesort\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the core example Leo program. +echo "Building and running the \`core\` program..." +( + cd $EXAMPLES/core || exit + cat $EXAMPLES/core/inputs/core.in | xargs $LEO run main || exit +) +# Check that the core program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`core\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the groups example Leo program. +echo "Building and running the \`groups\` program..." +( + cd $EXAMPLES/groups || exit + cat $EXAMPLES/groups/inputs/groups.in | xargs $LEO run main || exit +) +# Check that the groups program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`groups\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the hackers-delight/ntzdebruijn program. +echo "Building and running the \`hackers-delight/ntzdebruijn\` program..." +( + cd $EXAMPLES/hackers-delight/ntzdebruijn || exit + cat $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in | xargs $LEO run main || exit +) +# Check that the hackers-delight/ntzdebruijn program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`hackers-delight/ntzdebruijn\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the hackers-delight/ntzgaudet program. +echo "Building and running the \`hackers-delight/ntzgaudet\` program..." +( + cd $EXAMPLES/hackers-delight/ntzgaudet || exit + cat $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in | xargs $LEO run main || exit +) +# Check that the hackers-delight/ntzgaudet program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`hackers-delight/ntzgaudet\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the hackers-delight/ntzloops program. +echo "Building and running the \`hackers-delight/ntzloops\` program..." +( + cd $EXAMPLES/hackers-delight/ntzloops || exit + cat $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in | xargs $LEO run main || exit +) +# Check that the hackers-delight/ntzloops program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`hackers-delight/ntzloops\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the hackers-delight/ntzmasks program. +echo "Building and running the \`hackers-delight/ntzmasks\` program..." +( + cd $EXAMPLES/hackers-delight/ntzmasks || exit + cat $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in | xargs $LEO run main || exit +) +# Check that the hackers-delight/ntzmasks program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`hackers-delight/ntzmasks\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the hackers-delight/ntzreisers program. +echo "Building and running the \`hackers-delight/ntzreisers\` program..." +( + cd $EXAMPLES/hackers-delight/ntzreisers || exit + cat $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in | xargs $LEO run main || exit +) +# Check that the hackers-delight/ntzreisers program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`hackers-delight/ntzreisers\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the hackers-delight/ntzseals program. +echo "Building and running the \`hackers-delight/ntzseals\` program..." +( + cd $EXAMPLES/hackers-delight/ntzseals || exit + cat $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in | xargs $LEO run main || exit +) +# Check that the hackers-delight/ntzseals program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`hackers-delight/ntzseals\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the hackers-delight/ntzsearchtree program. +echo "Building and running the \`hackers-delight/ntzsearchtree\` program..." +( + cd $EXAMPLES/hackers-delight/ntzsearchtree || exit + cat $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in | xargs $LEO run main || exit +) +# Check that the hackers-delight/ntzsearchtree program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`hackers-delight/ntzsearchtree\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the hackers-delight/ntzsmallvals program. +echo "Building and running the \`hackers-delight/ntzsmallvals\` program..." +( + cd $EXAMPLES/hackers-delight/ntzsmallvals || exit + cat $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in | xargs $LEO run main || exit +) +# Check that the hackers-delight/ntzsmallvals program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`hackers-delight/ntzsmallvals\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the helloworld Leo program. +echo "Building and running the \`helloworld\` program..." +( + cd $EXAMPLES/helloworld || exit + cat $EXAMPLES/helloworld/inputs/helloworld.in | xargs $LEO run main || exit +) +# Check that the helloworld program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`helloworld\` program failed to run successfully." + exit $EXITCODE +fi + + +# Build and run the interest example Leo programs. +echo "Building and running the \`interest\` programs..." +( + cd $EXAMPLES/interest || exit + + # Run the fixed period interest program. + cat $EXAMPLES/interest/inputs/fixed.in | xargs $LEO run fixed_iteration_interest || exit + + # Run the bounded period interest program. + cat $EXAMPLES/interest/inputs/bounded.in | xargs $LEO run bounded_iteration_interest || exit +) +# Check that the interest programs ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`interest\` program failed to run successfully." + exit $EXITCODE +fi + +# Build and run the message example Leo program. +echo "Building and running the \`message\` program..." +( + cd $EXAMPLES/message || exit + cat $EXAMPLES/message/inputs/message.in | xargs $LEO run main || exit +) +# Check that the message program ran successfully. +EXITCODE=$? +if [ $EXITCODE -ne 0 ]; then + echo "The \`message\` program failed to run successfully." + exit $EXITCODE +fi # Build and run the tic tac toe example Leo program. echo "Building and running the \`tictactoe\` program..." diff --git a/Cargo.toml b/Cargo.toml index 99066dbd0b..1f721a5f91 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,13 +18,10 @@ include = [ "leo", "README.md", "LICENSE.md", - "examples/lottery/inputs/lottery.in", "examples/lottery/src/main.leo", "examples/lottery/run.sh", - "examples/tictactoe/inputs/tictactoe.in", "examples/tictactoe/src/main.leo", "examples/tictactoe/run.sh", - "examples/token/inputs/token.in", "examples/token/src/main.leo", "examples/token/run.sh" ] diff --git a/README.md b/README.md index 2ec2de8874..68b393f90c 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ leo new helloworld cd helloworld # build & setup & prove & verify -leo run +leo run main 0u32 1u32 ``` The `leo new` command creates a new Leo project with a given name. diff --git a/examples/bubblesort/README.md b/examples/bubblesort/README.md index 054a9a6739..9fcbfbdde3 100644 --- a/examples/bubblesort/README.md +++ b/examples/bubblesort/README.md @@ -4,14 +4,14 @@ To run this program, run: ```bash -leo run bubble_sort +leo run bubble_sort ``` ## Execute Guide To execute this program, run: ```bash -leo execute bubble_sort +leo execute bubble_sort ``` ## Overview diff --git a/examples/core/README.md b/examples/core/README.md index 22e1205f89..4053adb7d6 100644 --- a/examples/core/README.md +++ b/examples/core/README.md @@ -4,12 +4,12 @@ To run this program, run: ```bash -leo run main +leo run main ``` ## Execute Guide To execute this program, run: ```bash -leo execute main +leo execute main ``` diff --git a/examples/fibonacci/README.md b/examples/fibonacci/README.md index 5c1a368bdb..04e07a7320 100644 --- a/examples/fibonacci/README.md +++ b/examples/fibonacci/README.md @@ -4,17 +4,17 @@ To run this program, run: ```bash -leo run fibonacci +leo run fibonacci ``` ## Execute Guide To execute this program, run: ```bash -leo execute fibonacci +leo execute fibonacci ``` ## Overview This example shows how to calculate Fibonacci number using the [fast-doubling method](https://math.stackexchange.com/questions/1124590/need-help-understanding-fibonacci-fast-doubling-proof). -It takes the input data from `inputs/fibonacci.in` \ No newline at end of file +It takes the input data from `inputs/fibonacci.in` diff --git a/examples/groups/README.md b/examples/groups/README.md index cce23e64c0..814d675dab 100644 --- a/examples/groups/README.md +++ b/examples/groups/README.md @@ -4,14 +4,14 @@ To run this program, run: ```bash -leo run main +leo run main ``` ## Execute Guide To execute this program, run: ```bash -leo execute main +leo execute main ``` ## Overview diff --git a/examples/hackers-delight/ntzdebruijn/README.md b/examples/hackers-delight/ntzdebruijn/README.md index b1daf58225..b147b3bf3b 100644 --- a/examples/hackers-delight/ntzdebruijn/README.md +++ b/examples/hackers-delight/ntzdebruijn/README.md @@ -4,7 +4,7 @@ To compile and run this Leo program, run: ```bash -leo run +leo run ``` ## The Algorithm diff --git a/examples/hackers-delight/ntzgaudet/README.md b/examples/hackers-delight/ntzgaudet/README.md index 8bca776405..2410fe0cb3 100644 --- a/examples/hackers-delight/ntzgaudet/README.md +++ b/examples/hackers-delight/ntzgaudet/README.md @@ -4,7 +4,7 @@ To compile and run this Leo program, run: ```bash -leo run +leo run ``` ## The Algorithm diff --git a/examples/hackers-delight/ntzloops/README.md b/examples/hackers-delight/ntzloops/README.md index 49d6b05727..dace1ddf94 100644 --- a/examples/hackers-delight/ntzloops/README.md +++ b/examples/hackers-delight/ntzloops/README.md @@ -4,7 +4,7 @@ To compile and run this Leo program, run: ```bash -leo run +leo run ``` ## The Algorithm diff --git a/examples/hackers-delight/ntzmasks/README.md b/examples/hackers-delight/ntzmasks/README.md index c3b0b7fe16..2987cda3ea 100644 --- a/examples/hackers-delight/ntzmasks/README.md +++ b/examples/hackers-delight/ntzmasks/README.md @@ -4,7 +4,7 @@ To compile and run this Leo program, run: ```bash -leo run +leo run ``` ## The Algorithm diff --git a/examples/hackers-delight/ntzreisers/README.md b/examples/hackers-delight/ntzreisers/README.md index ba8fa11530..54af2b5d5d 100644 --- a/examples/hackers-delight/ntzreisers/README.md +++ b/examples/hackers-delight/ntzreisers/README.md @@ -4,7 +4,7 @@ To compile and run this Leo program, run: ```bash -leo run +leo run ``` ## The Algorithm diff --git a/examples/hackers-delight/ntzseals/README.md b/examples/hackers-delight/ntzseals/README.md index 47322931db..c5bd65c1a2 100644 --- a/examples/hackers-delight/ntzseals/README.md +++ b/examples/hackers-delight/ntzseals/README.md @@ -4,7 +4,7 @@ To compile and run this Leo program, run: ```bash -leo run +leo run ``` ## The Algorithm diff --git a/examples/hackers-delight/ntzsearchtree/README.md b/examples/hackers-delight/ntzsearchtree/README.md index ff7fc9cb8e..147cbd23b1 100644 --- a/examples/hackers-delight/ntzsearchtree/README.md +++ b/examples/hackers-delight/ntzsearchtree/README.md @@ -4,7 +4,7 @@ To compile and run this Leo program, run: ```bash -leo run +leo run ``` ## The Algorithm diff --git a/examples/hackers-delight/ntzsmallvals/README.md b/examples/hackers-delight/ntzsmallvals/README.md index 4e111d26f0..1b99a7f4ff 100644 --- a/examples/hackers-delight/ntzsmallvals/README.md +++ b/examples/hackers-delight/ntzsmallvals/README.md @@ -4,7 +4,7 @@ To compile and run this Leo program, run: ```bash -leo run +leo run ``` ## The Algorithm diff --git a/examples/helloworld/README.md b/examples/helloworld/README.md index df05077cb9..75fa0f1793 100644 --- a/examples/helloworld/README.md +++ b/examples/helloworld/README.md @@ -4,7 +4,7 @@ To run this program, run: ```bash -leo run main +leo run ``` ## Execute Guide @@ -18,4 +18,4 @@ leo execute main This example shows how to sum two u32 numbers. -It takes the input data from inputs/helloworld.in \ No newline at end of file +It takes the input data from inputs/helloworld.in diff --git a/examples/interest/README.md b/examples/interest/README.md index eff9b9e799..06ef484d11 100644 --- a/examples/interest/README.md +++ b/examples/interest/README.md @@ -6,7 +6,7 @@ This program provides utilities for calculating interest over a fixed or bounded To run this program, run: ```bash -leo run +leo run ``` where `` is one of the following: * `fixed_iteration_interest` @@ -18,10 +18,10 @@ Be sure to update `inputs/interest.in` with the desired inputs. To execute this program, run: ```bash -leo execute +leo execute ``` where `` is one of the following: * `fixed_iteration_interest` * `bounded_iteration_interest` -Be sure to update `inputs/interest.in` with the desired inputs. \ No newline at end of file +Be sure to update `inputs/interest.in` with the desired inputs. diff --git a/examples/lottery/README.md b/examples/lottery/README.md index 7972a8e90d..87512a4a2a 100644 --- a/examples/lottery/README.md +++ b/examples/lottery/README.md @@ -4,7 +4,7 @@ To run this program, run: ```bash -leo run play +leo run play or @@ -15,5 +15,5 @@ or To execute this program, run: ```bash -leo execute play +leo execute play ``` diff --git a/examples/message/README.md b/examples/message/README.md index 91c4fb8fdf..c2476a63b2 100644 --- a/examples/message/README.md +++ b/examples/message/README.md @@ -5,12 +5,12 @@ A basic example showing how to declare a struct in the Leo language. To run this program, run: ```bash -leo run main +leo run main ``` ## Execute Guide To execute this program, run: ```bash -leo execute main +leo execute main ``` diff --git a/examples/simple_token/README.md b/examples/simple_token/README.md index ce2587f6a2..46c3a2da0d 100644 --- a/examples/simple_token/README.md +++ b/examples/simple_token/README.md @@ -4,14 +4,14 @@ To run this program, run: ```bash -leo run mint -leo run transfer # update private key first +leo run mint +leo run transfer # update private key first ``` ## Execute Guide To execute this program, run: ```bash -leo execute mint -leo execute transfer # update private key first +leo execute mint +leo execute transfer # update private key first ``` diff --git a/examples/twoadicity/README.md b/examples/twoadicity/README.md index 5742b59e43..d3cbb467fa 100644 --- a/examples/twoadicity/README.md +++ b/examples/twoadicity/README.md @@ -4,12 +4,12 @@ To run this program, run: ```bash -leo run main +leo run main ``` ## Execute Guide To execute this program, run: ```bash -leo execute main +leo execute main ``` diff --git a/examples/vote/README.md b/examples/vote/README.md index 18e3c6398f..8dba4968b5 100644 --- a/examples/vote/README.md +++ b/examples/vote/README.md @@ -33,7 +33,7 @@ Anyone can issue a new proposal publicly by calling `propose` function. Run `propose`: ``` -leo run propose +leo run propose ``` Output sample: @@ -62,7 +62,7 @@ and can only be used(voted) by the ticket `owner`. Run `new_ticket`: ``` -leo run new_ticket +leo run new_ticket ``` Output sample: @@ -84,11 +84,11 @@ Since the ticket record can be used as an input privately, the voter's privacy i Run `agree`: ``` -leo run agree +leo run agree ``` Run `disagree`: ``` -leo run disagree +leo run disagree ``` diff --git a/examples/vote/inputs/propose.in b/examples/vote/inputs/propose.in index b179c062b0..fd3ab41af7 100644 --- a/examples/vote/inputs/propose.in +++ b/examples/vote/inputs/propose.in @@ -1 +1 @@ -"{ title: 2077160157502449938194577302446444field.private, content: 1452374294790018907888397545906607852827800436field.private, proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2.private }" +"{ title: 2077160157502449938194577302446444field, content: 1452374294790018907888397545906607852827800436field, proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2 }" From c8377f7efea147acb30a1809d61bbfcde965d3d2 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 14:35:06 -0400 Subject: [PATCH 14/23] Fix CI --- .circleci/test-examples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/test-examples.sh b/.circleci/test-examples.sh index 1d32e49398..526152fcf6 100755 --- a/.circleci/test-examples.sh +++ b/.circleci/test-examples.sh @@ -312,7 +312,7 @@ echo "Building and running the \`vote\` program..." cd $EXAMPLES/vote || exit chmod +x $EXAMPLES/vote/run.sh || exit - export -f leo + export -f leo || exit $EXAMPLES/vote/run.sh || exit ) # Check that the vote program ran successfully. From aff7e430108220c4ccb0a4ab1373cb3a417c8881 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 14:54:23 -0400 Subject: [PATCH 15/23] Fix CI --- examples/vote/run.sh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/examples/vote/run.sh b/examples/vote/run.sh index 3e6c9eb923..c1e46cac14 100755 --- a/examples/vote/run.sh +++ b/examples/vote/run.sh @@ -20,9 +20,7 @@ echo " ############################################################################### " # Run the `propose` program function -( - cat ./inputs/propose.in | xargs leo run propose || exit -) +cat ./inputs/propose.in | xargs leo run propose || exit echo " ############################################################################### @@ -38,9 +36,7 @@ echo " ############################################################################### " # Run the `new_ticket` program function -( - cat ./inputs/new_ticket.in | xargs leo run new_ticket || exit -) +cat ./inputs/new_ticket.in | xargs leo run new_ticket || exit echo " ############################################################################### @@ -56,7 +52,5 @@ echo " ############################################################################### " # Run the `agree` or `disagree` program function -( - cat ./inputs/agree.in | xargs leo run agree || exit - #cat ./inputs/disagree.in | xargs leo run disagree || exit -) +cat ./inputs/agree.in | xargs leo run agree || exit +#cat ./inputs/disagree.in | xargs leo run disagree || exit From 49c3cccb05ce8d19e4a72335f047cc2978ac51ae Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Fri, 29 Sep 2023 15:52:25 -0400 Subject: [PATCH 16/23] Fix CI --- examples/vote/run.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/vote/run.sh b/examples/vote/run.sh index c1e46cac14..47f75dac5b 100755 --- a/examples/vote/run.sh +++ b/examples/vote/run.sh @@ -20,7 +20,11 @@ echo " ############################################################################### " # Run the `propose` program function -cat ./inputs/propose.in | xargs leo run propose || exit +leo run propose "{ + title: 2077160157502449938194577302446444field, + content: 1452374294790018907888397545906607852827800436field, + proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2 +}" || exit echo " ############################################################################### @@ -36,7 +40,7 @@ echo " ############################################################################### " # Run the `new_ticket` program function -cat ./inputs/new_ticket.in | xargs leo run new_ticket || exit +leo run new_ticket 2264670486490520844857553240576860973319410481267184439818180411609250173817field aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau || exit echo " ############################################################################### @@ -52,5 +56,9 @@ echo " ############################################################################### " # Run the `agree` or `disagree` program function -cat ./inputs/agree.in | xargs leo run agree || exit +leo run agree "{ + owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, + pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, + _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public +}" || exit #cat ./inputs/disagree.in | xargs leo run disagree || exit From f3fbb7e8f41a61fe5d3a259b897d0770fee1cad5 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu Date: Mon, 2 Oct 2023 10:28:29 -0400 Subject: [PATCH 17/23] Remove struct output from compiler --- compiler/compiler/src/compiler.rs | 4 ++-- leo/cli/commands/build.rs | 26 +++++++++----------------- leo/cli/commands/run.rs | 2 +- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/compiler/compiler/src/compiler.rs b/compiler/compiler/src/compiler.rs index 1a46d166d9..55e0440920 100644 --- a/compiler/compiler/src/compiler.rs +++ b/compiler/compiler/src/compiler.rs @@ -292,7 +292,7 @@ impl<'a> Compiler<'a> { } /// Returns a compiled Leo program. - pub fn compile(&mut self) -> Result<(SymbolTable, String)> { + pub fn compile(&mut self) -> Result { // Parse the program. self.parse_program()?; // Copy the dependencies specified in `program.json` into the AST. @@ -301,7 +301,7 @@ impl<'a> Compiler<'a> { let (symbol_table, struct_graph, call_graph) = self.compiler_stages()?; // Run code generation. let bytecode = self.code_generation_pass(&symbol_table, &struct_graph, &call_graph)?; - Ok((symbol_table, bytecode)) + Ok(bytecode) } /// Writes the AST to a JSON file. diff --git a/leo/cli/commands/build.rs b/leo/cli/commands/build.rs index e856239474..784c07b620 100644 --- a/leo/cli/commands/build.rs +++ b/leo/cli/commands/build.rs @@ -16,12 +16,12 @@ use super::*; -use leo_ast::{NodeBuilder, Struct, Stub}; +use leo_ast::{Stub}; use leo_compiler::{Compiler, CompilerOptions, OutputOptions}; +use leo_errors::UtilError; use leo_package::{build::BuildDirectory, outputs::OutputsDirectory, source::SourceDirectory}; - use leo_span::{Symbol}; - +use retriever::Retriever; use snarkvm::{ package::Package, @@ -29,14 +29,11 @@ use snarkvm::{ }; use indexmap::IndexMap; - -use leo_errors::UtilError; use std::{ io::Write, path::{Path, PathBuf}, }; -use retriever::Retriever; type CurrentNetwork = Testnet3; @@ -107,12 +104,6 @@ impl Command for Build { // Initialize error handler let handler = Handler::default(); - // Initialize a node counter. - let node_builder = NodeBuilder::default(); - - // Store all struct declarations made in the source files. - let mut structs = IndexMap::new(); - // Retrieve all local dependencies in post order let main_sym = Symbol::intern(&program_id.name().to_string()); let mut retriever = Retriever::new(main_sym, &package_path, &home_path) @@ -120,6 +111,7 @@ impl Command for Build { let mut local_dependencies = retriever.retrieve().map_err(|err| UtilError::failed_to_retrieve_dependencies(err, Default::default()))?; + // Push the main program at the end of the list to be compiled after all of its dependencies have been processed local_dependencies.push(main_sym); @@ -142,7 +134,7 @@ impl Command for Build { // Compile all .leo files into .aleo files. for file_path in local_source_files { - structs.extend(compile_leo_file( + compile_leo_file( file_path, &ProgramID::::try_from(format!("{}.aleo", dependency)) .map_err(|_| UtilError::snarkvm_error_building_program_id(Default::default()))?, @@ -151,7 +143,7 @@ impl Command for Build { &handler, self.options.clone(), stubs.clone(), - )?); + )?; } // Writes `leo.lock` as well as caches objects (when target is an intermediate dependency) @@ -193,7 +185,7 @@ fn compile_leo_file( handler: &Handler, options: BuildOptions, stubs: IndexMap, -) -> Result> { +) -> Result<()> { // Construct the Leo file name with extension `foo.leo`. let file_name = file_path.file_name().and_then(|name| name.to_str()).ok_or_else(PackageError::failed_to_get_file_name)?; @@ -217,7 +209,7 @@ fn compile_leo_file( ); // Compile the Leo program into Aleo instructions. - let (symbol_table, instructions) = compiler.compile()?; + let instructions = compiler.compile()?; // Write the instructions. std::fs::File::create(&aleo_file_path) @@ -226,5 +218,5 @@ fn compile_leo_file( .map_err(CliError::failed_to_load_instructions)?; tracing::info!("✅ Compiled '{}' into Aleo instructions", file_name); - Ok(symbol_table.structs) + Ok(()) } diff --git a/leo/cli/commands/run.rs b/leo/cli/commands/run.rs index 222baf8d83..35eb6a90ec 100644 --- a/leo/cli/commands/run.rs +++ b/leo/cli/commands/run.rs @@ -25,7 +25,7 @@ pub struct Run { pub(crate) name: String, #[clap(name = "INPUTS", help = "The inputs to the program.")] - inputs: Vec, + pub(crate) inputs: Vec, #[clap(flatten)] pub(crate) compiler_options: BuildOptions, From 8a7f8394a9f03b2b8d13d3c1ba4e5ee4df40b959 Mon Sep 17 00:00:00 2001 From: Zk Date: Wed, 25 Oct 2023 00:03:40 +0800 Subject: [PATCH 18/23] Fix ci/circleci: test-examples --- examples/vote/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vote/run.sh b/examples/vote/run.sh index 47f75dac5b..40cf48cfe0 100755 --- a/examples/vote/run.sh +++ b/examples/vote/run.sh @@ -23,7 +23,7 @@ echo " leo run propose "{ title: 2077160157502449938194577302446444field, content: 1452374294790018907888397545906607852827800436field, - proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2 + proposer: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau }" || exit echo " From adddd2ade2b20b37ddbbb542e05c041f7da2756a Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:38:40 -0400 Subject: [PATCH 19/23] Update CLI to take files as input --- leo/cli/commands/execute.rs | 32 +++++++++++++++++++++++++++++--- leo/cli/commands/run.rs | 32 +++++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/leo/cli/commands/execute.rs b/leo/cli/commands/execute.rs index 3f148b4221..b018d884db 100644 --- a/leo/cli/commands/execute.rs +++ b/leo/cli/commands/execute.rs @@ -16,7 +16,7 @@ use super::*; -use snarkvm::cli::Execute as SnarkVMExecute; +use snarkvm::{cli::Execute as SnarkVMExecute, prelude::Parser as SnarkVMParser}; /// Build, Prove and Run Leo program with inputs #[derive(Parser, Debug)] @@ -35,6 +35,9 @@ pub struct Execute { )] endpoint: String, + #[arg(short, long, help = "The inputs to the program, from a file. Overrides the INPUTS argument.")] + file: Option, + #[clap(flatten)] pub(crate) compiler_options: BuildOptions, } @@ -57,8 +60,31 @@ impl Command for Execute { // Compose the `execute` command. let mut arguments = vec![SNARKVM_COMMAND.to_string(), self.name]; - // Add the program inputs to the arguments. - arguments.append(&mut inputs); + // Add the inputs to the arguments. + match self.file { + Some(file) => { + // Get the contents from the file. + let path = context.dir()?.join(file); + let raw_content = std::fs::read_to_string(&path) + .map_err(|err| PackageError::failed_to_read_file(path.display(), err))?; + // Parse the values from the file. + let mut content = raw_content.as_str(); + let mut values = vec![]; + while let Ok((remaining, value)) = snarkvm::prelude::Value::::parse(content) { + content = remaining; + values.push(value); + } + // Check that the remaining content is empty. + if !content.trim().is_empty() { + return Err(PackageError::failed_to_read_input_file(path.display()).into()); + } + // Convert the values to strings. + let mut inputs_from_file = values.into_iter().map(|value| value.to_string()).collect::>(); + // Add the inputs from the file to the arguments. + arguments.append(&mut inputs_from_file); + } + None => arguments.append(&mut inputs), + } // Add the compiler options to the arguments. if self.compiler_options.offline { diff --git a/leo/cli/commands/run.rs b/leo/cli/commands/run.rs index 35eb6a90ec..60e5f3aae3 100644 --- a/leo/cli/commands/run.rs +++ b/leo/cli/commands/run.rs @@ -16,7 +16,7 @@ use super::*; -use snarkvm::cli::Run as SnarkVMRun; +use snarkvm::{cli::Run as SnarkVMRun, prelude::Parser as SnarkVMParser}; /// Build, Prove and Run Leo program with inputs #[derive(Parser, Debug)] @@ -27,6 +27,9 @@ pub struct Run { #[clap(name = "INPUTS", help = "The inputs to the program.")] pub(crate) inputs: Vec, + #[arg(short, long, help = "The inputs to the program, from a file. Overrides the INPUTS argument.")] + file: Option, + #[clap(flatten)] pub(crate) compiler_options: BuildOptions, } @@ -49,8 +52,31 @@ impl Command for Run { // Compose the `run` command. let mut arguments = vec![SNARKVM_COMMAND.to_string(), self.name]; - // Add the program inputs to the arguments. - arguments.append(&mut inputs); + // Add the inputs to the arguments. + match self.file { + Some(file) => { + // Get the contents from the file. + let path = context.dir()?.join(file); + let raw_content = std::fs::read_to_string(&path) + .map_err(|err| PackageError::failed_to_read_file(path.display(), err))?; + // Parse the values from the file. + let mut content = raw_content.as_str(); + let mut values = vec![]; + while let Ok((remaining, value)) = snarkvm::prelude::Value::::parse(content) { + content = remaining; + values.push(value); + } + // Check that the remaining content is empty. + if !content.trim().is_empty() { + return Err(PackageError::failed_to_read_input_file(path.display()).into()); + } + // Convert the values to strings. + let mut inputs_from_file = values.into_iter().map(|value| value.to_string()).collect::>(); + // Add the inputs from the file to the arguments. + arguments.append(&mut inputs_from_file); + } + None => arguments.append(&mut inputs), + } // Open the Leo build/ directory let path = context.dir()?; From 0d0c59874846cd5b5913def1706c145fce14c8b2 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 30 Oct 2023 10:39:33 -0400 Subject: [PATCH 20/23] Update examples --- .circleci/test-examples.sh | 38 ++++++++++++------------ examples/message/inputs/message.in | 5 +++- examples/simple_token/inputs/transfer.in | 8 ++++- examples/tictactoe/inputs/tictactoe.in | 9 +++++- examples/vote/build/main.aleo | 12 +++----- examples/vote/inputs/agree.in | 6 +++- examples/vote/inputs/disagree.in | 6 +++- examples/vote/inputs/propose.in | 6 +++- 8 files changed, 57 insertions(+), 33 deletions(-) diff --git a/.circleci/test-examples.sh b/.circleci/test-examples.sh index 526152fcf6..5c9326db78 100755 --- a/.circleci/test-examples.sh +++ b/.circleci/test-examples.sh @@ -57,7 +57,7 @@ fi echo "Building and running the \`bubblesort\` program..." ( cd $EXAMPLES/bubblesort || exit - cat $EXAMPLES/bubblesort/inputs/bubblesort.in | xargs $LEO run bubble_sort || exit + $LEO run bubble_sort --file $EXAMPLES/bubblesort/inputs/bubblesort.in || exit ) # Check that the bubblesort program ran successfully. EXITCODE=$? @@ -70,7 +70,7 @@ fi echo "Building and running the \`core\` program..." ( cd $EXAMPLES/core || exit - cat $EXAMPLES/core/inputs/core.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/core/inputs/core.in || exit ) # Check that the core program ran successfully. EXITCODE=$? @@ -83,7 +83,7 @@ fi echo "Building and running the \`groups\` program..." ( cd $EXAMPLES/groups || exit - cat $EXAMPLES/groups/inputs/groups.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/groups/inputs/groups.in || exit ) # Check that the groups program ran successfully. EXITCODE=$? @@ -96,7 +96,7 @@ fi echo "Building and running the \`hackers-delight/ntzdebruijn\` program..." ( cd $EXAMPLES/hackers-delight/ntzdebruijn || exit - cat $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzdebruijn/inputs/ntzdebruijn.in || exit ) # Check that the hackers-delight/ntzdebruijn program ran successfully. EXITCODE=$? @@ -109,7 +109,7 @@ fi echo "Building and running the \`hackers-delight/ntzgaudet\` program..." ( cd $EXAMPLES/hackers-delight/ntzgaudet || exit - cat $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzgaudet/inputs/ntzgaudet.in || exit ) # Check that the hackers-delight/ntzgaudet program ran successfully. EXITCODE=$? @@ -122,7 +122,7 @@ fi echo "Building and running the \`hackers-delight/ntzloops\` program..." ( cd $EXAMPLES/hackers-delight/ntzloops || exit - cat $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzloops/inputs/ntzloops.in || exit ) # Check that the hackers-delight/ntzloops program ran successfully. EXITCODE=$? @@ -135,7 +135,7 @@ fi echo "Building and running the \`hackers-delight/ntzmasks\` program..." ( cd $EXAMPLES/hackers-delight/ntzmasks || exit - cat $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzmasks/inputs/ntzmasks.in || exit ) # Check that the hackers-delight/ntzmasks program ran successfully. EXITCODE=$? @@ -148,7 +148,7 @@ fi echo "Building and running the \`hackers-delight/ntzreisers\` program..." ( cd $EXAMPLES/hackers-delight/ntzreisers || exit - cat $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzreisers/inputs/ntzreisers.in || exit ) # Check that the hackers-delight/ntzreisers program ran successfully. EXITCODE=$? @@ -161,7 +161,7 @@ fi echo "Building and running the \`hackers-delight/ntzseals\` program..." ( cd $EXAMPLES/hackers-delight/ntzseals || exit - cat $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzseals/inputs/ntzseals.in || exit ) # Check that the hackers-delight/ntzseals program ran successfully. EXITCODE=$? @@ -174,7 +174,7 @@ fi echo "Building and running the \`hackers-delight/ntzsearchtree\` program..." ( cd $EXAMPLES/hackers-delight/ntzsearchtree || exit - cat $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzsearchtree/inputs/ntzsearchtree.in || exit ) # Check that the hackers-delight/ntzsearchtree program ran successfully. EXITCODE=$? @@ -187,7 +187,7 @@ fi echo "Building and running the \`hackers-delight/ntzsmallvals\` program..." ( cd $EXAMPLES/hackers-delight/ntzsmallvals || exit - cat $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/hackers-delight/ntzsmallvals/inputs/ntzsmallvals.in || exit ) # Check that the hackers-delight/ntzsmallvals program ran successfully. EXITCODE=$? @@ -200,7 +200,7 @@ fi echo "Building and running the \`helloworld\` program..." ( cd $EXAMPLES/helloworld || exit - cat $EXAMPLES/helloworld/inputs/helloworld.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/helloworld/inputs/helloworld.in || exit ) # Check that the helloworld program ran successfully. EXITCODE=$? @@ -216,10 +216,10 @@ echo "Building and running the \`interest\` programs..." cd $EXAMPLES/interest || exit # Run the fixed period interest program. - cat $EXAMPLES/interest/inputs/fixed.in | xargs $LEO run fixed_iteration_interest || exit + $LEO run fixed_iteration_interest --file $EXAMPLES/interest/inputs/fixed.in || exit # Run the bounded period interest program. - cat $EXAMPLES/interest/inputs/bounded.in | xargs $LEO run bounded_iteration_interest || exit + $LEO run bounded_iteration_interest --file $EXAMPLES/interest/inputs/bounded.in || exit ) # Check that the interest programs ran successfully. EXITCODE=$? @@ -232,7 +232,7 @@ fi echo "Building and running the \`message\` program..." ( cd $EXAMPLES/message || exit - cat $EXAMPLES/message/inputs/message.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/message/inputs/message.in || exit ) # Check that the message program ran successfully. EXITCODE=$? @@ -246,7 +246,7 @@ echo "Building and running the \`tictactoe\` program..." ( cd $EXAMPLES/tictactoe || exit $LEO run new || exit - cat $EXAMPLES/tictactoe/inputs/tictactoe.in | xargs $LEO run make_move || exit + $LEO run make_move --file $EXAMPLES/tictactoe/inputs/tictactoe.in || exit chmod +x $EXAMPLES/tictactoe/run.sh || exit export -f leo @@ -265,10 +265,10 @@ echo "Building and running the \`simple_token\` programs..." cd $EXAMPLES/simple_token || exit # Run the mint program. - cat $EXAMPLES/simple_token/inputs/mint.in | xargs $LEO run mint || exit + $LEO run mint --file $EXAMPLES/simple_token/inputs/mint.in || exit # Run the transfer program. - cat $EXAMPLES/simple_token/inputs/transfer.in | xargs $LEO run transfer || exit + $LEO run transfer --file $EXAMPLES/simple_token/inputs/transfer.in || exit ) # Check that the simple token programs ran successfully. EXITCODE=$? @@ -297,7 +297,7 @@ fi echo "Building and running the \`twoadicity\` program..." ( cd $EXAMPLES/twoadicity || exit - cat $EXAMPLES/twoadicity/inputs/twoadicity.in | xargs $LEO run main || exit + $LEO run main --file $EXAMPLES/twoadicity/inputs/twoadicity.in || exit ) # Check that the two-adicity program ran successfully. EXITCODE=$? diff --git a/examples/message/inputs/message.in b/examples/message/inputs/message.in index c5c26e2850..1f0ce50e2e 100644 --- a/examples/message/inputs/message.in +++ b/examples/message/inputs/message.in @@ -1 +1,4 @@ -"{ first: 2field, second: 3field }" +{ + first: 2field, + second: 3field +} diff --git a/examples/simple_token/inputs/transfer.in b/examples/simple_token/inputs/transfer.in index a36dc2af97..d62ac71bac 100644 --- a/examples/simple_token/inputs/transfer.in +++ b/examples/simple_token/inputs/transfer.in @@ -1 +1,7 @@ -"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, amount: 100u64.private, _nonce: 0group.public }" aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau 50u64 +{ + owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, + amount: 100u64.private, + _nonce: 0group.public +} +aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau +50u64 diff --git a/examples/tictactoe/inputs/tictactoe.in b/examples/tictactoe/inputs/tictactoe.in index d42512d6b8..5f799d5991 100644 --- a/examples/tictactoe/inputs/tictactoe.in +++ b/examples/tictactoe/inputs/tictactoe.in @@ -1 +1,8 @@ -1u8 1u8 1u8 "{ r1: { c1: 0u8, c2: 0u8, c3: 0u8 }, r2: { c1: 0u8, c2: 0u8, c3: 0u8 }, r3: { c1: 0u8, c2: 0u8, c3: 0u8 } }" +1u8 +1u8 +1u8 +{ + r1: { c1: 0u8, c2: 0u8, c3: 0u8 }, + r2: { c1: 0u8, c2: 0u8, c3: 0u8 }, + r3: { c1: 0u8, c2: 0u8, c3: 0u8 } +} diff --git a/examples/vote/build/main.aleo b/examples/vote/build/main.aleo index 57d566d206..82cfdf4cf0 100644 --- a/examples/vote/build/main.aleo +++ b/examples/vote/build/main.aleo @@ -39,8 +39,7 @@ function propose: assert.eq self.caller r0.proposer; hash.bhp256 r0.title into r1 as field; cast self.caller r1 r0 into r2 as Proposal.record; - async propose r1 into r3; - output r2 as Proposal.record; + async propose r1 into r3; output r2 as Proposal.record; output r3 as vote.aleo/propose.future; finalize propose: @@ -52,8 +51,7 @@ function new_ticket: input r0 as field.public; input r1 as address.public; cast r1 r0 into r2 as Ticket.record; - async new_ticket r0 into r3; - output r2 as Ticket.record; + async new_ticket r0 into r3; output r2 as Ticket.record; output r3 as vote.aleo/new_ticket.future; finalize new_ticket: @@ -65,8 +63,7 @@ finalize new_ticket: function agree: input r0 as Ticket.record; - async agree r0.pid into r1; - output r1 as vote.aleo/agree.future; + async agree r0.pid into r1; output r1 as vote.aleo/agree.future; finalize agree: input r0 as field.public; @@ -77,8 +74,7 @@ finalize agree: function disagree: input r0 as Ticket.record; - async disagree r0.pid into r1; - output r1 as vote.aleo/disagree.future; + async disagree r0.pid into r1; output r1 as vote.aleo/disagree.future; finalize disagree: input r0 as field.public; diff --git a/examples/vote/inputs/agree.in b/examples/vote/inputs/agree.in index 487d82267c..24364799d1 100644 --- a/examples/vote/inputs/agree.in +++ b/examples/vote/inputs/agree.in @@ -1 +1,5 @@ -"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public }" +{ + owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, + pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, + _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public +} diff --git a/examples/vote/inputs/disagree.in b/examples/vote/inputs/disagree.in index 487d82267c..24364799d1 100644 --- a/examples/vote/inputs/disagree.in +++ b/examples/vote/inputs/disagree.in @@ -1 +1,5 @@ -"{ owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public }" +{ + owner: aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau.private, + pid: 2264670486490520844857553240576860973319410481267184439818180411609250173817field.private, + _nonce: 1637267040221574073903539416642641433705357302885235345311606754421919550724group.public +} diff --git a/examples/vote/inputs/propose.in b/examples/vote/inputs/propose.in index fd3ab41af7..73b06c1914 100644 --- a/examples/vote/inputs/propose.in +++ b/examples/vote/inputs/propose.in @@ -1 +1,5 @@ -"{ title: 2077160157502449938194577302446444field, content: 1452374294790018907888397545906607852827800436field, proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2 }" +{ + title: 2077160157502449938194577302446444field, + content: 1452374294790018907888397545906607852827800436field, + proposer: aleo1kkk52quhnxgn2nfrcd9jqk7c9x27c23f2wvw7fyzcze56yahvcgszgttu2 +} From 719980e17fe16e16583fcdbdafc65de9e92afd1f Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Sat, 6 Jan 2024 18:48:17 +0800 Subject: [PATCH 21/23] Fix clippy and fmt --- leo/cli/cli.rs | 1 + leo/cli/commands/build.rs | 6 ++---- leo/cli/commands/run.rs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/leo/cli/cli.rs b/leo/cli/cli.rs index 241692aba9..10b4c3fccc 100644 --- a/leo/cli/cli.rs +++ b/leo/cli/cli.rs @@ -214,6 +214,7 @@ mod tests { "aleo13tngrq7506zwdxj0cxjtvp28pk937jejhne0rt4zp0z370uezuysjz2prs".to_string(), "2u32".to_string(), ], + file: None, compiler_options: Default::default(), }, }, diff --git a/leo/cli/commands/build.rs b/leo/cli/commands/build.rs index 784c07b620..50f0a6c59c 100644 --- a/leo/cli/commands/build.rs +++ b/leo/cli/commands/build.rs @@ -16,11 +16,11 @@ use super::*; -use leo_ast::{Stub}; +use leo_ast::Stub; use leo_compiler::{Compiler, CompilerOptions, OutputOptions}; use leo_errors::UtilError; use leo_package::{build::BuildDirectory, outputs::OutputsDirectory, source::SourceDirectory}; -use leo_span::{Symbol}; +use leo_span::Symbol; use retriever::Retriever; use snarkvm::{ @@ -34,7 +34,6 @@ use std::{ path::{Path, PathBuf}, }; - type CurrentNetwork = Testnet3; impl From for CompilerOptions { @@ -111,7 +110,6 @@ impl Command for Build { let mut local_dependencies = retriever.retrieve().map_err(|err| UtilError::failed_to_retrieve_dependencies(err, Default::default()))?; - // Push the main program at the end of the list to be compiled after all of its dependencies have been processed local_dependencies.push(main_sym); diff --git a/leo/cli/commands/run.rs b/leo/cli/commands/run.rs index 60e5f3aae3..561b7ede84 100644 --- a/leo/cli/commands/run.rs +++ b/leo/cli/commands/run.rs @@ -28,7 +28,7 @@ pub struct Run { pub(crate) inputs: Vec, #[arg(short, long, help = "The inputs to the program, from a file. Overrides the INPUTS argument.")] - file: Option, + pub(crate) file: Option, #[clap(flatten)] pub(crate) compiler_options: BuildOptions, From 92b2123ff70b59e3a9b086b8dfca8e911ed99f62 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 15 Jan 2024 15:37:06 -0800 Subject: [PATCH 22/23] More cleanup --- utils/tests/build_nested_test/nested/README.md | 13 ------------- .../build_nested_test/nested/inputs/nested.in | 4 ---- .../grandparent/README.md | 13 ------------- .../grandparent/inputs/import_example.in | 4 ---- .../grandparent/parent/README.md | 13 ------------- .../grandparent/parent/child/README.md | 13 ------------- .../grandparent/parent/child/inputs/a.in | 4 ---- .../grandparent/parent/inputs/b.in | 4 ---- .../local_test/README.md | 13 ------------- .../local_test/build/imports/local_dep_1.aleo | 9 +++++++++ .../local_test/build/imports/nested.aleo | 12 ++++++++++++ .../build/imports/nested_example_layer_0.aleo | 10 ++++++++++ .../build/imports/nested_example_layer_1.aleo | 9 +++++++++ .../build/imports/nested_example_layer_2.aleo | 7 +++++++ .../local_test/build/main.aleo | 9 +++++++++ .../local_test/build/program.json | 18 ++++++++++++++++++ .../local_test/inputs/local_test.in | 4 ---- .../local_test/local_dep_1/README.md | 13 ------------- .../local_dep_1/build/imports/nested.aleo | 12 ++++++++++++ .../build/imports/nested_example_layer_0.aleo | 10 ++++++++++ .../build/imports/nested_example_layer_1.aleo | 9 +++++++++ .../build/imports/nested_example_layer_2.aleo | 7 +++++++ .../local_test/local_dep_1/build/main.aleo | 9 +++++++++ .../local_dep_1/inputs/local_dep_1.in | 4 ---- .../nested/README.md | 13 ------------- .../build/imports/nested_example_layer_0.aleo | 10 ++++++++++ .../build/imports/nested_example_layer_1.aleo | 9 +++++++++ .../build/imports/nested_example_layer_2.aleo | 7 +++++++ .../nested/build/main.aleo | 12 ++++++++++++ .../nested/inputs/nested.in | 4 ---- 30 files changed, 159 insertions(+), 119 deletions(-) delete mode 100644 utils/tests/build_nested_test/nested/README.md delete mode 100644 utils/tests/build_nested_test/nested/inputs/nested.in delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/README.md delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/inputs/import_example.in delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/README.md delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/child/README.md delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/child/inputs/a.in delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/inputs/b.in delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/README.md create mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/local_dep_1.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/nested.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_0.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_1.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_2.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/main.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/program.json delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/inputs/local_test.in delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/README.md create mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_0.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_1.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_2.aleo create mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/main.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/inputs/local_dep_1.in delete mode 100644 utils/tests/mixed_local_network_build_test/nested/README.md create mode 100644 utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_0.aleo create mode 100644 utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_1.aleo create mode 100644 utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_2.aleo create mode 100644 utils/tests/mixed_local_network_build_test/nested/build/main.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/nested/inputs/nested.in diff --git a/utils/tests/build_nested_test/nested/README.md b/utils/tests/build_nested_test/nested/README.md deleted file mode 100644 index 8bf41e3b4e..0000000000 --- a/utils/tests/build_nested_test/nested/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# nested.aleo - -## Build Guide - -To compile this Aleo program, run: -```bash -snarkvm build -``` - -To execute this Aleo program, run: -```bash -snarkvm run hello -``` diff --git a/utils/tests/build_nested_test/nested/inputs/nested.in b/utils/tests/build_nested_test/nested/inputs/nested.in deleted file mode 100644 index 4585af6c29..0000000000 --- a/utils/tests/build_nested_test/nested/inputs/nested.in +++ /dev/null @@ -1,4 +0,0 @@ -// The program input for nested/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; diff --git a/utils/tests/double_nested_program_run_test/grandparent/README.md b/utils/tests/double_nested_program_run_test/grandparent/README.md deleted file mode 100644 index 66ab9d73cc..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# import_example.aleo - -## Build Guide - -To compile this Aleo program, run: -```bash -snarkvm build -``` - -To execute this Aleo program, run: -```bash -snarkvm run hello -``` diff --git a/utils/tests/double_nested_program_run_test/grandparent/inputs/import_example.in b/utils/tests/double_nested_program_run_test/grandparent/inputs/import_example.in deleted file mode 100644 index 410e26eb54..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/inputs/import_example.in +++ /dev/null @@ -1,4 +0,0 @@ -// The program input for import_example/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/README.md b/utils/tests/double_nested_program_run_test/grandparent/parent/README.md deleted file mode 100644 index 2972a57632..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# b.aleo - -## Build Guide - -To compile this Aleo program, run: -```bash -snarkvm build -``` - -To execute this Aleo program, run: -```bash -snarkvm run hello -``` diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/child/README.md b/utils/tests/double_nested_program_run_test/grandparent/parent/child/README.md deleted file mode 100644 index 1d165faf5d..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/child/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# a.aleo - -## Build Guide - -To compile this Aleo program, run: -```bash -snarkvm build -``` - -To execute this Aleo program, run: -```bash -snarkvm run hello -``` diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/child/inputs/a.in b/utils/tests/double_nested_program_run_test/grandparent/parent/child/inputs/a.in deleted file mode 100644 index edc7be126e..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/child/inputs/a.in +++ /dev/null @@ -1,4 +0,0 @@ -// The program input for a/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/inputs/b.in b/utils/tests/double_nested_program_run_test/grandparent/parent/inputs/b.in deleted file mode 100644 index 64b61b9994..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/inputs/b.in +++ /dev/null @@ -1,4 +0,0 @@ -// The program input for b/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; diff --git a/utils/tests/mixed_local_network_build_test/local_test/README.md b/utils/tests/mixed_local_network_build_test/local_test/README.md deleted file mode 100644 index 7048fbab75..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# local_test.aleo - -## Build Guide - -To compile this Aleo program, run: -```bash -snarkvm build -``` - -To execute this Aleo program, run: -```bash -snarkvm run hello -``` diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/local_dep_1.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/local_dep_1.aleo new file mode 100644 index 0000000000..fbf2116373 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/build/imports/local_dep_1.aleo @@ -0,0 +1,9 @@ +program local_dep_1.aleo; + + + +function main: + input r0 as u32.public; + input r1 as u32.private; + add r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested.aleo new file mode 100644 index 0000000000..e2e063b232 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested.aleo @@ -0,0 +1,12 @@ +import nested_example_layer_2.aleo; +import nested_example_layer_1.aleo; +import nested_example_layer_0.aleo; +program nested.aleo; + + + +function example: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_0.aleo/main r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_0.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_0.aleo new file mode 100644 index 0000000000..c1532ce30a --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_0.aleo @@ -0,0 +1,10 @@ +import nested_example_layer_2.aleo; +import nested_example_layer_1.aleo; + +program nested_example_layer_0.aleo; + +function main: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_1.aleo/external_function r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_1.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_1.aleo new file mode 100644 index 0000000000..4efaf63929 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_1.aleo @@ -0,0 +1,9 @@ +import nested_example_layer_2.aleo; + +program nested_example_layer_1.aleo; + +function external_function: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_2.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_2.aleo new file mode 100644 index 0000000000..459b896b67 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_2.aleo @@ -0,0 +1,7 @@ +program nested_example_layer_2.aleo; + +function external_nested_function: + input r0 as u32.public; + input r1 as u32.private; + add r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/main.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/main.aleo new file mode 100644 index 0000000000..50e47d72fd --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/build/main.aleo @@ -0,0 +1,9 @@ +program local_test.aleo; + + + +function main: + input r0 as u32.public; + input r1 as u32.private; + add r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/program.json b/utils/tests/mixed_local_network_build_test/local_test/build/program.json new file mode 100644 index 0000000000..aaca657237 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/build/program.json @@ -0,0 +1,18 @@ +{ + "program": "local_test.aleo", + "version": "0.0.0", + "description": "", + "license": "MIT", + "dependencies" : [ + { + "name": "local_dep_1.aleo", + "location": "local", + "path": "local_dep_1" + }, + { + "name": "nested.aleo", + "location": "local", + "path": "../nested" + } + ] +} diff --git a/utils/tests/mixed_local_network_build_test/local_test/inputs/local_test.in b/utils/tests/mixed_local_network_build_test/local_test/inputs/local_test.in deleted file mode 100644 index 8b6c059614..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/inputs/local_test.in +++ /dev/null @@ -1,4 +0,0 @@ -// The program input for local_test/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/README.md b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/README.md deleted file mode 100644 index 083946fd1b..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# local_dep_1.aleo - -## Build Guide - -To compile this Aleo program, run: -```bash -snarkvm build -``` - -To execute this Aleo program, run: -```bash -snarkvm run hello -``` diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested.aleo new file mode 100644 index 0000000000..e2e063b232 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested.aleo @@ -0,0 +1,12 @@ +import nested_example_layer_2.aleo; +import nested_example_layer_1.aleo; +import nested_example_layer_0.aleo; +program nested.aleo; + + + +function example: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_0.aleo/main r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_0.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_0.aleo new file mode 100644 index 0000000000..c1532ce30a --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_0.aleo @@ -0,0 +1,10 @@ +import nested_example_layer_2.aleo; +import nested_example_layer_1.aleo; + +program nested_example_layer_0.aleo; + +function main: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_1.aleo/external_function r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_1.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_1.aleo new file mode 100644 index 0000000000..4efaf63929 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_1.aleo @@ -0,0 +1,9 @@ +import nested_example_layer_2.aleo; + +program nested_example_layer_1.aleo; + +function external_function: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_2.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_2.aleo new file mode 100644 index 0000000000..459b896b67 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_2.aleo @@ -0,0 +1,7 @@ +program nested_example_layer_2.aleo; + +function external_nested_function: + input r0 as u32.public; + input r1 as u32.private; + add r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/main.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/main.aleo new file mode 100644 index 0000000000..fbf2116373 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/main.aleo @@ -0,0 +1,9 @@ +program local_dep_1.aleo; + + + +function main: + input r0 as u32.public; + input r1 as u32.private; + add r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/inputs/local_dep_1.in b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/inputs/local_dep_1.in deleted file mode 100644 index cfb45dc95d..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/inputs/local_dep_1.in +++ /dev/null @@ -1,4 +0,0 @@ -// The program input for local_dep_1/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; diff --git a/utils/tests/mixed_local_network_build_test/nested/README.md b/utils/tests/mixed_local_network_build_test/nested/README.md deleted file mode 100644 index 8bf41e3b4e..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# nested.aleo - -## Build Guide - -To compile this Aleo program, run: -```bash -snarkvm build -``` - -To execute this Aleo program, run: -```bash -snarkvm run hello -``` diff --git a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_0.aleo b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_0.aleo new file mode 100644 index 0000000000..c1532ce30a --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_0.aleo @@ -0,0 +1,10 @@ +import nested_example_layer_2.aleo; +import nested_example_layer_1.aleo; + +program nested_example_layer_0.aleo; + +function main: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_1.aleo/external_function r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_1.aleo b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_1.aleo new file mode 100644 index 0000000000..4efaf63929 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_1.aleo @@ -0,0 +1,9 @@ +import nested_example_layer_2.aleo; + +program nested_example_layer_1.aleo; + +function external_function: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_2.aleo b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_2.aleo new file mode 100644 index 0000000000..459b896b67 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_2.aleo @@ -0,0 +1,7 @@ +program nested_example_layer_2.aleo; + +function external_nested_function: + input r0 as u32.public; + input r1 as u32.private; + add r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/nested/build/main.aleo b/utils/tests/mixed_local_network_build_test/nested/build/main.aleo new file mode 100644 index 0000000000..e2e063b232 --- /dev/null +++ b/utils/tests/mixed_local_network_build_test/nested/build/main.aleo @@ -0,0 +1,12 @@ +import nested_example_layer_2.aleo; +import nested_example_layer_1.aleo; +import nested_example_layer_0.aleo; +program nested.aleo; + + + +function example: + input r0 as u32.public; + input r1 as u32.private; + call nested_example_layer_0.aleo/main r0 r1 into r2; + output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/nested/inputs/nested.in b/utils/tests/mixed_local_network_build_test/nested/inputs/nested.in deleted file mode 100644 index 4585af6c29..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/inputs/nested.in +++ /dev/null @@ -1,4 +0,0 @@ -// The program input for nested/src/main.leo -[main] -public a: u32 = 1u32; -b: u32 = 2u32; From b1a3fc8b9e4da20cf085fa6d75f6c473eb6ada79 Mon Sep 17 00:00:00 2001 From: Pranav Gaddamadugu <23022326+d0cd@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:00:29 -0800 Subject: [PATCH 23/23] More cleanup --- leo/cli/cli.rs | 1 + .../testnet3/nested_example_layer_0.aleo | 10 ------ .../testnet3/nested_example_layer_1.aleo | 9 ----- .../testnet3/nested_example_layer_2.aleo | 7 ---- .../tests/build_nested_test/nested/.gitignore | 5 --- .../build/imports/nested_example_layer_0.aleo | 10 ------ .../build/imports/nested_example_layer_1.aleo | 9 ----- .../build/imports/nested_example_layer_2.aleo | 7 ---- .../build_nested_test/nested/build/main.aleo | 12 ------- .../nested/build/program.json | 13 ------- utils/tests/build_nested_test/nested/leo.lock | 20 ----------- .../build_nested_test/nested/program.json | 13 ------- .../build_nested_test/nested/src/main.leo | 8 ----- .../grandparent/.gitignore | 5 --- .../grandparent/build/imports/child.aleo | 12 ------- .../grandparent/build/imports/parent.aleo | 10 ------ .../grandparent/build/main.aleo | 11 ------ .../grandparent/build/program.json | 18 ---------- .../grandparent/leo.lock | 13 ------- .../grandparent/parent/.gitignore | 5 --- .../parent/build/imports/child.aleo | 12 ------- .../grandparent/parent/build/main.aleo | 10 ------ .../grandparent/parent/child/.gitignore | 5 --- .../grandparent/parent/child/build/main.aleo | 12 ------- .../grandparent/parent/child/leo.lock | 1 - .../grandparent/parent/child/program.json | 6 ---- .../grandparent/parent/child/src/main.leo | 10 ------ .../grandparent/parent/leo.lock | 6 ---- .../grandparent/parent/program.json | 13 ------- .../grandparent/parent/src/main.leo | 7 ---- .../grandparent/program.json | 18 ---------- .../grandparent/src/main.leo | 8 ----- .../testnet3/nested_example_layer_0.aleo | 10 ------ .../testnet3/nested_example_layer_1.aleo | 9 ----- .../testnet3/nested_example_layer_2.aleo | 7 ---- .../local_test/.gitignore | 5 --- .../local_test/build/imports/local_dep_1.aleo | 9 ----- .../local_test/build/imports/nested.aleo | 12 ------- .../build/imports/nested_example_layer_0.aleo | 10 ------ .../build/imports/nested_example_layer_1.aleo | 9 ----- .../build/imports/nested_example_layer_2.aleo | 7 ---- .../local_test/build/main.aleo | 9 ----- .../local_test/build/program.json | 18 ---------- .../local_test/leo.lock | 34 ------------------- .../local_test/local_dep_1/.gitignore | 5 --- .../local_dep_1/build/imports/nested.aleo | 12 ------- .../build/imports/nested_example_layer_0.aleo | 10 ------ .../build/imports/nested_example_layer_1.aleo | 9 ----- .../build/imports/nested_example_layer_2.aleo | 7 ---- .../local_test/local_dep_1/build/main.aleo | 9 ----- .../local_test/local_dep_1/leo.lock | 27 --------------- .../local_test/local_dep_1/program.json | 13 ------- .../local_test/local_dep_1/src/main.leo | 7 ---- .../local_test/program.json | 18 ---------- .../local_test/src/main.leo | 7 ---- .../nested/.gitignore | 5 --- .../build/imports/nested_example_layer_0.aleo | 10 ------ .../build/imports/nested_example_layer_1.aleo | 9 ----- .../build/imports/nested_example_layer_2.aleo | 7 ---- .../nested/build/main.aleo | 12 ------- .../nested/leo.lock | 20 ----------- .../nested/program.json | 13 ------- .../nested/src/main.leo | 8 ----- 63 files changed, 1 insertion(+), 652 deletions(-) delete mode 100644 utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_0.aleo delete mode 100644 utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_1.aleo delete mode 100644 utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_2.aleo delete mode 100644 utils/tests/build_nested_test/nested/.gitignore delete mode 100644 utils/tests/build_nested_test/nested/build/imports/nested_example_layer_0.aleo delete mode 100644 utils/tests/build_nested_test/nested/build/imports/nested_example_layer_1.aleo delete mode 100644 utils/tests/build_nested_test/nested/build/imports/nested_example_layer_2.aleo delete mode 100644 utils/tests/build_nested_test/nested/build/main.aleo delete mode 100644 utils/tests/build_nested_test/nested/build/program.json delete mode 100644 utils/tests/build_nested_test/nested/leo.lock delete mode 100644 utils/tests/build_nested_test/nested/program.json delete mode 100644 utils/tests/build_nested_test/nested/src/main.leo delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/.gitignore delete mode 100755 utils/tests/double_nested_program_run_test/grandparent/build/imports/child.aleo delete mode 100755 utils/tests/double_nested_program_run_test/grandparent/build/imports/parent.aleo delete mode 100755 utils/tests/double_nested_program_run_test/grandparent/build/main.aleo delete mode 100755 utils/tests/double_nested_program_run_test/grandparent/build/program.json delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/leo.lock delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/.gitignore delete mode 100755 utils/tests/double_nested_program_run_test/grandparent/parent/build/imports/child.aleo delete mode 100755 utils/tests/double_nested_program_run_test/grandparent/parent/build/main.aleo delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/child/.gitignore delete mode 100755 utils/tests/double_nested_program_run_test/grandparent/parent/child/build/main.aleo delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/child/leo.lock delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/child/program.json delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/child/src/main.leo delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/leo.lock delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/program.json delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/parent/src/main.leo delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/program.json delete mode 100644 utils/tests/double_nested_program_run_test/grandparent/src/main.leo delete mode 100644 utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_0.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_1.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_2.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/.gitignore delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/local_dep_1.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/nested.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_0.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_1.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_2.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/main.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/build/program.json delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/leo.lock delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/.gitignore delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_0.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_1.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_2.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/main.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/leo.lock delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/program.json delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/local_dep_1/src/main.leo delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/program.json delete mode 100644 utils/tests/mixed_local_network_build_test/local_test/src/main.leo delete mode 100644 utils/tests/mixed_local_network_build_test/nested/.gitignore delete mode 100644 utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_0.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_1.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_2.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/nested/build/main.aleo delete mode 100644 utils/tests/mixed_local_network_build_test/nested/leo.lock delete mode 100644 utils/tests/mixed_local_network_build_test/nested/program.json delete mode 100644 utils/tests/mixed_local_network_build_test/nested/src/main.leo diff --git a/leo/cli/cli.rs b/leo/cli/cli.rs index 10b4c3fccc..07d341d197 100644 --- a/leo/cli/cli.rs +++ b/leo/cli/cli.rs @@ -170,6 +170,7 @@ mod tests { command: crate::cli::commands::Run { name: "example".to_string(), inputs: vec!["1u32".to_string(), "2u32".to_string()], + file: None, compiler_options: Default::default(), }, }, diff --git a/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_0.aleo b/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_0.aleo deleted file mode 100644 index c1532ce30a..0000000000 --- a/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_0.aleo +++ /dev/null @@ -1,10 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; - -program nested_example_layer_0.aleo; - -function main: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_1.aleo/external_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_1.aleo b/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_1.aleo deleted file mode 100644 index 4efaf63929..0000000000 --- a/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_1.aleo +++ /dev/null @@ -1,9 +0,0 @@ -import nested_example_layer_2.aleo; - -program nested_example_layer_1.aleo; - -function external_function: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_2.aleo b/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_2.aleo deleted file mode 100644 index 459b896b67..0000000000 --- a/utils/tests/build_nested_test/.aleo/registry/testnet3/nested_example_layer_2.aleo +++ /dev/null @@ -1,7 +0,0 @@ -program nested_example_layer_2.aleo; - -function external_nested_function: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/build_nested_test/nested/.gitignore b/utils/tests/build_nested_test/nested/.gitignore deleted file mode 100644 index f721f7f6f4..0000000000 --- a/utils/tests/build_nested_test/nested/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.env -*.avm -*.prover -*.verifier -outputs/ diff --git a/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_0.aleo b/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_0.aleo deleted file mode 100644 index c1532ce30a..0000000000 --- a/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_0.aleo +++ /dev/null @@ -1,10 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; - -program nested_example_layer_0.aleo; - -function main: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_1.aleo/external_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_1.aleo b/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_1.aleo deleted file mode 100644 index 4efaf63929..0000000000 --- a/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_1.aleo +++ /dev/null @@ -1,9 +0,0 @@ -import nested_example_layer_2.aleo; - -program nested_example_layer_1.aleo; - -function external_function: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_2.aleo b/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_2.aleo deleted file mode 100644 index 459b896b67..0000000000 --- a/utils/tests/build_nested_test/nested/build/imports/nested_example_layer_2.aleo +++ /dev/null @@ -1,7 +0,0 @@ -program nested_example_layer_2.aleo; - -function external_nested_function: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/build_nested_test/nested/build/main.aleo b/utils/tests/build_nested_test/nested/build/main.aleo deleted file mode 100644 index e2e063b232..0000000000 --- a/utils/tests/build_nested_test/nested/build/main.aleo +++ /dev/null @@ -1,12 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; -import nested_example_layer_0.aleo; -program nested.aleo; - - - -function example: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_0.aleo/main r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/build_nested_test/nested/build/program.json b/utils/tests/build_nested_test/nested/build/program.json deleted file mode 100644 index adb2055992..0000000000 --- a/utils/tests/build_nested_test/nested/build/program.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "program": "nested.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies": [ - { - "name": "nested_example_layer_0.aleo", - "location": "network", - "network": "testnet3" - } - ] -} diff --git a/utils/tests/build_nested_test/nested/leo.lock b/utils/tests/build_nested_test/nested/leo.lock deleted file mode 100644 index 776acf2cf4..0000000000 --- a/utils/tests/build_nested_test/nested/leo.lock +++ /dev/null @@ -1,20 +0,0 @@ -[[package]] -name = "nested_example_layer_2" -network = "testnet3" -location = "network" -checksum = "b987b8490b214ad9120a47b218a1c1387c7c2763aaf2aa9c81002a4c7020b3e4" -dependencies = [] - -[[package]] -name = "nested_example_layer_1" -network = "testnet3" -location = "network" -checksum = "17701f7369fe6bad74cdfb956bd9d85c6753ffedbf43be9fe5a4bfdc1751617b" -dependencies = ["nested_example_layer_2.aleo"] - -[[package]] -name = "nested_example_layer_0" -network = "testnet3" -location = "network" -checksum = "23414151de5687d5daa447533109ee810b7e763c4d0659e2f53562123e639b2c" -dependencies = ["nested_example_layer_2.aleo", "nested_example_layer_1.aleo"] diff --git a/utils/tests/build_nested_test/nested/program.json b/utils/tests/build_nested_test/nested/program.json deleted file mode 100644 index adb2055992..0000000000 --- a/utils/tests/build_nested_test/nested/program.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "program": "nested.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies": [ - { - "name": "nested_example_layer_0.aleo", - "location": "network", - "network": "testnet3" - } - ] -} diff --git a/utils/tests/build_nested_test/nested/src/main.leo b/utils/tests/build_nested_test/nested/src/main.leo deleted file mode 100644 index 319496dcd5..0000000000 --- a/utils/tests/build_nested_test/nested/src/main.leo +++ /dev/null @@ -1,8 +0,0 @@ -// The 'nested' program. -import nested_example_layer_0.aleo; -program nested.aleo { - transition example(public a: u32, b: u32) -> u32 { - let c: u32 = nested_example_layer_0.aleo/main(a, b); - return c; - } -} diff --git a/utils/tests/double_nested_program_run_test/grandparent/.gitignore b/utils/tests/double_nested_program_run_test/grandparent/.gitignore deleted file mode 100644 index f721f7f6f4..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.env -*.avm -*.prover -*.verifier -outputs/ diff --git a/utils/tests/double_nested_program_run_test/grandparent/build/imports/child.aleo b/utils/tests/double_nested_program_run_test/grandparent/build/imports/child.aleo deleted file mode 100755 index 0f225259e6..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/build/imports/child.aleo +++ /dev/null @@ -1,12 +0,0 @@ -program child.aleo; - -record A: - owner as address.private; - val as u32.private; - - -function mint: - input r0 as address.private; - input r1 as u32.private; - cast r0 r1 into r2 as A.record; - output r2 as A.record; diff --git a/utils/tests/double_nested_program_run_test/grandparent/build/imports/parent.aleo b/utils/tests/double_nested_program_run_test/grandparent/build/imports/parent.aleo deleted file mode 100755 index af6caa8688..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/build/imports/parent.aleo +++ /dev/null @@ -1,10 +0,0 @@ -import child.aleo; -program parent.aleo; - - - -function wrapper_mint: - input r0 as address.private; - input r1 as u32.private; - call child.aleo/mint aleo1q30lfyggefvzzxqaaclzrn3wd94q4u8zzy8jhhfrcqrf306ayvqsdvj7s4 1u32 into r2; - output r2 as child.aleo/A.record; diff --git a/utils/tests/double_nested_program_run_test/grandparent/build/main.aleo b/utils/tests/double_nested_program_run_test/grandparent/build/main.aleo deleted file mode 100755 index 4be6b74cb0..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/build/main.aleo +++ /dev/null @@ -1,11 +0,0 @@ -import child.aleo; -import parent.aleo; -program grandparent.aleo; - - - -function double_wrapper_mint: - input r0 as address.private; - input r1 as u32.private; - call parent.aleo/wrapper_mint r0 r1 into r2; - output r2 as child.aleo/A.record; diff --git a/utils/tests/double_nested_program_run_test/grandparent/build/program.json b/utils/tests/double_nested_program_run_test/grandparent/build/program.json deleted file mode 100755 index 16a0e03c19..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/build/program.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "program": "grandparent.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies": [ - { - "name": "child.aleo", - "location": "local", - "path": "parent/child" - }, - { - "name": "parent.aleo", - "location": "local", - "path": "parent" - } - ] -} diff --git a/utils/tests/double_nested_program_run_test/grandparent/leo.lock b/utils/tests/double_nested_program_run_test/grandparent/leo.lock deleted file mode 100644 index ac5676eed6..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/leo.lock +++ /dev/null @@ -1,13 +0,0 @@ -[[package]] -name = "child" -location = "local" -path = "parent/child" -checksum = "6341f6fcccbfa86b71e0eac445b9d0ee558c74ef896183ee82b456b9e7fb2270" -dependencies = [] - -[[package]] -name = "parent" -location = "local" -path = "parent" -checksum = "abf40f1784b1e58b97f55322cff031bb36d276d9986bdd8149c2d0cf3829a61e" -dependencies = ["child.aleo"] diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/.gitignore b/utils/tests/double_nested_program_run_test/grandparent/parent/.gitignore deleted file mode 100644 index f721f7f6f4..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.env -*.avm -*.prover -*.verifier -outputs/ diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/build/imports/child.aleo b/utils/tests/double_nested_program_run_test/grandparent/parent/build/imports/child.aleo deleted file mode 100755 index 0f225259e6..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/build/imports/child.aleo +++ /dev/null @@ -1,12 +0,0 @@ -program child.aleo; - -record A: - owner as address.private; - val as u32.private; - - -function mint: - input r0 as address.private; - input r1 as u32.private; - cast r0 r1 into r2 as A.record; - output r2 as A.record; diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/build/main.aleo b/utils/tests/double_nested_program_run_test/grandparent/parent/build/main.aleo deleted file mode 100755 index af6caa8688..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/build/main.aleo +++ /dev/null @@ -1,10 +0,0 @@ -import child.aleo; -program parent.aleo; - - - -function wrapper_mint: - input r0 as address.private; - input r1 as u32.private; - call child.aleo/mint aleo1q30lfyggefvzzxqaaclzrn3wd94q4u8zzy8jhhfrcqrf306ayvqsdvj7s4 1u32 into r2; - output r2 as child.aleo/A.record; diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/child/.gitignore b/utils/tests/double_nested_program_run_test/grandparent/parent/child/.gitignore deleted file mode 100644 index f721f7f6f4..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/child/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.env -*.avm -*.prover -*.verifier -outputs/ diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/child/build/main.aleo b/utils/tests/double_nested_program_run_test/grandparent/parent/child/build/main.aleo deleted file mode 100755 index 0f225259e6..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/child/build/main.aleo +++ /dev/null @@ -1,12 +0,0 @@ -program child.aleo; - -record A: - owner as address.private; - val as u32.private; - - -function mint: - input r0 as address.private; - input r1 as u32.private; - cast r0 r1 into r2 as A.record; - output r2 as A.record; diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/child/leo.lock b/utils/tests/double_nested_program_run_test/grandparent/parent/child/leo.lock deleted file mode 100644 index c4293b3b9f..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/child/leo.lock +++ /dev/null @@ -1 +0,0 @@ -package = [] diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/child/program.json b/utils/tests/double_nested_program_run_test/grandparent/parent/child/program.json deleted file mode 100644 index e38ad182bf..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/child/program.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "program": "child.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT" -} diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/child/src/main.leo b/utils/tests/double_nested_program_run_test/grandparent/parent/child/src/main.leo deleted file mode 100644 index 444a769ab8..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/child/src/main.leo +++ /dev/null @@ -1,10 +0,0 @@ -// The 'a' program. -program child.aleo { - record A { - owner: address, - val: u32, - } - transition mint(owner: address, val: u32) -> A { - return A {owner: owner, val: val}; - } -} diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/leo.lock b/utils/tests/double_nested_program_run_test/grandparent/parent/leo.lock deleted file mode 100644 index 736e4355a7..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/leo.lock +++ /dev/null @@ -1,6 +0,0 @@ -[[package]] -name = "child" -location = "local" -path = "parent/child" -checksum = "6341f6fcccbfa86b71e0eac445b9d0ee558c74ef896183ee82b456b9e7fb2270" -dependencies = [] diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/program.json b/utils/tests/double_nested_program_run_test/grandparent/parent/program.json deleted file mode 100644 index 0131497fc8..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/program.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "program": "parent.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies": [ - { - "name": "child.aleo", - "location": "local", - "path": "child" - } - ] -} diff --git a/utils/tests/double_nested_program_run_test/grandparent/parent/src/main.leo b/utils/tests/double_nested_program_run_test/grandparent/parent/src/main.leo deleted file mode 100644 index 872de90655..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/parent/src/main.leo +++ /dev/null @@ -1,7 +0,0 @@ -// The 'b' program. -import child.aleo; -program parent.aleo { - transition wrapper_mint(owner: address, val: u32) -> child.aleo/A { - return child.aleo/mint(aleo1q30lfyggefvzzxqaaclzrn3wd94q4u8zzy8jhhfrcqrf306ayvqsdvj7s4, 1u32); - } -} diff --git a/utils/tests/double_nested_program_run_test/grandparent/program.json b/utils/tests/double_nested_program_run_test/grandparent/program.json deleted file mode 100644 index 16a0e03c19..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/program.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "program": "grandparent.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies": [ - { - "name": "child.aleo", - "location": "local", - "path": "parent/child" - }, - { - "name": "parent.aleo", - "location": "local", - "path": "parent" - } - ] -} diff --git a/utils/tests/double_nested_program_run_test/grandparent/src/main.leo b/utils/tests/double_nested_program_run_test/grandparent/src/main.leo deleted file mode 100644 index 655d7cfb69..0000000000 --- a/utils/tests/double_nested_program_run_test/grandparent/src/main.leo +++ /dev/null @@ -1,8 +0,0 @@ -// The 'import_example' program. -import child.aleo; -import parent.aleo; -program grandparent.aleo { - transition double_wrapper_mint(owner: address, val: u32) -> child.aleo/A { - return parent.aleo/wrapper_mint(owner,val); - } -} diff --git a/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_0.aleo b/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_0.aleo deleted file mode 100644 index c1532ce30a..0000000000 --- a/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_0.aleo +++ /dev/null @@ -1,10 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; - -program nested_example_layer_0.aleo; - -function main: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_1.aleo/external_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_1.aleo b/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_1.aleo deleted file mode 100644 index 4efaf63929..0000000000 --- a/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_1.aleo +++ /dev/null @@ -1,9 +0,0 @@ -import nested_example_layer_2.aleo; - -program nested_example_layer_1.aleo; - -function external_function: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_2.aleo b/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_2.aleo deleted file mode 100644 index 459b896b67..0000000000 --- a/utils/tests/mixed_local_network_build_test/.aleo/registry/testnet3/nested_example_layer_2.aleo +++ /dev/null @@ -1,7 +0,0 @@ -program nested_example_layer_2.aleo; - -function external_nested_function: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/.gitignore b/utils/tests/mixed_local_network_build_test/local_test/.gitignore deleted file mode 100644 index f721f7f6f4..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.env -*.avm -*.prover -*.verifier -outputs/ diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/local_dep_1.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/local_dep_1.aleo deleted file mode 100644 index fbf2116373..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/build/imports/local_dep_1.aleo +++ /dev/null @@ -1,9 +0,0 @@ -program local_dep_1.aleo; - - - -function main: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested.aleo deleted file mode 100644 index e2e063b232..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested.aleo +++ /dev/null @@ -1,12 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; -import nested_example_layer_0.aleo; -program nested.aleo; - - - -function example: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_0.aleo/main r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_0.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_0.aleo deleted file mode 100644 index c1532ce30a..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_0.aleo +++ /dev/null @@ -1,10 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; - -program nested_example_layer_0.aleo; - -function main: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_1.aleo/external_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_1.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_1.aleo deleted file mode 100644 index 4efaf63929..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_1.aleo +++ /dev/null @@ -1,9 +0,0 @@ -import nested_example_layer_2.aleo; - -program nested_example_layer_1.aleo; - -function external_function: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_2.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_2.aleo deleted file mode 100644 index 459b896b67..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/build/imports/nested_example_layer_2.aleo +++ /dev/null @@ -1,7 +0,0 @@ -program nested_example_layer_2.aleo; - -function external_nested_function: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/main.aleo b/utils/tests/mixed_local_network_build_test/local_test/build/main.aleo deleted file mode 100644 index 50e47d72fd..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/build/main.aleo +++ /dev/null @@ -1,9 +0,0 @@ -program local_test.aleo; - - - -function main: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/build/program.json b/utils/tests/mixed_local_network_build_test/local_test/build/program.json deleted file mode 100644 index aaca657237..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/build/program.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "program": "local_test.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies" : [ - { - "name": "local_dep_1.aleo", - "location": "local", - "path": "local_dep_1" - }, - { - "name": "nested.aleo", - "location": "local", - "path": "../nested" - } - ] -} diff --git a/utils/tests/mixed_local_network_build_test/local_test/leo.lock b/utils/tests/mixed_local_network_build_test/local_test/leo.lock deleted file mode 100644 index 3474804a17..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/leo.lock +++ /dev/null @@ -1,34 +0,0 @@ -[[package]] -name = "nested_example_layer_2" -network = "testnet3" -location = "network" -checksum = "b987b8490b214ad9120a47b218a1c1387c7c2763aaf2aa9c81002a4c7020b3e4" -dependencies = [] - -[[package]] -name = "nested_example_layer_1" -network = "testnet3" -location = "network" -checksum = "17701f7369fe6bad74cdfb956bd9d85c6753ffedbf43be9fe5a4bfdc1751617b" -dependencies = ["nested_example_layer_2.aleo"] - -[[package]] -name = "nested_example_layer_0" -network = "testnet3" -location = "network" -checksum = "23414151de5687d5daa447533109ee810b7e763c4d0659e2f53562123e639b2c" -dependencies = ["nested_example_layer_2.aleo", "nested_example_layer_1.aleo"] - -[[package]] -name = "nested" -location = "local" -path = "../nested" -checksum = "6f7f03b9d2700c496bd6eb8b5033ee8f221015d2646c05a97c4150e1523cc82e" -dependencies = ["nested_example_layer_0.aleo"] - -[[package]] -name = "local_dep_1" -location = "local" -path = "local_dep_1" -checksum = "690da404f0a5bf30838a75dc54db1695486979b58cc88bad712880a72d698a06" -dependencies = ["nested.aleo"] diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/.gitignore b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/.gitignore deleted file mode 100644 index f721f7f6f4..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.env -*.avm -*.prover -*.verifier -outputs/ diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested.aleo deleted file mode 100644 index e2e063b232..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested.aleo +++ /dev/null @@ -1,12 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; -import nested_example_layer_0.aleo; -program nested.aleo; - - - -function example: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_0.aleo/main r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_0.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_0.aleo deleted file mode 100644 index c1532ce30a..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_0.aleo +++ /dev/null @@ -1,10 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; - -program nested_example_layer_0.aleo; - -function main: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_1.aleo/external_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_1.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_1.aleo deleted file mode 100644 index 4efaf63929..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_1.aleo +++ /dev/null @@ -1,9 +0,0 @@ -import nested_example_layer_2.aleo; - -program nested_example_layer_1.aleo; - -function external_function: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_2.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_2.aleo deleted file mode 100644 index 459b896b67..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/imports/nested_example_layer_2.aleo +++ /dev/null @@ -1,7 +0,0 @@ -program nested_example_layer_2.aleo; - -function external_nested_function: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/main.aleo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/main.aleo deleted file mode 100644 index fbf2116373..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/build/main.aleo +++ /dev/null @@ -1,9 +0,0 @@ -program local_dep_1.aleo; - - - -function main: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/leo.lock b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/leo.lock deleted file mode 100644 index 62861ef1ee..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/leo.lock +++ /dev/null @@ -1,27 +0,0 @@ -[[package]] -name = "nested_example_layer_2" -network = "testnet3" -location = "network" -checksum = "b987b8490b214ad9120a47b218a1c1387c7c2763aaf2aa9c81002a4c7020b3e4" -dependencies = [] - -[[package]] -name = "nested_example_layer_1" -network = "testnet3" -location = "network" -checksum = "17701f7369fe6bad74cdfb956bd9d85c6753ffedbf43be9fe5a4bfdc1751617b" -dependencies = ["nested_example_layer_2.aleo"] - -[[package]] -name = "nested_example_layer_0" -network = "testnet3" -location = "network" -checksum = "23414151de5687d5daa447533109ee810b7e763c4d0659e2f53562123e639b2c" -dependencies = ["nested_example_layer_2.aleo", "nested_example_layer_1.aleo"] - -[[package]] -name = "nested" -location = "local" -path = "../nested" -checksum = "6f7f03b9d2700c496bd6eb8b5033ee8f221015d2646c05a97c4150e1523cc82e" -dependencies = ["nested_example_layer_0.aleo"] diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/program.json b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/program.json deleted file mode 100644 index 3f1cade248..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/program.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "program": "local_dep_1.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies" : [ - { - "name": "nested.aleo", - "location": "local", - "path": "../../nested" - } - ] -} diff --git a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/src/main.leo b/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/src/main.leo deleted file mode 100644 index 5c427fe8c6..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/local_dep_1/src/main.leo +++ /dev/null @@ -1,7 +0,0 @@ -// The 'local_dep_1' program. -program local_dep_1.aleo { - transition main(public a: u32, b: u32) -> u32 { - let c: u32 = a + b; - return c; - } -} diff --git a/utils/tests/mixed_local_network_build_test/local_test/program.json b/utils/tests/mixed_local_network_build_test/local_test/program.json deleted file mode 100644 index aaca657237..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/program.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "program": "local_test.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies" : [ - { - "name": "local_dep_1.aleo", - "location": "local", - "path": "local_dep_1" - }, - { - "name": "nested.aleo", - "location": "local", - "path": "../nested" - } - ] -} diff --git a/utils/tests/mixed_local_network_build_test/local_test/src/main.leo b/utils/tests/mixed_local_network_build_test/local_test/src/main.leo deleted file mode 100644 index e1ff98ea93..0000000000 --- a/utils/tests/mixed_local_network_build_test/local_test/src/main.leo +++ /dev/null @@ -1,7 +0,0 @@ -// The 'local_test' program. -program local_test.aleo { - transition main(public a: u32, b: u32) -> u32 { - let c: u32 = a + b; - return c; - } -} diff --git a/utils/tests/mixed_local_network_build_test/nested/.gitignore b/utils/tests/mixed_local_network_build_test/nested/.gitignore deleted file mode 100644 index f721f7f6f4..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.env -*.avm -*.prover -*.verifier -outputs/ diff --git a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_0.aleo b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_0.aleo deleted file mode 100644 index c1532ce30a..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_0.aleo +++ /dev/null @@ -1,10 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; - -program nested_example_layer_0.aleo; - -function main: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_1.aleo/external_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_1.aleo b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_1.aleo deleted file mode 100644 index 4efaf63929..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_1.aleo +++ /dev/null @@ -1,9 +0,0 @@ -import nested_example_layer_2.aleo; - -program nested_example_layer_1.aleo; - -function external_function: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_2.aleo/external_nested_function r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_2.aleo b/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_2.aleo deleted file mode 100644 index 459b896b67..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/build/imports/nested_example_layer_2.aleo +++ /dev/null @@ -1,7 +0,0 @@ -program nested_example_layer_2.aleo; - -function external_nested_function: - input r0 as u32.public; - input r1 as u32.private; - add r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/nested/build/main.aleo b/utils/tests/mixed_local_network_build_test/nested/build/main.aleo deleted file mode 100644 index e2e063b232..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/build/main.aleo +++ /dev/null @@ -1,12 +0,0 @@ -import nested_example_layer_2.aleo; -import nested_example_layer_1.aleo; -import nested_example_layer_0.aleo; -program nested.aleo; - - - -function example: - input r0 as u32.public; - input r1 as u32.private; - call nested_example_layer_0.aleo/main r0 r1 into r2; - output r2 as u32.private; diff --git a/utils/tests/mixed_local_network_build_test/nested/leo.lock b/utils/tests/mixed_local_network_build_test/nested/leo.lock deleted file mode 100644 index 776acf2cf4..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/leo.lock +++ /dev/null @@ -1,20 +0,0 @@ -[[package]] -name = "nested_example_layer_2" -network = "testnet3" -location = "network" -checksum = "b987b8490b214ad9120a47b218a1c1387c7c2763aaf2aa9c81002a4c7020b3e4" -dependencies = [] - -[[package]] -name = "nested_example_layer_1" -network = "testnet3" -location = "network" -checksum = "17701f7369fe6bad74cdfb956bd9d85c6753ffedbf43be9fe5a4bfdc1751617b" -dependencies = ["nested_example_layer_2.aleo"] - -[[package]] -name = "nested_example_layer_0" -network = "testnet3" -location = "network" -checksum = "23414151de5687d5daa447533109ee810b7e763c4d0659e2f53562123e639b2c" -dependencies = ["nested_example_layer_2.aleo", "nested_example_layer_1.aleo"] diff --git a/utils/tests/mixed_local_network_build_test/nested/program.json b/utils/tests/mixed_local_network_build_test/nested/program.json deleted file mode 100644 index adb2055992..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/program.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "program": "nested.aleo", - "version": "0.0.0", - "description": "", - "license": "MIT", - "dependencies": [ - { - "name": "nested_example_layer_0.aleo", - "location": "network", - "network": "testnet3" - } - ] -} diff --git a/utils/tests/mixed_local_network_build_test/nested/src/main.leo b/utils/tests/mixed_local_network_build_test/nested/src/main.leo deleted file mode 100644 index 319496dcd5..0000000000 --- a/utils/tests/mixed_local_network_build_test/nested/src/main.leo +++ /dev/null @@ -1,8 +0,0 @@ -// The 'nested' program. -import nested_example_layer_0.aleo; -program nested.aleo { - transition example(public a: u32, b: u32) -> u32 { - let c: u32 = nested_example_layer_0.aleo/main(a, b); - return c; - } -}