Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.
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
30 changes: 30 additions & 0 deletions gadgets/src/mul_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,36 @@ impl<F: Field> MulAddChip<F> {

Ok(())
}

/// Returns the list of ALL the gadget advice columns.
fn advice_columns(&self) -> Vec<Column<Advice>> {
vec![
self.config.col0,
self.config.col1,
self.config.col2,
self.config.col3,
self.config.col4,
]
}

/// Returns the String annotations associated to each column of the gadget.
pub fn annotations(&self) -> Vec<String> {
vec![
String::from("col0"),
String::from("col1"),
String::from("col2"),
String::from("col3"),
String::from("col4"),
]
}

/// Annotates columns of this gadget embedded within a circuit region.
pub fn annotate_columns_in_region(&self, region: &mut Region<F>, prefix: &str) {
self.advice_columns()
.iter()
.zip(self.annotations().iter())
.for_each(|(&col, ann)| region.name_column(|| format!("{}_{}", prefix, ann), col))
}
}

#[cfg(test)]
Expand Down
6 changes: 6 additions & 0 deletions zkevm-circuits/src/exp_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,8 @@ impl<F: Field> SubCircuitConfig<F> for ExpCircuitConfig<F> {
]))
});

exp_table.annotate_columns(meta);

Self {
q_usable,
exp_table,
Expand Down Expand Up @@ -305,6 +307,10 @@ impl<F: Field> ExpCircuitConfig<F> {
layouter.assign_region(
|| "exponentiation circuit",
|mut region| {
mul_chip.annotate_columns_in_region(&mut region, "EXP_mul");
parity_check_chip.annotate_columns_in_region(&mut region, "EXP_parity_check");
self.exp_table.annotate_columns_in_region(&mut region);

let mut offset = 0;
for exp_event in exp_events.iter() {
self.assign_exp_event(
Expand Down