Skip to content

Commit

Permalink
enable debug logging (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
sixbigsquare authored Jul 21, 2024
1 parent aa53af0 commit 9de29c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ halo2curves.workspace = true
warp = "0.3.7"
tokio = { version = "1.38.0", features = ["full"] }
bytes = "1.6.0"
env_logger = "0.11.3"

[[bin]]
name = "expander-exec"
Expand All @@ -43,4 +44,4 @@ log = "0.4"
rand = "0.8.5"
rayon = "1.10"
sha2 = "0.10.8"
tynm = { version = "0.1.6", default-features = false }
tynm = { version = "0.1.6", default-features = false }
5 changes: 4 additions & 1 deletion src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use arith::{Field, FieldSerde, VectorizedField, VectorizedFr, VectorizedM31};
use expander_rs::{
Circuit, Config, FieldType, Proof, Prover, Verifier, SENTINEL_BN254, SENTINEL_M31,
};
use log::debug;
use log::{debug, info};
use warp::Filter;

fn dump_proof_and_claimed_v<F: Field + FieldSerde>(proof: &Proof, claimed_v: &[F]) -> Vec<u8> {
Expand Down Expand Up @@ -117,6 +117,7 @@ where
warp::path("prove")
.and(warp::body::bytes())
.map(move |bytes: bytes::Bytes| {
info!("Received prove request.");
let witness_bytes: Vec<u8> = bytes.to_vec();
let mut circuit = circuit.lock().unwrap();
let mut prover = prover.lock().unwrap();
Expand All @@ -129,6 +130,7 @@ where
warp::path("verify")
.and(warp::body::bytes())
.map(move |bytes: bytes::Bytes| {
info!("Received verify request.");
let witness_and_proof_bytes: Vec<u8> = bytes.to_vec();
let length_of_witness_bytes =
u64::from_le_bytes(witness_and_proof_bytes[0..8].try_into().unwrap())
Expand Down Expand Up @@ -167,6 +169,7 @@ async fn main() {
// expander-exec prove <input:circuit_file> <input:witness_file> <output:proof>
// expander-exec verify <input:circuit_file> <input:witness_file> <input:proof>
// expander-exec serve <input:circuit_file> <input:ip> <input:port>
env_logger::init();
let args = std::env::args().collect::<Vec<String>>();
if args.len() < 4 {
println!(
Expand Down
4 changes: 2 additions & 2 deletions src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ impl Verifier {
let v1 = commitment.verify(&rz0[i], claimed_v0[i]);
let v2 = commitment.verify(&rz1[i], claimed_v1[i]);

log::info!("first commitment verification: {}", v1);
log::info!("second commitment verification: {}", v2);
log::debug!("first commitment verification: {}", v1);
log::debug!("second commitment verification: {}", v2);

verified &= v1;
verified &= v2;
Expand Down

0 comments on commit 9de29c7

Please sign in to comment.