From 49bbe4e084aa8e6fec1f0a55cc33404996861aa4 Mon Sep 17 00:00:00 2001 From: Robin Salen <30937548+Nashtare@users.noreply.github.com> Date: Fri, 2 Jun 2023 18:51:21 +0200 Subject: [PATCH] Fix arithmetic stark padding (#1069) --- evm/src/arithmetic/arithmetic_stark.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/evm/src/arithmetic/arithmetic_stark.rs b/evm/src/arithmetic/arithmetic_stark.rs index 4fcbb534..4695798a 100644 --- a/evm/src/arithmetic/arithmetic_stark.rs +++ b/evm/src/arithmetic/arithmetic_stark.rs @@ -138,8 +138,10 @@ impl ArithmeticStark { } // Pad the trace with zero rows if it doesn't have enough rows - // to accommodate the range check columns. - for _ in trace_rows.len()..RANGE_MAX { + // to accommodate the range check columns. Also make sure the + // trace length is a power of two. + let padded_len = trace_rows.len().next_power_of_two(); + for _ in trace_rows.len()..std::cmp::max(padded_len, RANGE_MAX) { trace_rows.push(vec![F::ZERO; columns::NUM_ARITH_COLUMNS]); }