Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger committed Nov 26, 2024
1 parent 48c9aac commit 64ff66e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
9 changes: 4 additions & 5 deletions crates/brainfuck_prover/src/components/instruction/table.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::components::{Claim, Trace, TraceError, TraceEval};
use crate::components::{Claim, TraceError, TraceEval, TraceType};
use brainfuck_vm::{
instruction::VALID_INSTRUCTIONS_BF, machine::ProgramMemory, registers::Registers,
};
Expand Down Expand Up @@ -171,7 +171,7 @@ impl InstructionTable {
let trace = trace.into_iter().map(|col| CircleEvaluation::new(domain, col)).collect();

// Return the evaluated trace and a claim containing the log size of the domain.
Ok((trace, Claim { log_size, trace: Trace::Instruction }))
Ok((trace, Claim { log_size, trace: TraceType::Instruction }))
}
}

Expand Down Expand Up @@ -242,9 +242,8 @@ impl InstructionColumn {

#[cfg(test)]
mod tests {
use crate::components::{Claim, Trace};

use super::*;
use crate::components::{Claim, TraceType};
use brainfuck_vm::{
compiler::Compiler, instruction::InstructionType, test_helper::create_test_machine,
};
Expand Down Expand Up @@ -585,7 +584,7 @@ mod tests {
.collect();

// Create the expected claim.
let expected_claim = Claim { log_size: expected_log_size, trace: Trace::Instruction };
let expected_claim = Claim { log_size: expected_log_size, trace: TraceType::Instruction };

// Assert equality of the claim.
assert_eq!(claim, expected_claim);
Expand Down
11 changes: 5 additions & 6 deletions crates/brainfuck_prover/src/components/io/table.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::components::{Claim, Trace, TraceEval};
use crate::components::{Claim, TraceEval, TraceType};
use brainfuck_vm::{instruction::InstructionType, registers::Registers};
use stwo_prover::core::{
backend::{
Expand Down Expand Up @@ -101,7 +101,7 @@ impl<const N: u32> IOTable<N> {

// It is possible that the table is empty because the program has no input or output.
if n_rows == 0 {
return (TraceEval::new(), Claim { log_size: 0, trace: Trace::Io });
return (TraceEval::new(), Claim { log_size: 0, trace: TraceType::Io });
}

// Compute `log_n_rows`, the base-2 logarithm of the number of rows.
Expand All @@ -126,7 +126,7 @@ impl<const N: u32> IOTable<N> {
let trace = trace.into_iter().map(|col| CircleEvaluation::new(domain, col)).collect();

// Return the evaluated trace and a claim containing the log size of the domain.
(trace, Claim { log_size, trace: Trace::Io })
(trace, Claim { log_size, trace: TraceType::Io })
}
}

Expand Down Expand Up @@ -181,9 +181,8 @@ impl IoColumn {

#[cfg(test)]
mod tests {
use crate::components::Trace;

use super::*;
use crate::components::TraceType;
use num_traits::One;

type TestIOTable = IOTable<10>;
Expand Down Expand Up @@ -352,7 +351,7 @@ mod tests {
expected_columns.into_iter().map(|col| CircleEvaluation::new(domain, col)).collect();

// Create the expected claim.
let expected_claim = Claim { log_size: expected_log_size, trace: Trace::Io };
let expected_claim = Claim { log_size: expected_log_size, trace: TraceType::Io };

// Assert equality of the claim.
assert_eq!(claim, expected_claim, "The claim should match the expected claim.");
Expand Down
9 changes: 4 additions & 5 deletions crates/brainfuck_prover/src/components/memory/table.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::components::{Claim, Trace, TraceError, TraceEval};
use crate::components::{Claim, TraceError, TraceEval, TraceType};
use brainfuck_vm::registers::Registers;
use num_traits::One;
use stwo_prover::core::{
Expand Down Expand Up @@ -217,7 +217,7 @@ impl MemoryTable {
let trace = trace.into_iter().map(|col| CircleEvaluation::new(domain, col)).collect();

// TODO: Confirm that the log_size in `Claim` is `log_size`, including the SIMD lanes
Ok((trace, Claim { log_size, trace: Trace::Memory }))
Ok((trace, Claim { log_size, trace: TraceType::Memory }))
}
}

Expand Down Expand Up @@ -268,9 +268,8 @@ impl MemoryColumn {

#[cfg(test)]
mod tests {
use crate::components::Trace;

use super::*;
use crate::components::TraceType;
use num_traits::Zero;

#[test]
Expand Down Expand Up @@ -486,7 +485,7 @@ mod tests {
.into_iter()
.map(|col| CircleEvaluation::new(domain, col))
.collect();
let expected_claim = Claim { log_size: expected_log_size, trace: Trace::Memory };
let expected_claim = Claim { log_size: expected_log_size, trace: TraceType::Memory };

assert_eq!(claim, expected_claim);
for col_index in 0..expected_trace.len() {
Expand Down
6 changes: 3 additions & 3 deletions crates/brainfuck_prover/src/components/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub enum TraceError {

/// Represents the different trace types used in the Brainfuck STARK proving system.
#[derive(Debug, Eq, PartialEq)]
pub enum Trace {
pub enum TraceType {
/// Memory access trace.
Memory,
/// Instruction execution trace.
Expand All @@ -40,7 +40,7 @@ pub enum Trace {
Processor,
}

impl Trace {
impl TraceType {
/// Returns the number of columns associated with the specific trace type.
pub fn column_count(&self) -> usize {
match self {
Expand All @@ -58,7 +58,7 @@ pub struct Claim {
/// Logarithmic size (`log2`) of the evaluated trace.
pub log_size: u32,
/// Type of the associated trace.
pub trace: Trace,
pub trace: TraceType,
}

impl Claim {
Expand Down

0 comments on commit 64ff66e

Please sign in to comment.