Skip to content

Commit

Permalink
Merge pull request #1720 from o1-labs/dw/clean-poseidon-full-round2
Browse files Browse the repository at this point in the history
Clean poseidon full round2
  • Loading branch information
querolita authored Jan 19, 2024
2 parents 8788f9d + dcdf8eb commit 166df56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions kimchi/src/snarky/poseidon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
use ark_ff::PrimeField;
use itertools::Itertools;
use mina_poseidon::{
constants::PlonkSpongeConstantsKimchi, permutation::full_round2,
constants::PlonkSpongeConstantsKimchi, permutation::full_round,
poseidon::ArithmeticSpongeParams,
};
use std::{borrow::Cow, iter::successors};
Expand Down Expand Up @@ -73,8 +73,9 @@ fn round<F: PrimeField>(
) -> [FieldVar<F>; SPONGE_WIDTH] {
runner
.compute(loc, |env| {
let state = elements.clone().map(|var| env.read_var(&var));
full_round2::<F, PlonkSpongeConstantsKimchi>(params, state, round)
let mut state = elements.clone().map(|var| env.read_var(&var)).to_vec();
full_round::<F, PlonkSpongeConstantsKimchi>(params, &mut state, round);
state.try_into().unwrap()
})
.expect("compiler bug")
}
Expand Down
4 changes: 2 additions & 2 deletions kimchi/src/snarky/union_find.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::hash::Hash;
pub struct DisjointSet<T> {
set_size: usize,
/// The structure saves the parent information of each subset in continuous
/// memory(a vec) for better performance.
/// memory(a vec) for better performance.
parent: Vec<usize>,

/// Each T entry is mapped onto a usize tag.
Expand Down Expand Up @@ -38,7 +38,7 @@ where
}

/// Returns Some(num), num is the tag of subset in which x is.
/// If x is not in the data structure, it returns None.
/// If x is not in the data structure, it returns None.
pub fn find(&mut self, x: T) -> Option<usize> {
let pos = match self.map.get(&x) {
Some(p) => *p,
Expand Down

0 comments on commit 166df56

Please sign in to comment.