Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
kevjue committed Jun 5, 2024
1 parent ec243f3 commit c9cfba4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
5 changes: 5 additions & 0 deletions recursion/compiler/src/ir/poseidon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ impl<C: Config> Builder<C> {
}
});

let state_idx = self.get(&state_ptr, 0).state_idx;
self.if_ne(state_idx, C::N::zero()).then(|builder| {
builder.poseidon2_permute_mut(&state);
});

state.truncate(self, Usize::Const(DIGEST_SIZE));
self.cycle_tracker("poseidon2-hash");
state
Expand Down
9 changes: 0 additions & 9 deletions recursion/core/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,6 @@ where
let (_, state) = self.mr(state_ptr, timestamp);
let (_, state_idx) = self.mr(state_ptr + F::two(), timestamp);

println!(
"absorb called with state_ptr={}, state={:?}, state_idx={:?}, input={}, input_size={}",
state_ptr, state, state_idx, input, input_size
);

let state = state[0];
let mut state_idx = state_idx[0].as_canonical_u32() as usize;

Expand Down Expand Up @@ -743,10 +738,6 @@ where
}
}

if state_idx != 0 {
self.perm.as_ref().unwrap().permute_mut(&mut state_array);
}

state_array.iter().enumerate().for_each(|(i, value)| {
self.mw(
state + F::from_canonical_usize(i),
Expand Down

0 comments on commit c9cfba4

Please sign in to comment.