mirror of
https://github.com/AleoHQ/leo.git
synced 2024-11-11 16:10:09 +03:00
fix proving output
This commit is contained in:
parent
551595026b
commit
bcab2df709
@ -235,13 +235,8 @@ impl<F: Field + PrimeField, G: GroupType<F>> ConstraintSynthesizer<F> for Compil
|
||||
SynthesisError::Unsatisfiable
|
||||
})?;
|
||||
|
||||
tracing::info!("Program circuit successfully synthesized!");
|
||||
|
||||
// Write results to file
|
||||
let output_file = OutputFile::new(&package_name);
|
||||
|
||||
tracing::info!("Writing to output registers...");
|
||||
|
||||
output_file.write(&output_directory, result.bytes()).unwrap();
|
||||
|
||||
Ok(())
|
||||
|
@ -86,7 +86,7 @@ impl CLI for BuildCommand {
|
||||
lib_file_path.push(LIB_FILE_NAME);
|
||||
|
||||
// Log compilation of library file to console
|
||||
tracing::info!("library file ({:?})", lib_file_path);
|
||||
tracing::info!("Library file ({:?})", lib_file_path);
|
||||
|
||||
// Compile the library file but do not output
|
||||
let _program = Compiler::<Fq, EdwardsGroupType>::parse_program_without_input(
|
||||
@ -113,7 +113,7 @@ impl CLI for BuildCommand {
|
||||
let state_string = StateFile::new(&package_name).read_from(&path)?;
|
||||
|
||||
// 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`
|
||||
let program = Compiler::<Fq, EdwardsGroupType>::parse_program_with_input(
|
||||
@ -183,7 +183,7 @@ impl CLI for BuildCommand {
|
||||
|
||||
// Begin "Finished" context for console logging todo: @collin figure a way to get this output with tracing without dropping span
|
||||
tracing::span!(tracing::Level::INFO, "Finished").in_scope(|| {
|
||||
tracing::info!("compiled in {} milliseconds", start.elapsed().as_millis());
|
||||
tracing::info!("Program compiled in {} milliseconds\n", start.elapsed().as_millis());
|
||||
});
|
||||
|
||||
return Ok(Some((program, checksum_differs)));
|
||||
|
@ -52,7 +52,11 @@ impl CLI for ProveCommand {
|
||||
let path = current_dir()?;
|
||||
let package_name = Manifest::try_from(&path)?.get_package_name();
|
||||
|
||||
tracing::info!("Proving...");
|
||||
// Begin "Proving" context for console logging
|
||||
let span = tracing::span!(tracing::Level::INFO, "Proving");
|
||||
let enter = span.enter();
|
||||
|
||||
tracing::info!("Starting...");
|
||||
|
||||
// Start the timer
|
||||
let start = Instant::now();
|
||||
@ -68,7 +72,13 @@ impl CLI for ProveCommand {
|
||||
program_proof.write(&mut proof)?;
|
||||
ProofFile::new(&package_name).write_to(&path, &proof)?;
|
||||
|
||||
tracing::info!("Completed program proving");
|
||||
// Drop "Proving" context for console logging
|
||||
drop(enter);
|
||||
|
||||
// Begin "Finished" context for console logging
|
||||
tracing::span!(tracing::Level::INFO, "Finished").in_scope(|| {
|
||||
tracing::info!("Program proving complete\n");
|
||||
});
|
||||
|
||||
Ok((program_proof, prepared_verifying_key))
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ impl CLI for RunCommand {
|
||||
|
||||
verifying += start.elapsed();
|
||||
|
||||
println!(" ");
|
||||
println!(" Verifier time : {:?} milliseconds", verifying.as_millis());
|
||||
println!(" Verifier output : {}", is_success);
|
||||
println!(" ");
|
||||
|
@ -70,9 +70,6 @@ impl CLI for SetupCommand {
|
||||
let span = tracing::span!(tracing::Level::INFO, "Setup");
|
||||
let enter = span.enter();
|
||||
|
||||
// Start the timer
|
||||
let start = Instant::now();
|
||||
|
||||
// Check if a proving key and verification key already exists
|
||||
let keys_exist = ProvingKeyFile::new(&package_name).exists_at(&path)
|
||||
&& VerificationKeyFile::new(&package_name).exists_at(&path);
|
||||
@ -80,10 +77,10 @@ impl CLI for SetupCommand {
|
||||
// If keys do not exist or the checksum differs, run the program setup
|
||||
// If keys do not exist or the checksum differs, run the program setup
|
||||
let (proving_key, prepared_verifying_key) = if !keys_exist || checksum_differs {
|
||||
tracing::info!("Setup starting...");
|
||||
tracing::info!("Starting...");
|
||||
|
||||
// Start the timer
|
||||
let start = Instant::now();
|
||||
// Start the timer for setup
|
||||
let setup_start = Instant::now();
|
||||
|
||||
// Run the program setup operation
|
||||
let rng = &mut thread_rng();
|
||||
@ -91,7 +88,7 @@ impl CLI for SetupCommand {
|
||||
Groth16::<Bls12_377, Compiler<Fr, _>, Vec<Fr>>::setup(program.clone(), rng).unwrap();
|
||||
|
||||
// Output the setup time
|
||||
tracing::info!("Setup completed in {:?} milliseconds", start.elapsed().as_millis());
|
||||
tracing::info!("Completed in {:?} milliseconds", setup_start.elapsed().as_millis());
|
||||
|
||||
// TODO (howardwu): Convert parameters to a 'proving key' struct for serialization.
|
||||
// Write the proving key file to the output directory
|
||||
@ -128,8 +125,8 @@ impl CLI for SetupCommand {
|
||||
drop(enter);
|
||||
|
||||
// Begin "Finished" context for console logging
|
||||
tracing::span!(tracing::Level::INFO, " Finished").in_scope(|| {
|
||||
tracing::info!("setup in {} seconds", start.elapsed().as_secs());
|
||||
tracing::span!(tracing::Level::INFO, "Finished").in_scope(|| {
|
||||
tracing::info!("Program setup complete\n");
|
||||
});
|
||||
|
||||
Ok((program, proving_key, prepared_verifying_key))
|
||||
|
@ -105,11 +105,11 @@ impl CLI for TestCommand {
|
||||
let temporary_program = program.clone();
|
||||
let (passed, failed) = temporary_program.compile_test_constraints(pairs)?;
|
||||
|
||||
// Set the result of the test command to "ok" if all tests pass
|
||||
// Set the result of the test command to PASSED if no tests failed.
|
||||
let result = if failed == 0 {
|
||||
"ok".to_owned()
|
||||
"PASSED".to_owned()
|
||||
} else {
|
||||
"failed".to_owned()
|
||||
"FAILED".to_owned()
|
||||
};
|
||||
|
||||
// Drop "Test" context for console logging
|
||||
@ -117,7 +117,13 @@ impl CLI for TestCommand {
|
||||
|
||||
// Begin "Finished" context for console logging
|
||||
tracing::span!(tracing::Level::INFO, "Finished").in_scope(|| {
|
||||
tracing::info!("result: {}. {} passed; {} failed;\n", result, passed, failed);
|
||||
tracing::info!(
|
||||
"result: {} in {} milliseconds. {} passed; {} failed;\n",
|
||||
result,
|
||||
start.elapsed().as_millis(),
|
||||
passed,
|
||||
failed
|
||||
);
|
||||
});
|
||||
|
||||
Ok(())
|
||||
|
@ -13,9 +13,6 @@
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use leo_package::errors::ManifestError;
|
||||
|
||||
use std::ffi::OsString;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
|
Loading…
Reference in New Issue
Block a user