@@ -223,11 +223,16 @@ where
223
223
224
224
/// Creates remainder polynomial in coefficient form from a vector of `evaluations` over a
225
225
/// domain.
226
+ ///
227
+ /// We commit to the coefficients of the remainder polynomial in reverse order so that
228
+ /// evaluating the remainder polynomial on the verifier's end, using Horner's evaluation
229
+ /// method, becomes easier.
226
230
fn set_remainder ( & mut self , channel : & mut C , evaluations : & mut [ E ] ) {
227
231
let inv_twiddles = fft:: get_inv_twiddles ( evaluations. len ( ) ) ;
228
232
fft:: interpolate_poly_with_offset ( evaluations, & inv_twiddles, self . options . domain_offset ( ) ) ;
229
233
let remainder_poly_size = evaluations. len ( ) / self . options . blowup_factor ( ) ;
230
- let remainder_poly = evaluations[ ..remainder_poly_size] . to_vec ( ) ;
234
+ let remainder_poly: Vec < _ > =
235
+ evaluations[ ..remainder_poly_size] . iter ( ) . copied ( ) . rev ( ) . collect ( ) ;
231
236
let commitment = <H as ElementHasher >:: hash_elements ( & remainder_poly) ;
232
237
channel. commit_fri_layer ( commitment) ;
233
238
self . remainder_poly = FriRemainder ( remainder_poly) ;
@@ -240,7 +245,9 @@ where
240
245
/// For each of the provided `positions`, corresponding evaluations from each of the layers
241
246
/// (excluding the remainder layer) are recorded into the proof together with a batch opening
242
247
/// proof against the sent vector commitment. For the remainder, we send the whole remainder
243
- /// polynomial resulting from interpolating the remainder layer evaluations.
248
+ /// polynomial resulting from interpolating the remainder layer evaluations. The coefficients
249
+ /// of the remainder polynomial are sent in reverse order so as to make evaluating it on
250
+ /// the verifier's end, using Horner's evaluation method, easier.
244
251
///
245
252
/// # Panics
246
253
/// Panics is the prover state is clean (no FRI layers have been build yet).
0 commit comments