-
Notifications
You must be signed in to change notification settings - Fork 841
Update workspace to newest Halo2 version #341
Conversation
04cd956
to
d2d42c0
Compare
d2d42c0
to
fa37617
Compare
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.
First round of comments
@@ -12,7 +13,7 @@ pub struct TestCircuit<F> { | |||
block: Block<F>, | |||
} | |||
|
|||
impl<F: FieldExt> Circuit<F> for TestCircuit<F> { | |||
impl<F: FieldExt + PrimeField<Repr = [u8; 32]>> Circuit<F> for TestCircuit<F> { |
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.
Do we need PrimeField everywhere?
It seems if we use use halo2_proofs::arithmetic::FieldExt;
instead of use pairing::arithmetic::FieldExt;
, it can work with use pairing::bn256::Fr as Fp;
.
@kilic Any comments on this?
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 discussed with @kilic this and since there are no more to/from_bytes
methods, to/from_repr
has to be used.
That means that F
needs to define it's repr type. And since it's trait bounds, anything that interacts with it needs to have the same bounds which has lead to the propagation of the PrimeField
trait.
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 see. Makes sense to me.
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.
On a different point of view: could we define an alias like:
trait Field: FieldExt + PrimeField<Repr = [u8; 32]> {}
Just to reduce verbosity?
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.
@ed255 I like your proposal
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.
LGTM! Thanks for taking care of this tedious task :)
Take a look at my comment about making the usage of the Field trait less verbose.
@@ -12,7 +13,7 @@ pub struct TestCircuit<F> { | |||
block: Block<F>, | |||
} | |||
|
|||
impl<F: FieldExt> Circuit<F> for TestCircuit<F> { | |||
impl<F: FieldExt + PrimeField<Repr = [u8; 32]>> Circuit<F> for TestCircuit<F> { |
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.
On a different point of view: could we define an alias like:
trait Field: FieldExt + PrimeField<Repr = [u8; 32]> {}
Just to reduce verbosity?
Regarding #341 (comment), @ed255 it looks fine to me to add this alias/supertrait. It kinda masks a bit the |
After working a bit on the issue @ed255 I've seen that we can create quite an issue with this approach (Correct me if I'm wrong). SO basically we're creating a new trait in each workspace member. And this trait is basically not implemented for Also the traits are the same but defined in different crates (as there's no crate which is used everywhere in others). So I'm not sure anymore this is the best solution. WDYT? |
@ed255 @ChihChengLiang I just added it. Can you confirm whether this is ok and then I merge? |
3c10ee9
to
466d199
Compare
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.
LGTM!
466d199
to
3c10ee9
Compare
This adds the trait bounds require to be able to perform byte serialization for Field Elements. This updates `eth_types` member to work with the latest version of `appliedzkp/main` which works towards #337.
Instead of storing `Option<F>` and `Cell` is easier to simply store `AssignedCell<F,F>` and to reduce the verbosity.
- Add descriptions for each Lookup. - Add trait bounds to enable de/serialization with `To/From_repr`. - Remove legacy and unused code.
With the new version of Halo2, serialization is done via `to/from_repr` which requires to demmand for traits like `ToScalar<F>` which is the `Repr` used for it's byte repr.
- Make usage of the new Proof generation primitives. - Refactor the setup generation with the unsafe_fast setup gen. (Just for testing).
- Added `ff` as a dependency to gain access to `PrimeField` trait used to specify repr details. - Updated trait bounds for structs and fns that required them since they interact with evm/state circuits which have extra trait bounds associated to serialization.
Instead of constraining to `FieldExt` + `PrimeField<Repr>` @ed255 suggested to add a supertrait that enforces both and use it across the workspace.
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.
LGTM
3c10ee9
to
cba3641
Compare
* Replace to Rust smart cache in CI. * Update * Update and try cache restore.
This updates the entire workspace to work with the latest version of
appliedzkp/main
. Resolves: #337For now it is at
rev = 514152c8b83de27a5ce17ef70cc44c4092240bd1
but we should try to start at least tagging our versions.It also introduces the usage of
AssignedCell
replacing the(Cell, F)
primitive. Which closes: #320