diff --git a/ast/src/leo.pest b/ast/src/leo.pest index 5836b95602..b92ae1762e 100644 --- a/ast/src/leo.pest +++ b/ast/src/leo.pest @@ -345,8 +345,8 @@ input_keyword = { "input" } // Declared in functions/input/input.rs input = { - input_keyword - | function_input + function_input + | input_keyword } input_list = _{ (input ~ ("," ~ NEWLINE* ~ input)*)? } diff --git a/compiler/src/compiler.rs b/compiler/src/compiler.rs index 2f9f80f4f5..351b1c0cfe 100644 --- a/compiler/src/compiler.rs +++ b/compiler/src/compiler.rs @@ -150,8 +150,8 @@ impl> Compiler { } /// Synthesizes the circuit for test functions with program input. - pub fn compile_test_constraints(self, cs: &mut TestConstraintSystem) -> Result<(), CompilerError> { - generate_test_constraints::(cs, self.program, self.program_input, &self.imported_programs) + pub fn compile_test_constraints(self) -> Result<(), CompilerError> { + generate_test_constraints::(self.program, self.program_input, &self.imported_programs) } /// Calls the internal generate_constraints method with arguments diff --git a/compiler/src/constraints/constraints.rs b/compiler/src/constraints/constraints.rs index fc74c6066e..ba4aaec894 100644 --- a/compiler/src/constraints/constraints.rs +++ b/compiler/src/constraints/constraints.rs @@ -42,7 +42,6 @@ pub fn generate_constraints, CS: Constrai } pub fn generate_test_constraints>( - cs: &mut TestConstraintSystem, program: Program, input: Input, imported_programs: &ImportParser, @@ -57,6 +56,7 @@ pub fn generate_test_constraints>( log::info!("Running {} tests", tests.len()); for (test_name, test_function) in tests.into_iter() { + let cs = &mut TestConstraintSystem::::new(); let full_test_name = format!("{}::{}", program_name.clone(), test_name.to_string()); let result = resolved_program.enforce_main_function( @@ -68,7 +68,7 @@ pub fn generate_test_constraints>( if result.is_ok() { log::info!( - "test {} passed. Constraint system satisfied: {}", + "test {} compiled successfully. Constraint system satisfied: {}", full_test_name, cs.is_satisfied() ); diff --git a/leo/commands/test.rs b/leo/commands/test.rs index f1526cf8af..458edfb241 100644 --- a/leo/commands/test.rs +++ b/leo/commands/test.rs @@ -12,7 +12,6 @@ use leo_package::{ }; use snarkos_curves::edwards_bls12::Fq; -use snarkos_models::gadgets::r1cs::TestConstraintSystem; use clap::ArgMatches; use std::{convert::TryFrom, env::current_dir}; @@ -81,9 +80,8 @@ impl CLI for TestCommand { // Generate the program on the constraint system and verify correctness { - let mut cs = TestConstraintSystem::::new(); let temporary_program = program.clone(); - let output = temporary_program.compile_test_constraints(&mut cs)?; + let output = temporary_program.compile_test_constraints()?; log::debug!("Compiled constraints - {:#?}", output); }