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

Simplify debugging #49

Merged
merged 1 commit into from
Dec 12, 2023
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
15 changes: 1 addition & 14 deletions starky/src/constraint_consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ use alloc::vec;
use alloc::vec::Vec;
use core::marker::PhantomData;

#[cfg(std)]
use backtrace::Backtrace;
use plonky2::field::extension::Extendable;
use plonky2::field::packed::PackedField;
use plonky2::field::types::Field;
Expand Down Expand Up @@ -33,7 +31,7 @@ pub struct ConstraintConsumer<P: PackedField> {
lagrange_basis_last: P,

/// debug constraints
debug_api: bool,
pub debug_api: bool,
}

impl<P: PackedField> ConstraintConsumer<P> {
Expand Down Expand Up @@ -65,17 +63,7 @@ impl<P: PackedField> ConstraintConsumer<P> {
}

/// Add one constraint on all rows.
#[allow(clippy::collapsible_if)]
pub fn constraint(&mut self, constraint: P) {
#[cfg(std)]
if std::intrinsics::unlikely(self.debug_api) {
if !constraint.is_zeros() {
println!(
"ConstraintConsumer - DEBUG trace (non-zero-constraint): {:?}",
Backtrace::new()
);
}
}
for (&alpha, acc) in self.alphas.iter().zip(&mut self.constraint_accs) {
*acc *= alpha;
*acc += constraint;
Expand Down Expand Up @@ -111,7 +99,6 @@ impl<P: PackedField> ConstraintConsumer<P> {
}

pub fn debug_api_has_constraint_failed(&self) -> bool {
assert!(self.debug_api);
!self.constraint_accs.iter().all(|e| e.is_zeros())
}
}
Expand Down
2 changes: 1 addition & 1 deletion starky/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![cfg_attr(not(feature = "std"), no_std)]
#![feature(core_intrinsics)]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new line here is to minimize the diff to upstream.

extern crate alloc;

mod get_challenges;
Expand Down
Loading