Skip to content

Commit

Permalink
Print component information
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharsamocha7 committed Oct 7, 2024
1 parent bb0cce2 commit 07e3e26
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
31 changes: 31 additions & 0 deletions crates/prover/src/constraint_framework/component.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::borrow::Cow;
use std::fmt::{self, Display, Formatter};
use std::iter::zip;
use std::ops::Deref;

Expand Down Expand Up @@ -264,3 +265,33 @@ impl<E: FrameworkEval> Deref for FrameworkComponent<E> {
&self.eval
}
}

impl<E: FrameworkEval> Display for FrameworkComponent<E> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
let log_n_rows = self.log_size();
let mut n_cols = vec![];
self.trace_log_degree_bounds()
.0
.iter()
.for_each(|interaction| {
n_cols.push(interaction.len());
});
writeln!(f, "n_rows 2^{}", log_n_rows)?;
writeln!(f, "n_constraints {}", self.n_constraints())?;
writeln!(
f,
"constraint_log_degree_bound {}",
self.max_constraint_log_degree_bound()
)?;
writeln!(f, "total felts: 2^{} * {}", log_n_rows, n_cols.iter().sum::<usize>())?;
for (j, n_cols) in n_cols.into_iter().enumerate() {
writeln!(
f,
"\t Interaction {}: n_cols {}",
j,
n_cols
)?;
}
Ok(())
}
}
3 changes: 2 additions & 1 deletion crates/prover/src/examples/poseidon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::ops::{Add, AddAssign, Mul, Sub};

use itertools::Itertools;
use tracing::{span, Level};
use tracing::{info, span, Level};

use crate::constraint_framework::constant_columns::gen_is_first;
use crate::constraint_framework::logup::{LogupAtRow, LogupTraceGenerator, LookupElements};
Expand Down Expand Up @@ -386,6 +386,7 @@ pub fn prove_poseidon(
total_sum,
},
);
info!("Poseidon component info:\n{}", component);
let proof = prove(&[&component], channel, commitment_scheme).unwrap();

(component, proof)
Expand Down

0 comments on commit 07e3e26

Please sign in to comment.