Skip to content

Commit

Permalink
Merge pull request #12 from lambdaclass/add-simple-logging
Browse files Browse the repository at this point in the history
chore: add logging
  • Loading branch information
entropidelic authored Jul 16, 2024
2 parents 05fff60 + d1f334e commit f4e2233
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 14 deletions.
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ ethers = { tag = "v2.0.15-fix-reconnections", features = [
dialoguer = "0.11.0"
bincode = "1.3.3"
rpassword = "7.3.1"
env_logger = "0.11.3"
log = "0.4.22"


[patch.crates-io]
Expand Down
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ __EXAMPLES__:

# RISC0
prove_risc0_fibonacci:
@cargo run --release -- prove-risc0 examples/fibonacci .
@RUST_LOG=info cargo run --release -- prove-risc0 examples/fibonacci .

prove_risc0_rsa:
@cargo run --release -- prove-risc0 examples/rsa .
@RUST_LOG=info cargo run --release -- prove-risc0 examples/rsa .

prove_risc0_ecdsa:
@cargo run --release -- prove-risc0 examples/ecdsa .
@RUST_LOG=info cargo run --release -- prove-risc0 examples/ecdsa .

prove_risc0_blockchain_state:
@cargo run --release -- prove-risc0 examples/json .
@RUST_LOG=info cargo run --release -- prove-risc0 examples/json .

# SP1
prove_sp1_fibonacci:
@cargo run --release -- prove-sp1 examples/fibonacci .
@RUST_LOG=info cargo run --release -- prove-sp1 examples/fibonacci .

prove_sp1_rsa:
@cargo run --release -- prove-sp1 examples/rsa .
@RUST_LOG=info cargo run --release -- prove-sp1 examples/rsa .

prove_sp1_ecdsa:
@cargo run --release -- prove-sp1 examples/ecdsa .
@RUST_LOG=info cargo run --release -- prove-sp1 examples/ecdsa .

prove_sp1_blockchain_state:
@cargo run --release -- prove-sp1 examples/json .
@RUST_LOG=info cargo run --release -- prove-sp1 examples/json .
14 changes: 8 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use aligned_sdk::types::ProvingSystemId;
use clap::{Args, Parser, Subcommand};
use log::info;
use std::io;
use std::path::PathBuf;
use zkRust::risc0;
Expand Down Expand Up @@ -35,11 +36,12 @@ struct ProofArgs {
}

fn main() -> io::Result<()> {
env_logger::init();
let cli = Cli::parse();

match &cli.command {
Commands::ProveSp1(args) => {
println!("Proving with SP1, program in: {}", args.guest_path);
info!("proving with sp1, program in: {}", args.guest_path);

utils::prepare_workspace(
&args.guest_path,
Expand All @@ -51,7 +53,7 @@ fn main() -> io::Result<()> {
sp1::prepare_sp1_program()?;
sp1::generate_sp1_proof()?;

println!("Proof and ELF generated!");
info!("sp1 proof and ELF generated");

// Submit to aligned
if let Some(keystore_path) = args.submit_to_aligned_with_keystore.clone() {
Expand All @@ -62,14 +64,14 @@ fn main() -> io::Result<()> {
ProvingSystemId::SP1,
)
.unwrap();
println!("Proof submitted and verified on aligned");
info!("sp1 proof submitted and verified on aligned");
}

Ok(())
}

Commands::ProveRisc0(args) => {
println!("Proving with Risc0, program in: {}", args.guest_path);
info!("proving with risc0, program in: {}", args.guest_path);

utils::prepare_workspace(
&args.guest_path,
Expand All @@ -81,7 +83,7 @@ fn main() -> io::Result<()> {
risc0::prepare_risc0_guest()?;
risc0::generate_risc0_proof()?;

println!("Proof and Proof Image generated!");
info!("risc0 proof and image ID generated");

// Submit to aligned
if let Some(keystore_path) = args.submit_to_aligned_with_keystore.clone() {
Expand All @@ -93,7 +95,7 @@ fn main() -> io::Result<()> {
)
.unwrap();

println!("Proof submitted and verified on aligned");
info!("risc0 proof submitted and verified on aligned");
}

Ok(())
Expand Down

0 comments on commit f4e2233

Please sign in to comment.