Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print component information #859

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading