Skip to content

Commit f56b29e

Browse files
committed
Fix ECDAS padding and gate R·P term with μ
1 parent 8eca0e7 commit f56b29e

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

prover/src/tables/ecdas.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,10 @@ pub fn generate_ecdas_trace(
133133
table.set_fe(row_idx, cols::MU, FE::one());
134134
}
135135

136-
// Padding rows: q0 = q1 = q2 = r, op = 0, everything else 0. This makes every
137-
// (unconditional) convolution relation hold with zero carries.
136+
// Padding rows: q0 = q1 = q2 = 0, op = 1 (add), everything else 0. The μ-gated R·P
137+
// term vanishes (μ=0), so all convolution relations hold with zero carries.
138138
for row_idx in n..num_rows {
139-
table.set_bytes(row_idx, cols::Q0, &R_BYTES);
140-
table.set_bytes(row_idx, cols::Q1, &R_BYTES);
141-
table.set_bytes(row_idx, cols::Q2, &R_BYTES);
139+
table.set_byte(row_idx, cols::OP, 1);
142140
}
143141

144142
trace
@@ -313,15 +311,20 @@ impl ConvCarry {
313311
let xr = |j: usize| b(cols::XR, 32, j);
314312
let yr = |j: usize| b(cols::YR, 32, j);
315313
let op = col(cols::OP);
314+
let mu = col(cols::MU);
316315
let one = FieldElement::<F>::one();
317316

318-
// r·P − q·P convolution (shared structure across all three relations).
317+
// μ·R·P − q·P convolution (shared structure across all three relations).
318+
// R and P are constants, so μ·R·P is degree 1. The μ-gate makes the term
319+
// vanish on padding rows (μ=0, q=0), keeping all relations at zero carries.
319320
let rq = |qbase: usize| -> FieldElement<F> {
320-
let mut s = FieldElement::<F>::zero();
321+
let mut r_p = FieldElement::<F>::zero();
322+
let mut q_p = FieldElement::<F>::zero();
321323
for j in 0..=i {
322-
s += (r_byte::<F>(j) - b(qbase, 33, j)) * p_byte::<F>(i - j);
324+
r_p += r_byte::<F>(j) * p_byte::<F>(i - j);
325+
q_p += b(qbase, 33, j) * p_byte::<F>(i - j);
323326
}
324-
s
327+
mu.clone() * r_p - q_p
325328
};
326329

327330
match self.relation {

0 commit comments

Comments
 (0)