-
Notifications
You must be signed in to change notification settings - Fork 42
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
Implement starknet_core_types::curve module #8
Conversation
I'm not sure whether moving the
The question to be asked is whether the "rpc types" crate should depend on the "core types" crate. It's not clear to me. Obvious pro is simplicity. Less crates to worry about = less time auditing dependencies and thinking about dependency trees. Obvious con is bringing a whole range of types that people might not need. Just using feature flags a bit aggressively might suffice to solve the issue though. I don't have a strong opinion on that. |
great @nils-mathieu I think it is okay to leave these implementations inside the starknet-types-core crate since I dont think there are plans to add many more structs inside the crates. In case there is any problem I can move all to a new starknet-arithmetic |
Of note, if we do end up using unsafe code to return references, I'd say we should create a private function on those lines: #[repr(transparent)]
struct Felt(FieldElement< /* ... */ >);
impl Felt {
// no-op function to turn a field element reference into a `Felt`
#[inline(always)]
fn wrap(inner: &FieldElement< /* ... */ >) -> &Self {
// SAFETY:
// `Felt` is a `#[repr(transparent)]` wrapper around `FieldElement< /* ... */ >`,
// which ensures that its memory layout is always the same as its content.
unsafe { &*(inner as *const _ as *const Self) }
}
} to avoid putting the same bit of unsafe code everywhere |
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.
Can you add a curve
feature flag plz
Even if we don't do the unsafe stuff, I think we should still add |
Hi @LucasLvy ! |
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.
Looks good to me.
Implement starknet_core_types::curve module
Does this introduce a breaking change?
Yes