@@ -174,8 +174,6 @@ where
174174 for _ in 0 ..folding_factor {
175175 let sumcheck_poly = self . compute_sumcheck_polynomial ( ) ;
176176 prover_state. add_scalars ( sumcheck_poly. evaluations ( ) ) ?;
177- let [ folding_randomness] = prover_state. challenge_scalars ( ) ?;
178- res. push ( folding_randomness) ;
179177
180178 // Do PoW if needed
181179 if pow_bits > 0. {
@@ -184,6 +182,9 @@ where
184182 prover_state. challenge_pow :: < S > ( pow_bits) ?;
185183 }
186184
185+ let [ folding_randomness] = prover_state. challenge_scalars ( ) ?;
186+ res. push ( folding_randomness) ;
187+
187188 self . compress ( F :: ONE , & folding_randomness. into ( ) , & sumcheck_poly) ;
188189 }
189190
@@ -1179,12 +1180,12 @@ mod tests {
11791180 // Absorb 3 field elements (evaluations of sumcheck polynomial)
11801181 domsep = <DomainSeparator as FieldDomainSeparator < F > >:: add_scalars ( domsep, 3 , "tag" ) ;
11811182
1183+ // Apply optional PoW grinding to ensure randomness
1184+ domsep = domsep. challenge_pow ( "tag" ) ;
1185+
11821186 // Sample 1 challenge scalar from the Fiat-Shamir transcript
11831187 domsep =
11841188 <DomainSeparator as FieldDomainSeparator < F > >:: challenge_scalars ( domsep, 1 , "tag" ) ;
1185-
1186- // Apply optional PoW grinding to ensure randomness
1187- domsep = domsep. challenge_pow ( "tag" ) ;
11881189 }
11891190
11901191 // Convert the domain separator to a prover state
@@ -1230,12 +1231,12 @@ mod tests {
12301231 // Absorb 3 field values (sumcheck evaluations at X = 0, 1, 2)
12311232 domsep = <DomainSeparator as FieldDomainSeparator < F > >:: add_scalars ( domsep, 3 , "tag" ) ;
12321233
1234+ // Apply challenge PoW (grinding) to enhance soundness
1235+ domsep = domsep. challenge_pow ( "tag" ) ;
1236+
12331237 // Sample 1 field challenge (folding randomness)
12341238 domsep =
12351239 <DomainSeparator as FieldDomainSeparator < F > >:: challenge_scalars ( domsep, 1 , "tag" ) ;
1236-
1237- // Apply challenge PoW (grinding) to enhance soundness
1238- domsep = domsep. challenge_pow ( "tag" ) ;
12391240 }
12401241
12411242 // Convert the domain separator to a prover state
0 commit comments