diff --git a/recursion/compiler/src/ir/poseidon.rs b/recursion/compiler/src/ir/poseidon.rs index bf5c8a01d6..66230a2f3b 100644 --- a/recursion/compiler/src/ir/poseidon.rs +++ b/recursion/compiler/src/ir/poseidon.rs @@ -172,6 +172,11 @@ impl Builder { } }); + 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 diff --git a/recursion/core/src/runtime/mod.rs b/recursion/core/src/runtime/mod.rs index 5348b415e0..aab012b1f3 100644 --- a/recursion/core/src/runtime/mod.rs +++ b/recursion/core/src/runtime/mod.rs @@ -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; @@ -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),