Skip to content

Commit

Permalink
fix: remove duplicate constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
shuklaayush committed Feb 18, 2024
1 parent d0bc5ec commit 5795f41
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions evm_arithmetization/src/keccak/keccak_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,10 @@ impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for KeccakStark<F
let local_values = vars.get_local_values();
let next_values = vars.get_next_values();

// The filter must be 0 or 1.
let filter = local_values[reg_step(NUM_ROUNDS - 1)];
yield_constr.constraint(filter * (filter - P::ONES));

// If this is not the final step, the filter must be off.
let final_step = local_values[reg_step(NUM_ROUNDS - 1)];
let not_final_step = P::ONES - final_step;
yield_constr.constraint(not_final_step * filter);
yield_constr.constraint(not_final_step * final_step);

// If this is not the final step or a padding row,
// the local and next timestamps must match.
Expand Down Expand Up @@ -446,15 +442,10 @@ impl<F: RichField + Extendable<D>, const D: usize> Stark<F, D> for KeccakStark<F
let local_values = vars.get_local_values();
let next_values = vars.get_next_values();

// The filter must be 0 or 1.
let filter = local_values[reg_step(NUM_ROUNDS - 1)];
let constraint = builder.mul_sub_extension(filter, filter, filter);
yield_constr.constraint(builder, constraint);

// If this is not the final step, the filter must be off.
let final_step = local_values[reg_step(NUM_ROUNDS - 1)];
let not_final_step = builder.sub_extension(one_ext, final_step);
let constraint = builder.mul_extension(not_final_step, filter);
let constraint = builder.mul_extension(not_final_step, final_step);
yield_constr.constraint(builder, constraint);

// If this is not the final step or a padding row,
Expand Down

0 comments on commit 5795f41

Please sign in to comment.