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

fix: remove setup on first row constraint #1235

Merged
merged 1 commit into from
Jan 18, 2025
Merged
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
7 changes: 6 additions & 1 deletion crates/circuits/mod-builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,12 @@ impl<AB: InteractionBuilder> SubAir<AB> for FieldExpr {
if self.builder.needs_setup() {
let is_setup = flags.iter().fold(is_valid.into(), |acc, &x| acc - x);
builder.assert_bool(is_setup.clone());
builder.when_first_row().assert_one(is_setup.clone());
// TODO[jpw]: currently we enforce at the program code level that:
// - a valid program must call the correct setup opcodes to be correct
// - it would be better if we can constraint this in the circuit,
// however this has the challenge that when the same chip is used
// across continuation segments,
// only the first segment will have setup called
for i in 0..inputs[0].len().max(self.builder.prime_limbs.len()) {
let lhs = if i < inputs[0].len() {
inputs[0][i].into()
Expand Down