Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move away from nightly? #64

Closed
thomaseizinger opened this issue May 4, 2021 · 4 comments
Closed

Move away from nightly? #64

thomaseizinger opened this issue May 4, 2021 · 4 comments

Comments

@thomaseizinger
Copy link
Contributor

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
Copy link
Owner

LLFourn commented May 10, 2021

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
Copy link
Contributor Author

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
Copy link
Owner

LLFourn commented May 10, 2021

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

impl<T1, S1, Z1, T2, S2, Z2> PointBinary for (&Point<S1, T1, Z1>, &Point<S2, T2, Z2>) {
default fn add(self) -> backend::Point {
let (lhs, rhs) = self;
ConstantTime::point_add_point(&lhs.0, &rhs.0)
}
default fn sub(self) -> backend::Point {
let (lhs, rhs) = self;
ConstantTime::point_sub_point(&lhs.0, &rhs.0)
}
default fn eq(self) -> bool {
let (lhs, rhs) = self;
ConstantTime::point_eq_point(&lhs.0, &rhs.0)
}
}

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.

  1. for each specializing impl just put #[cfg(feature = nightly)] on top of it
  2. Put README.md embedding which needs extended_key_value_attributes under nightly as well:
    #![feature(rustc_attrs, min_specialization, extended_key_value_attributes)]

this should be all we need to run on stable.

@thomaseizinger
Copy link
Contributor Author

Fixed in #65.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants