| Age | Commit message (Collapse) | Author |
|
I could not get the result to match it, or find an implementation that
matched it either... I plan on modifying the pairing implementation to
match what I consider is the "canonical" one, that is implemented over
a Fp12-tower and used in most implementations used in the
wild (including Ethereum's and ZCash's).
|
|
We experiment with the test vector from the IETF draft
"Pairing-Friendly Curves", but the implementation does not yield the
same test result (some coefficients are the same though)... I don't
know why, and I cannot find a reference implementation that _does_
return the pairing value from the test vector.
|
|
|
|
We now put all field, curve, and pairing instantiations under
`bls12_381` module. We no longer have an `E12` curve - since we don't
use it.
|
|
We batch pairing computations for efficient checking. This allows to
more efficiently implement things like BLS signatures (where we check
that some pairing dot another is equal to 1). This is because the
exponentiation in Fp12 is a _huge_ computational effort (and what takes
the most time in the pairing computation).
It looks like `@noble/curves` implements a pairing to another `Gt` that
is much more efficient to compute (as we do not need to untwist
coordinates at all, meaning no field inversion, and no computations in
Fp12), but I will hold off on implementing this until there is an actual
need for it (in case the current pairing implementation is too slow).
|
|
We use the `py_ecc` generator, and the generator test now passes as
expected. Note that we still haven't gotten to the bottom of why
`py_ecc` and `@noble/curves` have different `Gt` groups.
|
|
We now have pairings working with the `py_ecc` implementation, but it
looks like different pairing implementations (such as `@noble/curves`)
map to different `Gt` groups.
I don't think it matters much (as long as we map to _some_ valid
group `GT`, and have bilinear properties), but I want to understand
_why_ this is the case.
|
|
Curves can now be generically instantiated with a functor, depending
on its parameterization (underlying field, Weirstrass `b` value,
generator point and order).
This makes things very nice! We also now define `E12` explicitely,
with a test that `twist E2.g = E12.g`.
|
|
Prime fields and polynomial extension fields are now functor based.
That is, you define field parameters and a functor will produce a
field module.
This is the first step to moving all BLS12-381 pairing definitions to
a single module, instead of splitting them. This makes the "this is
the curve and its pairing" very central, with the field and curve
modules being generic over their respective parameterization.
Added field exponentiation - and found out that Zarith supports
negative exponents, and `powm x ~-1 p` is a much more efficient way of
computing a field inverse (tests run ~5 times quicker).
|
|
We refactored the extension field types to use an array for
coefficients instead of a tuple. Tests were modified to only have
string literals for numerical literals (istead of previously encoding
a whole `Fp12` in a single string for example). As a result, we get
better formatting and more line breaks instead of super dense and long
lines. Unfortunately, this makes a very big PR instead. The pairing
development will continue in the next one to not overgrow this too much.
|
|
Fully test the elliptic curve implementations, including the curve over
Fp2 and Fp12, as well as twisting points from E2 to E12.
|
|
|
|
This includes operations for all 3 curves relevant to PLONK.
|
|
|
|
|
|
Additionally, slight refactor to make the `field.ml` module **ONLY**
include the module type signature definition.
|
|
Notably, only `Fp[X]/1+x^2`, or `Fp2` is tested at the moment. More
tests for `Fp12` coming right up!
|
|
In this commit, we refactor the module to contain all the fields that we
need: namely the prime field for the BN254 curve, but also the extension
fields (polynomial rings) needed for the elliptic curve pairings used by
PLONK.
In addition, I added a "journal" for documenting findings as I go as
well as useful resources I used when implementing this from scratch.
|
|
Adds a finite prime field implementation that is used by the BN254 curve
and pairings. Extended finite fields will be coming next.
|