-
Notifications
You must be signed in to change notification settings - Fork 283
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
constant group element API over curve #296
Comments
Note that although const function Previously, we don't want to make (regarding the cc note: nope, the |
The reason Note that it's not clear that we want to make all the fields of I think this issue will eventually be resolved by improvements in rustc, via rust-lang/rfcs#2632 and rust-lang/rust#67792 |
@alxiong did you have a particular use case for this? AFAIK the only time I have ever needed to hardcode a point is when writing down the generator. |
As a temporary compromise that should achieve the goals of #268, what we can try to do is the following:
|
It's some application-level logic where we want to use some fixed group point as a constant. (or rather more accurately, some struct of our own that wraps around the point) Thanks for both the diagnosis and suggestion on temporary hacks @Pratyush ! This issue is really meant to be just tracking the progress on Rust's stable support on |
Motivation
Currently there's a way to define constant field element using
field_new!()
, however, there's no way of defining a constant group element over a curve.An symptom of this problem in the library is demonstrated here -- being forced to declare generator point by its (x, y) coordinates separately as opposed to directly as a point.
Problem
Currently
GroupAffine/GroupProjective::new()
is not apub const fn
, and those structs contains a private/inaccessible field_params: PhantomData
to be constructed directly, thus there's no way of constructing one.Failed Attempt
The natural solution is to update
new()
topub const fn new()
, however, the compiler would give the following complain:The strange thing is why can we have the following in
impl_Fp!()
, but not ☝️ above:The reason is mostly due to the wacky status quo of limited subset of
const fn
support in stable Rust. From a friend of mine who knew better about these progress:Proposed Action
const fn
support in Rust Stable and come back to this issue.(cc @weikengchen feel free to add more of your
GroupAffine<F, P>
idea if you find fit)The text was updated successfully, but these errors were encountered: