Skip to content

Commit 31c47d4

Browse files
committed
Verify the value of u in the CircuitStatement logup sum.
1 parent b6a0165 commit 31c47d4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

crates/circuit_verifier/src/statement.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use stwo_constraint_framework::preprocessed_columns::PreProcessedColumnId;
2424

2525
// TODO(ilya): Update this to the correct values.
2626
pub const INTERACTION_POW_BITS: u32 = 20;
27+
pub const U_ADDRESS: usize = 2;
2728

2829
pub struct CircuitStatement<Value: IValue> {
2930
pub components: IndexMap<&'static str, Box<dyn CircuitEval<Value>>>,
@@ -80,14 +81,19 @@ impl<Value: IValue> Statement<Value> for CircuitStatement<Value> {
8081
interaction_elements: [Var; 2],
8182
) -> Var {
8283
let mut sum = context.zero();
84+
let zero = context.zero();
85+
let one = context.one();
8386

8487
// Output gates public logup sum contribution.
8588
let gate_relation_id = context.constant(GATE_RELATION_ID.into());
8689
for (output_address, output_value) in zip_eq(&self.output_addresses, &self.output_values) {
87-
let [output_value_0, output_value_1, output_value_2, output_value_3] =
90+
let [output_value_0, output_value_1, output_value_2, output_value_3] = if output_address.get().idx == U_ADDRESS {
91+
[zero, zero, one, zero]
92+
} else {
8893
Simd::unpack(context, &Simd::from_packed(vec![*output_value], 4))
8994
.try_into()
90-
.unwrap();
95+
.unwrap()
96+
};
9197
let term = logup_use_term(
9298
context,
9399
&[

0 commit comments

Comments
 (0)