Skip to content

Commit a8d081c

Browse files
committed
fix(bb): pad gemini_masking_poly size to even to avoid sumcheck OOB
1 parent ce9fef6 commit a8d081c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

barretenberg/cpp/src/barretenberg/ultra_honk/oink_prover.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,11 @@ template <typename Flavor> void OinkProver<Flavor>::commit_to_z_perm()
186186
template <typename Flavor> void OinkProver<Flavor>::commit_to_masking_poly()
187187
{
188188
if constexpr (flavor_has_gemini_masking<Flavor>()) {
189-
// Gemini masking poly only needs to cover the actual polynomial extent, not full dyadic size
190-
const size_t polynomial_size = prover_instance->polynomials.max_end_index();
189+
// Gemini masking poly only needs to cover the actual polynomial extent, not full dyadic size.
190+
// Round up to even so sumcheck's pairwise (edge_idx, edge_idx + 1) iteration over the effective
191+
// round size — which itself rounds max_end_index up to even — stays in bounds.
192+
const size_t max_end_index = prover_instance->polynomials.max_end_index();
193+
const size_t polynomial_size = max_end_index + (max_end_index % 2);
191194
prover_instance->polynomials.gemini_masking_poly = Polynomial<FF>::random(polynomial_size);
192195

193196
// Commit to the masking polynomial and send to transcript

0 commit comments

Comments
 (0)