Skip to content

Commit

Permalink
fix small segment
Browse files Browse the repository at this point in the history
  • Loading branch information
zkmod committed Jun 7, 2024
1 parent fe386d7 commit 213b1b6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
6 changes: 3 additions & 3 deletions examples/zkmips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ use zkm::verifier::verify_proof;

const DEGREE_BITS_RANGE: [[std::ops::Range<usize>; 6]; 5] = [
[10..21, 10..15, 10..18, 8..15, 10..21, 15..23],
[10..21, 12..22, 13..21, 8..21, 10..21, 13..23],
[10..21, 12..22, 13..21, 8..21, 10..21, 13..23],
[10..21, 12..22, 13..21, 8..21, 10..21, 13..23],
[10..21, 12..22, 13..21, 8..21, 6..21, 13..23],
[10..21, 12..22, 12..21, 8..21, 10..21, 13..23],
[10..21, 12..22, 13..21, 8..21, 8..21, 13..23],
[10..21, 12..22, 13..21, 8..21, 10..21, 13..23],
];

Expand Down
2 changes: 2 additions & 0 deletions src/all_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ pub enum Table {
pub(crate) const NUM_TABLES: usize = Table::Memory as usize + 1;
pub(crate) const NUM_PUBLIC_INPUT_USERDATA: usize = 32;

pub(crate) const MIN_TRACE_LEN: usize = 1 << 6;

impl Table {
pub(crate) fn all() -> [Self; NUM_TABLES] {
[
Expand Down
6 changes: 3 additions & 3 deletions src/fixed_recursive_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,14 @@ where
&all_stark.cross_table_lookups,
stark_config,
);
let keccak = RecursiveCircuitsForTable::new(
let poseidon = RecursiveCircuitsForTable::new(
Table::Poseidon,
&all_stark.poseidon_stark,
degree_bits_ranges[Table::Poseidon as usize].clone(),
&all_stark.cross_table_lookups,
stark_config,
);
let keccak_sponge = RecursiveCircuitsForTable::new(
let poseidon_sponge = RecursiveCircuitsForTable::new(
Table::PoseidonSponge,
&all_stark.poseidon_sponge_stark,
degree_bits_ranges[Table::PoseidonSponge as usize].clone(),
Expand All @@ -401,7 +401,7 @@ where
stark_config,
);

let by_table = [arithmetic, cpu, keccak, keccak_sponge, logic, memory];
let by_table = [arithmetic, cpu, poseidon, poseidon_sponge, logic, memory];
let root = Self::create_root_circuit(&by_table, stark_config);
let aggregation = Self::create_aggregation_circuit(&root);
let block = Self::create_block_circuit(&aggregation);
Expand Down
16 changes: 8 additions & 8 deletions src/witness/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use plonky2::field::polynomial::PolynomialValues;
use plonky2::hash::hash_types::RichField;
use plonky2::timed;
use plonky2::util::timing::TimingTree;
use std::cmp::max;

use crate::all_stark::{AllStark, NUM_TABLES};
use crate::all_stark::{AllStark, MIN_TRACE_LEN, NUM_TABLES};
use crate::arithmetic::{BinaryOperator, Operation};
use crate::config::StarkConfig;
use crate::cpu::columns::CpuColumnsView;
Expand Down Expand Up @@ -140,6 +141,7 @@ impl<T: Copy> Traces<T> {
T: RichField + Extendable<D>,
{
let cap_elements = config.fri_config.num_cap_elements();
let min_rows = max(cap_elements, MIN_TRACE_LEN);
let Traces {
arithmetic_ops,
cpu,
Expand All @@ -161,23 +163,21 @@ impl<T: Copy> Traces<T> {
"generate Poseidon trace",
all_stark
.poseidon_stark
.generate_trace(poseidon_inputs, cap_elements, timing)
.generate_trace(poseidon_inputs, min_rows, timing)
);
let poseidon_sponge_trace = timed!(
timing,
"generate Poseidon sponge trace",
all_stark.poseidon_sponge_stark.generate_trace(
poseidon_sponge_ops,
cap_elements,
timing
)
all_stark
.poseidon_sponge_stark
.generate_trace(poseidon_sponge_ops, min_rows, timing)
);
let logic_trace = timed!(
timing,
"generate logic trace",
all_stark
.logic_stark
.generate_trace(logic_ops, cap_elements, timing)
.generate_trace(logic_ops, min_rows, timing)
);
let memory_trace = timed!(
timing,
Expand Down

0 comments on commit 213b1b6

Please sign in to comment.