Skip to content

Commit

Permalink
chore: modify according to the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
felicityin committed Jan 13, 2025
1 parent b416875 commit 57f00f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions prover/src/keccak_sponge/keccak_sponge_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub struct KeccakSpongeStark<F, const D: usize> {
impl<F: RichField + Extendable<D>, const D: usize> KeccakSpongeStark<F, D> {
pub(crate) fn generate_trace(
&self,
operations: &Vec<KeccakSpongeOp>,
operations: Vec<KeccakSpongeOp>,
min_rows: usize,
) -> Vec<PolynomialValues<F>> {
// Generate the witness row-wise.
Expand All @@ -232,15 +232,15 @@ impl<F: RichField + Extendable<D>, const D: usize> KeccakSpongeStark<F, D> {

fn generate_trace_rows(
&self,
operations: &Vec<KeccakSpongeOp>,
operations: Vec<KeccakSpongeOp>,
min_rows: usize,
) -> Vec<[F; NUM_KECCAK_SPONGE_COLUMNS]> {
let base_len: usize = operations
.iter()
.map(|op| op.input.len() / KECCAK_RATE_BYTES + 1)
.sum();
let mut rows = Vec::with_capacity(base_len.max(min_rows).next_power_of_two());
for op in operations.iter() {
for op in operations {
rows.extend(self.generate_rows_for_op(op));
}
let padded_rows = rows.len().max(min_rows).next_power_of_two();
Expand All @@ -250,7 +250,7 @@ impl<F: RichField + Extendable<D>, const D: usize> KeccakSpongeStark<F, D> {
rows
}

fn generate_rows_for_op(&self, op: &KeccakSpongeOp) -> Vec<[F; NUM_KECCAK_SPONGE_COLUMNS]> {
fn generate_rows_for_op(&self, op: KeccakSpongeOp) -> Vec<[F; NUM_KECCAK_SPONGE_COLUMNS]> {
let mut rows = Vec::with_capacity(op.input.len() / KECCAK_RATE_BYTES + 1);

let mut sponge_state = [0u32; KECCAK_WIDTH_U32S];
Expand Down
2 changes: 1 addition & 1 deletion prover/src/witness/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl<T: Copy> Traces<T> {
.generate_trace(&keccak_inputs, min_rows),
|| keccak_sponge_trace = all_stark
.keccak_sponge_stark
.generate_trace(&keccak_sponge_ops, min_rows),
.generate_trace(keccak_sponge_ops, min_rows),
|| logic_trace = all_stark.logic_stark.generate_trace(&logic_ops, min_rows),
)
);
Expand Down

0 comments on commit 57f00f2

Please sign in to comment.