Skip to content

Commit

Permalink
fix LEM's Func::num_constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurpaulino committed Oct 21, 2023
1 parent 4f19d4b commit fc90ebd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/lem/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ use crate::{
},
coprocessor::Coprocessor,
eval::lang::Lang,
field::{FWrap, LurkField},
field::{FWrap, LanguageField, LurkField},
tag::ExprTag::{Comm, Num, Sym},
};

Expand Down Expand Up @@ -1485,12 +1485,19 @@ impl Func {
}
}
let globals = &mut HashSet::default();
let bit_decomp_cost = match F::FIELD {
LanguageField::Pallas => 298,

Check warning on line 1489 in src/lem/circuit.rs

View check run for this annotation

Codecov / codecov/patch

src/lem/circuit.rs#L1488-L1489

Added lines #L1488 - L1489 were not covered by tests
LanguageField::Vesta => 301,
LanguageField::BLS12_381 => 388,
_ => todo!(),
};

Check warning on line 1494 in src/lem/circuit.rs

View check run for this annotation

Codecov / codecov/patch

src/lem/circuit.rs#L1493-L1494

Added lines #L1493 - L1494 were not covered by tests
// fixed cost for each slot
let slot_constraints = 289 * self.slot.hash4
+ 337 * self.slot.hash6
+ 388 * self.slot.hash8
+ 265 * self.slot.commitment
+ 388 * self.slot.bit_decomp;
+ bit_decomp_cost * self.slot.bit_decomp;

Check warning on line 1500 in src/lem/circuit.rs

View check run for this annotation

Codecov / codecov/patch

src/lem/circuit.rs#L1500

Added line #L1500 was not covered by tests
let num_constraints = recurse(&self.body, globals, store, false);
slot_constraints + num_constraints + globals.len()
}
Expand Down

0 comments on commit fc90ebd

Please sign in to comment.