-
Notifications
You must be signed in to change notification settings - Fork 86
Feature/bn254 neg trait #1630
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
base: release/v25-preview
Are you sure you want to change the base?
Feature/bn254 neg trait #1630
Conversation
soroban-sdk/src/crypto/bn254.rs
Outdated
|
|
||
| impl_bytesn_repr!(G1Affine, G1_SERIALIZED_SIZE); | ||
| impl_bytesn_repr!(G2Affine, G2_SERIALIZED_SIZE); | ||
| impl_bytesn_repr!(Fq, FP_SERIALIZED_SIZE); |
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 Fq and FP the same things or do we need a size var for Fq?
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's just a naming convention. Technically, in bn254 they are called Fq and not Fp. I forgot to change FP_SERIALIZED_SIZE in FQ_SERIALIZED_SIZE
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'm not too familiar with outside conventions, but I think we should use Fp just for consistency. (honestly I found the switching really confusing and never understood why)
Anyways we haven't introduced Fq anywhere (in the CAP or in the env), and the Fp here is just an internal type to facilitate negation. I don't feel it's worth to switch the naming (to match some outside convention).
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.
Ok. Let's use Fp
soroban-sdk/src/crypto/bn254.rs
Outdated
| #[cfg(not(target_family = "wasm"))] | ||
| use crate::xdr::ScVal; | ||
| use crate::{ | ||
| crypto::bls12_381::BigInt, |
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.
We should move this to a shared util file. I made the change here that you can cherry-pick, or if you'd like, I can pick up this PR. Please let me know.
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.
+1
Implement
Negtrait forG1Affine. This is useful for verifying Groth16 proofs.What
Fqnewtype wrappingBytesN<FP_SERIALIZED_SIZE>as the BN254 base field elementNegforFqNegforG1Affineby:Why
Known limitations