Skip to content

Commit

Permalink
Merge pull request #10 from AlexThemelis/main
Browse files Browse the repository at this point in the history
Fix Poseidon sponge.
  • Loading branch information
mmaker authored May 23, 2024
2 parents fe4ddb1 + 15d4daa commit 29708f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/plugins/ark/poseidon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ where
}

/// Initialization of constants.
#[allow(unused)]
macro_rules! poseidon_sponge {
($name: ident, $path: tt) => {
pub type $name = crate::hash::sponge::DuplexSponge<
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/ark/tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{DefaultHash, DuplexHash, IOPattern, Unit, UnitTranscript};
#[cfg(feature = "ark-bls12-381")]
use ark_bls12_381::Fr;

#[cfg(feature = "ark-bls12-381")]
use super::poseidon::PoseidonHash;

/// Test that the algebraic hashes do use the IV generated from the IO Pattern.
Expand All @@ -18,11 +19,13 @@ fn check_iv_is_used<H: DuplexHash<F>, F: Unit + Copy + Default + Eq + core::fmt:
#[test]
fn test_iv_is_used() {
check_iv_is_used::<DefaultHash, u8>();
#[cfg(feature = "ark-bls12-381")]
check_iv_is_used::<PoseidonHash<Fr, 2, 3>, Fr>();
}

/// Check that poseidon can indeed be instantiated and doesn't do terribly stupid things like give 0 challenges.
#[test]
#[cfg(feature = "ark-bls12-381")]
fn test_poseidon_basic() {
type F = Fr;
type H = PoseidonHash<F, 2, 3>;
Expand Down

0 comments on commit 29708f3

Please sign in to comment.