Closed CPerezz closed 1 year ago
I see the source of the confusion. This trait is meant to be used for the implementation of efficient endomorphisms:
/// The presence of this element allows you to perform (certain types of)
/// endomorphisms on some elliptic curves.
In the case of bn
and many other curves we are interested in the cubic endomorphism, hence we look for an element of order 3: zeta
. The subgroup generated by this element is the small group this trait refers to, which has order N=3
.
With regards to the actual ZETA
, notice that this can be any generator of the subgroup, so it can be either zeta
or zeta^2
. AFAIK different versions of Sage may output one or the other so that may be the source of the discrepancy.
Can we mark this as solved? @CPerezz
The current definition of this trait is: https://github.com/privacy-scaling-explorations/halo2curves/blob/main/src/bn256/fr.rs#L336-L338
This is not correct.
N
is meant to be the order of a small multiplicative sub-group. Not it's generator. The error can be seen if we execute:According to the formula in the
ff
crate:We can see that
N
should be the order of the multiplicative sub-group which has3
as a generator and order2
. Luckily, the generic doesn't affect the implementation. And indeed, if you computeZETA
you will get the correct result (that matches the one used in the repo.So the only wrong thing is the generic which should be
N=2
.Edit: I'm definitely missing something as the
pasta_curves
forces the multiplicative subgroup order to be3
always.. What is true, is that withN =3
we don't get theZETA
used actually.