mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-29 11:43:28 +03:00
use tracing in compiler
This commit is contained in:
parent
c22ddffe74
commit
912a192b5c
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -1240,7 +1240,6 @@ dependencies = [
|
|||||||
"leo-package",
|
"leo-package",
|
||||||
"leo-state",
|
"leo-state",
|
||||||
"leo-typed",
|
"leo-typed",
|
||||||
"log",
|
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"pest",
|
"pest",
|
||||||
"rand",
|
"rand",
|
||||||
|
@ -29,7 +29,6 @@ snarkos-utilities = { version = "1.0.0" }
|
|||||||
|
|
||||||
bincode = { version = "1.0" }
|
bincode = { version = "1.0" }
|
||||||
hex = { version = "0.4.2" }
|
hex = { version = "0.4.2" }
|
||||||
log = { version = "0.4" }
|
|
||||||
pest = { version = "2.0" }
|
pest = { version = "2.0" }
|
||||||
rand = { version = "0.7" }
|
rand = { version = "0.7" }
|
||||||
rand_xorshift = { version = "0.2", default-features = false }
|
rand_xorshift = { version = "0.2", default-features = false }
|
||||||
|
@ -133,7 +133,7 @@ impl<F: Field + PrimeField, G: GroupType<F>> Compiler<F, G> {
|
|||||||
self.program = typed_tree.into_repr();
|
self.program = typed_tree.into_repr();
|
||||||
self.imported_programs = ImportParser::parse(&self.program)?;
|
self.imported_programs = ImportParser::parse(&self.program)?;
|
||||||
|
|
||||||
log::debug!("Program parsing complete\n{:#?}", self.program);
|
tracing::debug!("Program parsing complete\n{:#?}", self.program);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -230,16 +230,16 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstraintSynthesizer<F> for Compil
|
|||||||
let output_directory = self.output_directory.clone();
|
let output_directory = self.output_directory.clone();
|
||||||
let package_name = self.package_name.clone();
|
let package_name = self.package_name.clone();
|
||||||
let result = self.generate_constraints_helper(cs).map_err(|e| {
|
let result = self.generate_constraints_helper(cs).map_err(|e| {
|
||||||
log::error!("{}", e);
|
tracing::error!("{}", e);
|
||||||
SynthesisError::Unsatisfiable
|
SynthesisError::Unsatisfiable
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
log::info!("Program circuit successfully synthesized!");
|
tracing::info!("Program circuit successfully synthesized!");
|
||||||
|
|
||||||
// Write results to file
|
// Write results to file
|
||||||
let output_file = OutputFile::new(&package_name);
|
let output_file = OutputFile::new(&package_name);
|
||||||
|
|
||||||
log::info!("Writing to output registers...");
|
tracing::info!("Writing to output registers...");
|
||||||
|
|
||||||
output_file.write(&output_directory, result.bytes()).unwrap();
|
output_file.write(&output_directory, result.bytes()).unwrap();
|
||||||
|
|
||||||
|
@ -25,21 +25,21 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstrainedProgram<F, G> {
|
|||||||
let string = self.format(cs, file_scope, function_scope, string)?;
|
let string = self.format(cs, file_scope, function_scope, string)?;
|
||||||
|
|
||||||
if unwrap_indicator_value(indicator) {
|
if unwrap_indicator_value(indicator) {
|
||||||
log::debug!("{}", string);
|
tracing::debug!("{}", string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConsoleFunction::Error(string) => {
|
ConsoleFunction::Error(string) => {
|
||||||
let string = self.format(cs, file_scope, function_scope, string)?;
|
let string = self.format(cs, file_scope, function_scope, string)?;
|
||||||
|
|
||||||
if unwrap_indicator_value(indicator) {
|
if unwrap_indicator_value(indicator) {
|
||||||
log::error!("{}", string);
|
tracing::error!("{}", string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConsoleFunction::Log(string) => {
|
ConsoleFunction::Log(string) => {
|
||||||
let string = self.format(cs, file_scope, function_scope, string)?;
|
let string = self.format(cs, file_scope, function_scope, string)?;
|
||||||
|
|
||||||
if unwrap_indicator_value(indicator) {
|
if unwrap_indicator_value(indicator) {
|
||||||
log::info!("{}", string);
|
tracing::info!("{}", string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ pub fn generate_test_constraints<F: Field + PrimeField, G: GroupType<F>>(
|
|||||||
// Get default input
|
// Get default input
|
||||||
let default = input.pairs.get(&program_name);
|
let default = input.pairs.get(&program_name);
|
||||||
|
|
||||||
log::info!("Running {} tests", tests.len());
|
tracing::info!("Running {} tests", tests.len());
|
||||||
|
|
||||||
for (test_name, test) in tests.into_iter() {
|
for (test_name, test) in tests.into_iter() {
|
||||||
let cs = &mut TestConstraintSystem::<F>::new();
|
let cs = &mut TestConstraintSystem::<F>::new();
|
||||||
@ -121,7 +121,7 @@ pub fn generate_test_constraints<F: Field + PrimeField, G: GroupType<F>>(
|
|||||||
);
|
);
|
||||||
|
|
||||||
if result.is_ok() {
|
if result.is_ok() {
|
||||||
log::info!(
|
tracing::info!(
|
||||||
"test {} compiled successfully. Constraint system satisfied: {}",
|
"test {} compiled successfully. Constraint system satisfied: {}",
|
||||||
full_test_name,
|
full_test_name,
|
||||||
cs.is_satisfied()
|
cs.is_satisfied()
|
||||||
@ -131,11 +131,11 @@ pub fn generate_test_constraints<F: Field + PrimeField, G: GroupType<F>>(
|
|||||||
let output = result?;
|
let output = result?;
|
||||||
let output_file = OutputFile::new(&output_file_name);
|
let output_file = OutputFile::new(&output_file_name);
|
||||||
|
|
||||||
log::info!("\tWriting output to registers in `{}.out` ...", output_file_name);
|
tracing::info!("\tWriting output to registers in `{}.out` ...", output_file_name);
|
||||||
|
|
||||||
output_file.write(output_directory, output.bytes()).unwrap();
|
output_file.write(output_directory, output.bytes()).unwrap();
|
||||||
} else {
|
} else {
|
||||||
log::error!("test {} errored: {}", full_test_name, result.unwrap_err());
|
// tracing::error!("test {} errored: {}", full_test_name, result.unwrap_err());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ impl CLI for BuildCommand {
|
|||||||
// Load the state file at `package_name.in`
|
// Load the state file at `package_name.in`
|
||||||
let state_string = StateFile::new(&package_name).read_from(&path)?;
|
let state_string = StateFile::new(&package_name).read_from(&path)?;
|
||||||
|
|
||||||
// Log compilation of main file to console
|
// Log compilation of files to console
|
||||||
tracing::info!("program file ({:?})", main_file_path);
|
tracing::info!("program file ({:?})", main_file_path);
|
||||||
|
|
||||||
// Load the program at `main_file_path`
|
// Load the program at `main_file_path`
|
||||||
|
@ -56,7 +56,7 @@ impl CLI for DeployCommand {
|
|||||||
// Get the package name
|
// Get the package name
|
||||||
let _package_name = Manifest::try_from(&path)?.get_package_name();
|
let _package_name = Manifest::try_from(&path)?.get_package_name();
|
||||||
|
|
||||||
tracing::info!("Unimplemented - `leo deploy`");
|
tracing::error!("Unimplemented - `leo deploy`");
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -107,8 +107,8 @@ pub enum CLIError {
|
|||||||
VerificationKeyFileError(VerificationKeyFileError),
|
VerificationKeyFileError(VerificationKeyFileError),
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! impl_T {
|
macro_rules! impl_cli_error {
|
||||||
(for $($t:tt), +) => {
|
($($t:tt), +) => {
|
||||||
$(impl From<$t> for CLIError {
|
$(impl From<$t> for CLIError {
|
||||||
fn from(error: $t) -> Self {
|
fn from(error: $t) -> Self {
|
||||||
tracing::error!("{}\n", error);
|
tracing::error!("{}\n", error);
|
||||||
@ -119,7 +119,7 @@ macro_rules! impl_T {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_T!(for
|
impl_cli_error!(
|
||||||
AddError,
|
AddError,
|
||||||
BuildError,
|
BuildError,
|
||||||
CircuitFileError,
|
CircuitFileError,
|
||||||
@ -143,8 +143,8 @@ impl_T!(for
|
|||||||
SourceDirectoryError,
|
SourceDirectoryError,
|
||||||
StateFileError,
|
StateFileError,
|
||||||
TestError,
|
TestError,
|
||||||
VerificationKeyFileError
|
VerificationKeyFileError,
|
||||||
ZipFileError,
|
ZipFileError
|
||||||
);
|
);
|
||||||
|
|
||||||
impl From<leo_compiler::errors::CompilerError> for CLIError {
|
impl From<leo_compiler::errors::CompilerError> for CLIError {
|
||||||
|
Loading…
Reference in New Issue
Block a user