LLFourn / secp256kfun

A pure-rust secp256k1 library optimised for fun
BSD Zero Clause License
101 stars 29 forks source link

Examples from documentation not working #87

Closed josediegorobles closed 2 years ago

josediegorobles commented 2 years ago

I get same error with the main and the adaptor examples:

error[E0599]: the function or associated itemnewexists for structSchnorr<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>, _>`, but its trait bounds were not satisfied --> src/main.rs:12:41 12 let schnorr = Schnorr::<Sha256, _>::new(nonce_gen); ^^^ function or associated item cannot be called on Schnorr<CoreWrapper<CtVariableCoreWrapper<Sha256VarCore, UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>>, _> due to unsatisfied trait bounds
::: /Users/jdrobpar/.cargo/registry/src/github.com-1ecc6299db9ec823/schnorr_fun-0.7.0/src/schnorr.rs:24:1 24 pub struct Schnorr<CH, NG = ()> {
doesn't satisfy _: Default
doesn't satisfy _: schnorr_fun::secp256kfun::digest::Digest
doesn't satisfy _: schnorr_fun::secp256kfun::digest::FixedOutput
doesn't satisfy _: schnorr_fun::secp256kfun::digest::Reset
doesn't satisfy _: schnorr_fun::secp256kfun::digest::Update
::: /Users/jdrobpar/.cargo/registry/src/github.com-1ecc6299db9ec823/digest-0.10.3/src/core_api/wrapper.rs:22:1 22 / pub struct CoreWrapper 23 where 24 T: BufferKindUser, 25 T::BlockSize: IsLess, ... 29 buffer: BlockBuffer<T::BlockSize, T::BufferKind>, 30 }
doesn't satisfy <_ as schnorr_fun::secp256kfun::digest::Digest>::OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>
doesn't satisfy `: Tagged`
doesn't satisfy `_: schnorr_fun::secp256kfun::digest::Digest``
LLFourn commented 2 years ago

Hmm the doc tests works for me if I run cargo test^1

Are you using sha2 = 0.9? We haven't upgraded to 0.10 yet see #83

^1 actually they don't but that's a separate issue with secp256k1 breaking upstream it looks like. I'll fix that soon.

josediegorobles commented 2 years ago

Oh, sorry. It works with 0.9 version of sha2. Thanks!