Skip to content

Commit

Permalink
[#1793] Rename MSMColumnIndexer to FFAColumnIndexer
Browse files Browse the repository at this point in the history
  • Loading branch information
volhovm committed Mar 5, 2024
1 parent c9d6ebd commit 055d4a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions msm/src/ffa/columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ use crate::LIMBS_NUM;

#[derive(Clone, Copy, Debug, PartialEq)]
/// Column indexer for MSM columns
pub enum MSMColumnIndexer {
pub enum FFAColumnIndexer {
A(usize),
B(usize),
C(usize),
D(usize),
}

impl ColumnIndexer for MSMColumnIndexer {
impl ColumnIndexer for FFAColumnIndexer {
fn ix_to_column(self) -> Column {
let to_column_inner = |offset, i| {
assert!(i < LIMBS_NUM);
Column::X(LIMBS_NUM * offset + i)
};
match self {
MSMColumnIndexer::A(i) => to_column_inner(0, i),
MSMColumnIndexer::B(i) => to_column_inner(1, i),
MSMColumnIndexer::C(i) => to_column_inner(2, i),
MSMColumnIndexer::D(i) => to_column_inner(3, i),
FFAColumnIndexer::A(i) => to_column_inner(0, i),
FFAColumnIndexer::B(i) => to_column_inner(1, i),
FFAColumnIndexer::C(i) => to_column_inner(2, i),
FFAColumnIndexer::D(i) => to_column_inner(3, i),
}
}
}
14 changes: 7 additions & 7 deletions msm/src/ffa/constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use num_bigint::BigUint;
use crate::{
columns::{Column, ColumnIndexer},
expr::MSMExpr,
ffa::columns::MSMColumnIndexer,
ffa::columns::FFAColumnIndexer,
lookups::LookupTableIDs,
proof::ProofInputs,
witness::Witness,
Expand Down Expand Up @@ -86,16 +86,16 @@ impl MSMCircuitEnv<BN254G1Affine> {
let limb_constraint = {
let a_i = MSMExpr::Atom(
ExprInner::<Operations<ConstantExprInner<Fp>>, Column>::Cell(Variable {
col: MSMColumnIndexer::A(i).ix_to_column(),
col: FFAColumnIndexer::A(i).ix_to_column(),
row: CurrOrNext::Curr,
}),
);
let b_i = MSMExpr::Atom(ExprInner::Cell(Variable {
col: MSMColumnIndexer::B(i).ix_to_column(),
col: FFAColumnIndexer::B(i).ix_to_column(),
row: CurrOrNext::Curr,
}));
let c_i = MSMExpr::Atom(ExprInner::Cell(Variable {
col: MSMColumnIndexer::C(i).ix_to_column(),
col: FFAColumnIndexer::C(i).ix_to_column(),
row: CurrOrNext::Curr,
}));
a_i + b_i - c_i
Expand All @@ -112,16 +112,16 @@ impl MSMCircuitEnv<BN254G1Affine> {
let limb_constraint = {
let a_i = MSMExpr::Atom(
ExprInner::<Operations<ConstantExprInner<Fp>>, Column>::Cell(Variable {
col: MSMColumnIndexer::A(i).ix_to_column(),
col: FFAColumnIndexer::A(i).ix_to_column(),
row: CurrOrNext::Curr,
}),
);
let b_i = MSMExpr::Atom(ExprInner::Cell(Variable {
col: MSMColumnIndexer::B(i).ix_to_column(),
col: FFAColumnIndexer::B(i).ix_to_column(),
row: CurrOrNext::Curr,
}));
let d_i = MSMExpr::Atom(ExprInner::Cell(Variable {
col: MSMColumnIndexer::D(i).ix_to_column(),
col: FFAColumnIndexer::D(i).ix_to_column(),
row: CurrOrNext::Curr,
}));
a_i * b_i - d_i
Expand Down

0 comments on commit 055d4a1

Please sign in to comment.