Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crypto/stark/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ impl std::fmt::Debug for TableMmapBacking {
)]
#[serde(bound = "")]
pub struct Table<F: IsField> {
pub data: Vec<FieldElement<F>>,
/// Row-major backing store. Crate-private: external callers must go through
/// the spill-safe accessors (`get`/`get_row`/`set`) rather than indexing the
/// raw buffer, which bypasses the disk-spill mmap backing.
pub(crate) data: Vec<FieldElement<F>>,
pub width: usize,
pub height: usize,
#[cfg(feature = "disk-spill")]
Expand Down
3 changes: 1 addition & 2 deletions prover/src/tables/keccak_rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ pub fn update_multiplicities(
) {
let mu = FieldElement::from(num_keccak_ops as u64);
for round in 0..NUM_REAL_ROWS {
let base = round * cols::NUM_COLUMNS;
trace.main_table.data[base + cols::MU] = mu;
trace.set_main(round, cols::MU, mu);
}
}

Expand Down
4 changes: 1 addition & 3 deletions prover/src/tests/branch_bus_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,8 @@ fn test_padding_rows_have_zero_multiplicity() {
let trace = generate_branch_trace(&ops);

// Check that padding rows have mu = 0
let data = &trace.main_table.data;
for row_idx in 1..4 {
let base = row_idx * cols::NUM_COLUMNS;
assert_eq!(data[base + cols::MU], FE::zero());
assert_eq!(*trace.get_main(row_idx, cols::MU), FE::zero());
}
}

Expand Down
4 changes: 1 addition & 3 deletions prover/src/tests/keccak_rnd_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ fn test_pi_virtual_matches_rotate() {
output,
};
let trace = generate_keccak_rnd_trace(&[op]);
let base = 0;

// Recompute theta for round 0 in u64 to compare against virtual pi.
let mut c = [0u64; 5];
Expand All @@ -46,8 +45,7 @@ fn test_pi_virtual_matches_rotate() {
let rotated = theta_lanes[sx + 5 * sy].rotate_left(KECCAK_RHO[sx][sy]);
for z in 0..8 {
let (l_col, r_col) = cols::pi_src_cols(x, y, z);
let virtual_pi =
trace.main_table.data[base + l_col] + trace.main_table.data[base + r_col];
let virtual_pi = *trace.get_main(0, l_col) + *trace.get_main(0, r_col);
let expected = FE::from((rotated >> (z * 8)) & 0xFF);
assert_eq!(
virtual_pi, expected,
Expand Down
14 changes: 6 additions & 8 deletions prover/src/tests/trace_builder_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ mod keccak_tests {
}
ref_state[0] ^= rc;

let base = round * rnd_cols::NUM_COLUMNS;
for (lane, &lane_val) in ref_state.iter().enumerate() {
let x = lane % 5;
let y = lane / 5;
Expand All @@ -681,7 +680,7 @@ mod keccak_tests {
} else {
rnd_cols::chi(x, y, byte_idx)
};
let trace_val = &rnd_trace.main_table.data[base + col];
let trace_val = rnd_trace.get_main(round, col);
assert_eq!(
&expected, trace_val,
"Round {round} lane ({x},{y}) byte {byte_idx}"
Expand All @@ -701,23 +700,22 @@ mod keccak_tests {
for x in 0..5 {
for y in 0..5 {
for b in 0..8 {
let core_val = &core_trace.main_table.data[core_cols::input_state(x, y, b)];
let rnd_val = &rnd_trace.main_table.data[rnd_cols::start(x, y, b)];
let core_val = core_trace.get_main(0, core_cols::input_state(x, y, b));
let rnd_val = rnd_trace.get_main(0, rnd_cols::start(x, y, b));
assert_eq!(core_val, rnd_val, "Round 0 start mismatch at ({x},{y},{b})");
}
}
}

// Round 23 out == core output_state
let rnd_base_23 = 23 * rnd_cols::NUM_COLUMNS;
for x in 0..5 {
for y in 0..5 {
for b in 0..8 {
let core_val = &core_trace.main_table.data[core_cols::output_state(x, y, b)];
let core_val = core_trace.get_main(0, core_cols::output_state(x, y, b));
let rnd_val = if x == 0 && y == 0 {
&rnd_trace.main_table.data[rnd_base_23 + rnd_cols::iota(b)]
rnd_trace.get_main(23, rnd_cols::iota(b))
} else {
&rnd_trace.main_table.data[rnd_base_23 + rnd_cols::chi(x, y, b)]
rnd_trace.get_main(23, rnd_cols::chi(x, y, b))
};
assert_eq!(core_val, rnd_val, "Round 23 out mismatch at ({x},{y},{b})");
}
Expand Down
Loading