Skip to content
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

Adds primitives needed for BLS12-381 hash_to_curve for G1 & G2 #258

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
d4e3f2a
feat: impl fp2 add, sub & inv
petscheit Oct 28, 2024
3166a17
feat: add more fp2 operations
petscheit Oct 30, 2024
6841b63
feat: impl dqrt function found in ark_algebra
petscheit Oct 30, 2024
59f9a20
feat: add fp2 horner eval + g2 bls12-381 isogeny params
petscheit Oct 31, 2024
775560c
feat: add is_non_zero
petscheit Nov 1, 2024
72961d2
feat: add map_to_curve_g2 circuit logic
petscheit Nov 1, 2024
4527b84
feat: add g2 isogeny logic
petscheit Nov 1, 2024
fb110a0
chore: rename
petscheit Nov 1, 2024
933d5e0
fix: update sqrt logic
petscheit Nov 5, 2024
2ec6558
feat: add ec_add for g2
petscheit Nov 5, 2024
ccbedd2
feat: add isogeny g2
petscheit Nov 5, 2024
500216d
fix: parity logic
petscheit Nov 5, 2024
5dd505e
feat: add effective cofactor clearing using addition chains
petscheit Nov 6, 2024
61a36a2
feat: add fast g2 cofactor clearing
petscheit Nov 7, 2024
8419a65
Merge pull request #4 from petscheit/feat/cofactor
petscheit Nov 7, 2024
64ebdd5
Merge branch 'hash_to_curve' into feat/hash_to_curve
petscheit Nov 7, 2024
35842c7
chore: readd lost function
petscheit Nov 7, 2024
b5acf6a
Merge branch 'feat/hash_to_curve' of https://github.com/petscheit/gar…
petscheit Nov 7, 2024
5fb6e38
chore: cleanup
petscheit Nov 7, 2024
c510ded
Merge pull request #5 from petscheit/feat/hash_to_curve
petscheit Nov 7, 2024
96cffe3
chore: add missing g2 functions
petscheit Nov 8, 2024
4dd3006
feat: add sqrt selection logic
petscheit Nov 11, 2024
aca8811
fix: faulty fp2 parity logic
petscheit Nov 28, 2024
44f701d
chore: add tests for added logic
petscheit Nov 28, 2024
ca2fe12
fix: python version which breaks on a macos dep
petscheit Nov 28, 2024
2f0e312
chore: regenerate circuit
petscheit Nov 28, 2024
1493b07
Merge pull request #6 from petscheit/hash_to_curve
petscheit Nov 28, 2024
fbf8a40
feat: add map_to_curve for g1
petscheit Nov 29, 2024
65d5bae
feat: add isogeny and cofactor clearing for g1
petscheit Nov 29, 2024
bd5b9ac
Merge pull request #7 from petscheit/hash_to_curve
petscheit Nov 29, 2024
ad3933c
Merge branch 'main' into main
petscheit Dec 2, 2024
d609d5f
Merge branch 'main' into petscheit/main
feltroidprime Dec 10, 2024
aa3f285
Merge branch 'main' into main
feltroidprime Dec 10, 2024
ebbe575
fix: revert no_index change
petscheit Dec 18, 2024
45ee928
chore: move vector operators to ModuloCircuit
petscheit Dec 18, 2024
1901b49
chore: remaining cleanup + make rewrite
petscheit Dec 18, 2024
13e3111
Merge branch 'main' into main
petscheit Dec 18, 2024
1973064
feat: add y_coord recover for G1 point
petscheit Dec 2, 2024
4777ded
fix: logic error in point selection
petscheit Dec 3, 2024
9473546
chore: update rust version in docker to fix CI
petscheit Dec 18, 2024
f9d653f
chore: added new wasm build
petscheit Dec 18, 2024
1408c7f
fix: enforce wasm plattform to restore build determinism
petscheit Dec 18, 2024
27c57fb
chore: fix ubuntu build error
petscheit Dec 18, 2024
e49f8f5
Merge pull request #8 from petscheit/feat/g1_point_decompression
petscheit Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y \
libnss3 libxss1 libasound2 libatk-bridge2.0-0 libatk1.0-0 \
libnss3 libxss1 libasound2t64 libatk-bridge2.0-0 libatk1.0-0 \
libcups2 libxcomposite1 libxdamage1 libxrandr2 libgbm1 \
libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 libgtk-3-0
- name: Download package file as artifact
Expand Down
46 changes: 0 additions & 46 deletions hydra/garaga/extension_field_modulo_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,52 +285,6 @@ def eval_poly_in_precomputed_Z(

return X_of_z

def extf_add(
self, X: list[ModuloCircuitElement], Y: list[ModuloCircuitElement]
) -> list[ModuloCircuitElement]:
"""
Adds two polynomials with coefficients `X` and `Y`.
Returns R = [x0 + y0, x1 + y1, x2 + y2, ... + xn-1 + yn-1] mod p
"""
assert len(X) == len(Y), f"len(X)={len(X)} != len(Y)={len(Y)}"
return [
self.add(x_i, y_i, comment=f"Fp{len(X)} add coeff {i}/{len(X)-1}")
for i, (x_i, y_i) in enumerate(zip(X, Y))
]

def extf_scalar_mul(
self, X: list[ModuloCircuitElement], c: ModuloCircuitElement
) -> list[ModuloCircuitElement]:
"""
Multiplies a polynomial with coefficients `X` by a scalar `c`.
Input : I(x) = i0 + i1*x + i2*x^2 + ... + in-1*x^n-1
Output : O(x) = ci0 + ci1*x + ci2*x^2 + ... + cin-1*x^n-1.
This is done in the circuit.
"""
assert isinstance(c, ModuloCircuitElement), "c must be a ModuloCircuitElement"
return [
self.mul(x_i, c, comment=f"Fp{len(X)} scalar mul coeff {i}/{len(X)-1}")
for i, x_i in enumerate(X)
]

def extf_neg(self, X: list[ModuloCircuitElement]) -> list[ModuloCircuitElement]:
"""
Negates a polynomial with coefficients `X`.
Returns R = [-x0, -x1, -x2, ... -xn-1] mod p
"""
return [
self.neg(x_i, comment=f"Fp{len(X)} neg coeff {i}/{len(X)-1}")
for i, x_i in enumerate(X)
]

def extf_sub(
self, X: list[ModuloCircuitElement], Y: list[ModuloCircuitElement]
) -> list[ModuloCircuitElement]:
return [
self.sub(x, y, comment=f"Fp{len(X)} sub coeff {i}/{len(X)-1}")
for i, (x, y) in enumerate(zip(X, Y))
]

def extf_mul(
self,
Ps: list[list[ModuloCircuitElement]],
Expand Down
Loading
Loading