LLFourn / secp256kfun

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

Move away from nightly? #64

Closed thomaseizinger closed 3 years ago

thomaseizinger commented 3 years ago

Are there any plans to move away from Rust nightly?

Specialization doesn't look like it is going to be stabilized any time soon.

LLFourn commented 3 years ago

It is very easy to remove specialization and just put the default (slow) implementation of each primitive as the only one and then enable the faster variants with a nightly feature.

Would that be of help?

[edit] From memory we're talking about a 70 micro second slow down for a secret key to public key (for example). This would make things like: https://docs.rs/sigma_fun/0.3.1/sigma_fun/ext/dl_secp256k1_ed25519_eq/index.html a second or so slower (would need to bench it).

thomaseizinger commented 3 years ago

That would be really nice as secpfun is the only dep forcing us on nightly atm!

I'll see to send a PR for that!

LLFourn commented 3 years ago

So to be clear the things that need to be done are:

1) from the base implementation (the one where everything is marked default for each impl chain) remove default i.e. get rid of them for here unless nightly feature enabled from here

https://github.com/LLFourn/secp256kfun/blob/26a0f272d722257ae9d49d764fef609f1e0a92dc/secp256kfun/src/op.rs#L93-L108

I suggest trying to make a macro that parses a list of functions and outputs two versions (one with not(feature = nightly) and the other with feature = nightly.

2) for each specializing impl just put #[cfg(feature = nightly)] on top of it 3) Put README.md embedding which needs extended_key_value_attributes under nightly as well: https://github.com/LLFourn/secp256kfun/blob/26a0f272d722257ae9d49d764fef609f1e0a92dc/secp256kfun/src/lib.rs#L2

this should be all we need to run on stable.

thomaseizinger commented 3 years ago

Fixed in #65.