diff --git a/executor/src/witgen/machines/block_machine.rs b/executor/src/witgen/machines/block_machine.rs index f346fc858..dc0afb90a 100644 --- a/executor/src/witgen/machines/block_machine.rs +++ b/executor/src/witgen/machines/block_machine.rs @@ -167,24 +167,20 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> { fixed_data: &FixedData, fixed_lookup: &mut FixedLookup, ) -> HashMap> { + if self.data.len() < 2 * self.block_size { + log::warn!( + "Filling empty blocks with zeros, because the block machine is never used. \ + This might violate some internal constraints." + ); + } let mut data = transpose_rows(std::mem::take(&mut self.data), &self.witness_cols) .into_iter() .map(|(id, mut values)| { - // For all constraints to be satisfied, unused cells have to be filled with valid values. // We do this, we construct a default block, by repeating the first input to the block machine. - - if values.len() < 2 * self.block_size { - log::warn!("Filling empty blocks with zeros, because the block machine is never used. \ - This might violate some internal constraints."); - } - values.resize(fixed_data.degree as usize, None); - let second_block_values = values - .iter() - .skip(self.block_size) - .take(self.block_size); + let second_block_values = values.iter().skip(self.block_size).take(self.block_size); // The first block is a dummy block (filled mostly with None), the second block is the first block // resulting of an actual evaluation. @@ -193,8 +189,14 @@ impl<'a, T: FieldElement> Machine<'a, T> for BlockMachine<'a, T> { // As a result, the default block consists of values of the first block if they are set, otherwise // the values of the second block. // TODO: Determine the row-extend per column - let default_block = values.iter().take(self.block_size).zip(second_block_values).map( - |(first_block, second_block)| first_block.or(*second_block).unwrap_or_default()).collect::>(); + let default_block = values + .iter() + .take(self.block_size) + .zip(second_block_values) + .map(|(first_block, second_block)| { + first_block.or(*second_block).unwrap_or_default() + }) + .collect::>(); let values = values .into_iter() diff --git a/executor/src/witgen/processor.rs b/executor/src/witgen/processor.rs index 36e913a41..d1f63dd89 100644 --- a/executor/src/witgen/processor.rs +++ b/executor/src/witgen/processor.rs @@ -92,10 +92,11 @@ impl<'a, T: FieldElement> Processor<'a, T> { let mut progress = false; for identity in &self.identities { // Create row pair + let global_row_index = self.row_offset + i as u64; let row_pair = RowPair::new( &self.data[i], &self.data[i + 1], - self.row_offset + i as u64, + global_row_index, self.fixed_data, UnknownStrategy::Unknown, ); @@ -106,6 +107,18 @@ impl<'a, T: FieldElement> Processor<'a, T> { .process_identity(identity, &row_pair) .map_err(|e| { log::warn!("Error in identity: {identity}"); + log::warn!( + "Known values in current row (local: {i}, global {global_row_index}):\n{}", + self.data[i].render_values(false), + ); + if identity.contains_next_ref() { + log::warn!( + "Known values in next row (local: {}, global {}):\n{}", + i + 1, + global_row_index + 1, + self.data[i + 1].render_values(false), + ); + } e })?;