Trait implemented, trait is not implemented,

I need to implement a trait PrimeField for a struct.
A convenient sample implementation is provided by the top-level crate description:

#[derive(PrimeField)]
#[PrimeFieldModulus = "52435875175126190479447740508185965837690552500527637822603658699938581184513"]
#[PrimeFieldGenerator = "7"]
#[PrimeFieldReprEndianness = "little"]
struct Fp([u64; 4]);

Then we can construct a convenient newtype struct wrapping the Poseidon Hash function:

pub struct PosHash<'a>(pub Poseidon<'a, Fp>);

I see the sole error that ff::PrimeField is not implemented for Fp. Hmm. What if we sanity check, and write this instead?

pub struct PosHash<'a, F: ff::PrimeField>(pub Poseidon<'a, F>);

Same error. But how could that be? We just passed a generic parameter that implements PrimeField.

I'm pretty confused by this, what's going on here?

jk I've seen this before. I had to bump the version on the ff crate down a version, from 13 to 12.1 to be consistent with the Poseidon dependency on ff.

Closing this.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.