-
Notifications
You must be signed in to change notification settings - Fork 49
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
Reduce code duplication in field implementations #49
Comments
Something I want to consider for this is how easy each of the approaches makes implementing "backends": specialisations for different targets for improved performance (e.g. AVX2). |
And I also have idea about code duplication. We can separate interface and arithmetic(algorithm). If we apply the optimization to arithmetic, it affects for every component. |
I think macro is not good way to reduce code because it makes visibility bad. |
Currently this library has two field implementations, the Pallas field and the Vesta field. They only differ in their prime modulus, and are otherwise almost identically implemented. This makes the library harder to maintain, as every change needs to be duplicated.
There are several possible approaches we could take to improve the situation:
ff_derive
pairing
crate, but we replaced that with a direct implementation of the field in thebls12_381
crate, andff_derive
hasn't been as effectively maintained since. If we switched to it, the majority of our field maintenance effort could go intoff_derive
instead of here.crypto-bigint
to implement the internal field details.crypto-bigint
is, though progress is being made.ff_derive
approach to make it easier to maintain as well.The text was updated successfully, but these errors were encountered: