Skip to content

Commit

Permalink
always use the first 8 elements as the digest
Browse files Browse the repository at this point in the history
  • Loading branch information
weikengchen committed Jan 10, 2025
1 parent 2db1f86 commit 8386aa2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/prover/src/core/backend/simd/grind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ fn grind_poseidon31(digest: &[M31; 8], hi: u64, pow_bits: u32) -> Option<u64> {
M31::from_u32_unchecked((((start + i as u64) >> 43) & ((1 << 21) - 1)) as u32)
}));

let res = permute(attempt)[8];
let res = permute(attempt)[0];
let success_mask = res.into_simd().trailing_zeros().simd_ge(pow_bits);
if success_mask.any() {
let i = success_mask.to_array().iter().position(|&x| x).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions crates/prover/src/core/channel/poseidon31.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl Channel for Poseidon31Channel {
poseidon2_permute(&mut state);
}

let new_digest = state.last_chunk::<8>().unwrap();
let new_digest = state.first_chunk::<8>().unwrap();
self.update_digest(*new_digest);
}

Expand Down Expand Up @@ -142,7 +142,7 @@ impl Channel for Poseidon31Channel {
];
poseidon2_permute(&mut state);

let new_digest = state.last_chunk::<8>().unwrap();
let new_digest = state.first_chunk::<8>().unwrap();
self.update_digest(*new_digest);
}

Expand Down

0 comments on commit 8386aa2

Please sign in to comment.