Skip to content

Commit

Permalink
patch: include more fields to transcript (#351)
Browse files Browse the repository at this point in the history
* patch: add multi-phase related challenge fields within transcript

* chore: fix the "plonk_api" test

* patch: add the Debug attribute
  • Loading branch information
guorong009 authored Jun 7, 2024
1 parent d52ebca commit e86b7f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 27 deletions.
29 changes: 2 additions & 27 deletions halo2_backend/src/plonk/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ impl<'a, F: Field> std::fmt::Debug for PinnedGates<'a, F> {
}

/// Represents the minimal parameters that determine a `ConstraintSystem`.
#[allow(dead_code)]
#[derive(Debug)]
pub(crate) struct PinnedConstraintSystem<'a, F: Field> {
num_fixed_columns: &'a usize,
num_advice_columns: &'a usize,
Expand All @@ -255,33 +257,6 @@ pub(crate) struct PinnedConstraintSystem<'a, F: Field> {
minimum_degree: &'a Option<usize>,
}

impl<'a, F: Field> std::fmt::Debug for PinnedConstraintSystem<'a, F> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut debug_struct = f.debug_struct("PinnedConstraintSystem");
debug_struct
.field("num_fixed_columns", self.num_fixed_columns)
.field("num_advice_columns", self.num_advice_columns)
.field("num_instance_columns", self.num_instance_columns);
// Only show multi-phase related fields if it's used.
if *self.num_challenges > 0 {
debug_struct
.field("num_challenges", self.num_challenges)
.field("advice_column_phase", self.advice_column_phase)
.field("challenge_phase", self.challenge_phase);
}
debug_struct
.field("gates", &self.gates)
.field("advice_queries", self.advice_queries)
.field("instance_queries", self.instance_queries)
.field("fixed_queries", self.fixed_queries)
.field("permutation", self.permutation)
.field("lookups", self.lookups)
.field("shuffles", self.shuffles)
.field("minimum_degree", self.minimum_degree);
debug_struct.finish()
}
}

// Cost functions: arguments required degree

/// Returns the minimum circuit degree required by the permutation argument.
Expand Down
9 changes: 9 additions & 0 deletions halo2_proofs/tests/plonk_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,15 @@ fn plonk_api() {
num_fixed_columns: 7,
num_advice_columns: 5,
num_instance_columns: 1,
num_challenges: 0,
advice_column_phase: [
0,
0,
0,
0,
0,
],
challenge_phase: [],
gates: [
Sum(
Sum(
Expand Down

0 comments on commit e86b7f7

Please sign in to comment.