-
Notifications
You must be signed in to change notification settings - Fork 190
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
Re-export Field/Point types used in curve cycle implementations #271
Comments
Hi @huitseeker, I must be missing something. The public interface of Nova does not involve the Point type. Isn't it? The step circuit that upstream needs to pass to Nova is defined only over a prime field that must match an associate type ( |
The encapsulation of all group types (notably those used in public parameters), constraining their generation to either of:
is in my opinion suboptimal. But that can certainly be tabled to a distinct discussion, as I suspect issues like #270 will force us to tackle that. We don't even need the point types to show the current problem: |
Hi @huitseeker,
I'm not sure this requires exposing Point type. The way I was envisioning it would be implemented inside the Provider module (or whichever code provides provider trait implementations). It can be curve specific. For example, similar to from_label, there could be another trait method (or a method in an entirely new trait) that can be implemented for each curve supported. So generic code like mlkzg.rs can just call that method whenever the particular trait is implemented for a curve cycle.
In this particular example, when including As another instance, unless Nova includes the same version of ff as neptune or bellpepper (or several other dependencies of Nova), nova will not compile (ff is a dependency for all of them). Isn't requiring the right halo2curves the same requirement as in those cases? Perhaps, I'm missing something. If so, please clarify. |
It does.
It is, unless the crate I'm using (
It is the same problem, and indeed, upgrades of the ff crate tend to go very slow, as crates are typically blocked in upgrading their version of ff until the last of their (transitive-)dependencies does. Re-exports manage that pain: note halo2curves re-exports their version of ff. The glacial pace of ff development means it's likely one could find crates that all use the same version of ff. This isn't the case today with halo2curves. |
I'm still confused about this comment. Where exactly does Nova expects from_bytes method? |
@srinathsetty the turn of phrase is unfortunate, what I meant is
What Nova expects is the type: Scalars (among others) of an opaque (from the point of view of a Nova dependent) version of the pasta/halo2curves crates. Absent a re-export, the dependent will happen to be able to replicate those types if and only if its versions of those types coincide with those Nova uses. On the other hand, if Nova re-exports its dependencies, then the dependent, as long as it has access to bytes, can always deserialize data to the particular types Nova expects, using bytes-to-type conversion methods such as Footnotes
|
Thanks for the details! IIUC, this only requires exporting Scalar types, not the point types used internally by Nova, right? |
This only requires re-exporting types from |
Addressed in #343 |
#267 made the provider modules, notably the two field types and the two point types for each curve cycle, private, only exposing the Engine.
However, downstream users of nova may eventually need to use a distinct version of the libraries Nova uses for those providers, and should they not be able to exactly match that version, they would no longer have a handle on those field and point types, which would make them incapable of implementing traits on them, etc.
See https://www.lurklurk.org/effective-rust/re-export.html for a comprehensive description of this issue.
A good practice would be to re-export either the entire dependency crates (
pasta_curves
,halo2curves
) or the four core types used in the provider module. The bn256_grumpkin cycle, for instance, forms a handy set of aliases (aimed at making the halo2curves types amenable to the nova curves macros) that could be re-exported:Nova/src/provider/bn256_grumpkin.rs
Lines 30 to 32 in 2209a4f
The text was updated successfully, but these errors were encountered: