-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add FromRaw impl for some curve points #50
Conversation
The checks are failing because one dependency now requires "fontconfig", what WTF happened here, I can't find |
generic-ec-core/src/lib.rs
Outdated
/// # Safety | ||
/// Safe to implement when the checks in `generic_ec::TryFromRaw` would always | ||
/// return 1 for any point. Those checks are: | ||
/// - `point.is_on_curve()` | ||
/// - `point.is_torsion_free()` | ||
pub unsafe trait NoInvalidPoints {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is strange to refer to the generic_ec::TryFromRaw
trait which is located in upstream library. Maybe NoInvalidPoints
should be in generic_ec
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's in generic-ec, then I can't refer to it to impl it in generic-ec-curves, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can, as it is a trait first defined in generic_ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you define a trait in your crate, you can implement it on whatever structs you want. Other crates, however, will only be able to implement your trait only on the types defined in those crates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean I would impl it in generic-ec as well? I thought for an unsafe trait it's better to keep it closer to the curves definitions, and also to have less of #[cfg(feature)]
pollution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, curves crate can't possibly implement trait from generic-ec
as it's upstream, it would cause circular dependency.
I thought for an unsafe trait it's better to keep it closer to the curves definitions
I think, generally it's a good practice, but I also think it's acceptable to do otherwise in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and also to have less of
#[cfg(feature)]
pollution
That's just one #[cfg(feature)]
per each impl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, you can keep it in the core if you prefer, I just suggest to rewrite/update the comment to not refer to a trait in upstream crate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you, it is a bit silly to ask the implementers to look at the downstream crate. I'll think about it a bit
You need to set up sign-off for lockness repos, see https://github.com/LFDT-Lockness/generic-ec/pull/50/checks?check_run_id=34596977449 |
What is that? generic-ec/.github/workflows/rust.yml Lines 40 to 48 in 535f719
It should be |
535f719
to
ecbd3ab
Compare
Done with a force push |
Ah okay, |
Signed-off-by: maurges <[email protected]>
Signed-off-by: maurges <[email protected]>
fb80604
to
d50b4a0
Compare
I'm also curious why in the CI we see that deps are being updated. Did you forget to commit
|
Well I found out yesterday that we never actually had a lockfile in this repo at all. So now we can't even know what broke, our dependencies or ubuntu-latest in the runner |
ah well, can you commit your cargo lock? Maybe it will help |
Or you did a fresh build? |
I did a fresh build. You can add your own cargo-lock to this PR |
Signed-off-by: Denis Varlakov <[email protected]>
Let's see if that helps |
Nope, still misses fontconfig. I guess I'll try downgrading ubuntu image next |
You can also install a package |
Or I could do that. I didn't because all the ways to do it are stupid and waste compute, or overcomplicated |
Signed-off-by: maurges <[email protected]>
So I see two easy choices: either install the missing package, or explicilty use |
I'm fine with whatever option! |
Signed-off-by: maurges <[email protected]>
Signed-off-by: maurges <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably it's also a good idea to re-export NoInvalidPoints
trait in generic_ec::traits
?
generic-ec/generic-ec/src/lib.rs
Lines 219 to 228 in fafa3ed
pub mod traits { | |
#[doc(inline)] | |
pub use crate::core::{One, Reduce, Samplable, Zero}; | |
/// Trait that allows you to check whether value is zero | |
pub trait IsZero { | |
/// Checks whether `self` is zero | |
fn is_zero(&self) -> bool; | |
} | |
} |
I don't think we should, this is a low-level trait for implementing, while for usage there exists the corresponding high-level trait |
Signed-off-by: maurges <[email protected]>
wouldn't it be helpful to be able to write |
Signed-off-by: maurges <[email protected]>
f5b963b
to
d1aff99
Compare
This is a small change, but I never contributed to generic-ec-core, so I'm taking suggestions on the whole design