Skip to content

Commit a628c68

Browse files
authored
Merge pull request #297 from ConsenSys/develop
v0.9.0 placeholder
2 parents 7fcb6a3 + 2576e10 commit a628c68

File tree

697 files changed

+92523
-51828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

697 files changed

+92523
-51828
lines changed

.github/workflows/pr.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- name: install Go
1111
uses: actions/setup-go@v2
1212
with:
13-
go-version: 1.18.x
13+
go-version: 1.19.x
1414
- name: checkout code
1515
uses: actions/checkout@v2
1616
with:
@@ -43,7 +43,7 @@ jobs:
4343
test:
4444
strategy:
4545
matrix:
46-
go-version: [1.17.x, 1.18.x]
46+
go-version: [1.18.x, 1.19.x]
4747
os: [ubuntu-latest]
4848
runs-on: ${{ matrix.os }}
4949
needs:
@@ -68,7 +68,9 @@ jobs:
6868
- name: install deps
6969
run: go install golang.org/x/tools/cmd/goimports@latest && go install github.com/klauspost/asmfmt/cmd/asmfmt@latest
7070
- name: Test
71-
run: go test -p=1 -v -timeout=30m ./...
71+
run: |
72+
go test -p=1 -v -timeout=30m ./...
73+
go test -p=1 -tags=purego -v -timeout=30m ./...
7274
- name: Test (32 bits & race)
7375
if: (matrix.os == 'ubuntu-latest') && (matrix.go-version == '1.18.x')
7476
run: |

.golangci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ linters:
1111
- gosimple
1212
- govet
1313
- ineffassign
14+
# - errcheck
1415

1516
run:
1617
issues-exit-code: 1

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* [`bls12-377`] / [`bw6-761`]
1212
* [`bls24-315`] / [`bw6-633`]
1313
* [`bls12-378`] / [`bw6-756`]
14-
* Each of these curve has a [`twistededwards`] sub-package with its companion curve which allow efficient elliptic curve cryptography inside zkSNARK circuits.
14+
* Each of these curves has a [`twistededwards`] sub-package with its companion curve which allow efficient elliptic curve cryptography inside zkSNARK circuits.
1515
* [`field/goff`] - Finite field arithmetic code generator (blazingly fast big.Int)
1616
* [`fft`] - Fast Fourier Transform
1717
* [`fri`] - FRI (multiplicative) commitment scheme
@@ -46,15 +46,15 @@
4646
go get github.com/consensys/gnark-crypto
4747
```
4848

49-
Note if that if you use go modules, in `go.mod` the module path is case sensitive (use `consensys` and not `ConsenSys`).
49+
Note that if you use go modules, in `go.mod` the module path is case sensitive (use `consensys` and not `ConsenSys`).
5050

5151
### Development
5252

5353
Most (but not all) of the code is generated from the templates in `internal/generator`.
5454

5555
The generated code contains little to no interfaces and is strongly typed with a field (generated by the `gnark-crypto/field` package). The two main factors driving this design choice are:
5656

57-
1. Performance: `gnark-crypto` algorithms manipulates millions (if not billions) of field elements. Interface indirection at this level, plus garbage collection indexing takes a heavy toll on perf.
57+
1. Performance: `gnark-crypto` algorithms manipulate millions (if not billions) of field elements. Interface indirection at this level, plus garbage collection indexing takes a heavy toll on perf.
5858
2. Need to derive (mostly) identical code for various moduli and curves, with consistent APIs. Generics introduce significant performance overhead and are not yet suited for high performance computing.
5959

6060
To regenerate the files, see `internal/generator/main.go`. Run:
@@ -117,4 +117,4 @@ This project is licensed under the Apache 2 License - see the [LICENSE](LICENSE)
117117
[`kzg`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/kzg
118118
[`plookup`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/plookup
119119
[`permutation`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/ecc/bn254/fr/permutation
120-
[`fiatshamir`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/fiat-shamir
120+
[`fiatshamir`]: https://pkg.go.dev/github.com/consensys/gnark-crypto/fiat-shamir

accumulator/merkletree/tree.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ func sum(h hash.Hash, data ...[]byte) []byte {
8484

8585
// leafSum returns the hash created from data inserted to form a leaf. Leaf
8686
// sums are calculated using:
87-
// Hash(0x00 || data)
87+
//
88+
// Hash(0x00 || data)
8889
func leafSum(h hash.Hash, data []byte) []byte {
8990

9091
//return sum(h, leafHashPrefix, data)
@@ -93,7 +94,8 @@ func leafSum(h hash.Hash, data []byte) []byte {
9394

9495
// nodeSum returns the hash created from two sibling nodes being combined into
9596
// a parent node. Node sums are calculated using:
96-
// Hash(0x01 || left sibling sum || right sibling sum)
97+
//
98+
// Hash(0x01 || left sibling sum || right sibling sum)
9799
func nodeSum(h hash.Hash, a, b []byte) []byte {
98100
//return sum(h, nodeHashPrefix, a, b)
99101
return sum(h, a, b)

ecc/bls12-377/bls12-377.go

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,29 @@
11
// Package bls12377 efficient elliptic curve, pairing and hash to curve implementation for bls12-377.
22
//
33
// bls12-377: A Barreto--Lynn--Scott curve with
4-
// embedding degree k=12
5-
// seed x₀=9586122913090633729
6-
// 𝔽r: r=8444461749428370424248824938781546531375899335154063827935233455917409239041 (x₀⁴-x₀²+1)
7-
// 𝔽p: p=258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177 ((x₀-1)² ⋅ r(x₀)/3+x₀)
8-
// (E/𝔽p): Y²=X³+1
9-
// (Eₜ/𝔽p²): Y² = X³+1/u (D-type twist)
10-
// r ∣ #E(Fp) and r ∣ #Eₜ(𝔽p²)
4+
//
5+
// embedding degree k=12
6+
// seed x₀=9586122913090633729
7+
// 𝔽r: r=8444461749428370424248824938781546531375899335154063827935233455917409239041 (x₀⁴-x₀²+1)
8+
// 𝔽p: p=258664426012969094010652733694893533536393512754914660539884262666720468348340822774968888139573360124440321458177 ((x₀-1)² ⋅ r(x₀)/3+x₀)
9+
// (E/𝔽p): Y²=X³+1
10+
// (Eₜ/𝔽p²): Y² = X³+1/u (D-type twist)
11+
// r ∣ #E(Fp) and r ∣ #Eₜ(𝔽p²)
12+
//
1113
// Extension fields tower:
12-
// 𝔽p²[u] = 𝔽p/u²+5
13-
// 𝔽p⁶[v] = 𝔽p²/v³-u
14-
// 𝔽p¹²[w] = 𝔽p⁶/w²-v
14+
//
15+
// 𝔽p²[u] = 𝔽p/u²+5
16+
// 𝔽p⁶[v] = 𝔽p²/v³-u
17+
// 𝔽p¹²[w] = 𝔽p⁶/w²-v
18+
//
1519
// optimal Ate loop size:
16-
// x₀
20+
//
21+
// x₀
22+
//
1723
// Security: estimated 126-bit level following [https://eprint.iacr.org/2019/885.pdf]
1824
// (r is 253 bits and p¹² is 4521 bits)
1925
//
20-
// Warning
26+
// # Warning
2127
//
2228
// This code has not been audited and is provided as-is. In particular, there is no security guarantees such as constant time implementation or side-channel attack resistance.
2329
package bls12377

ecc/bls12-377/fp/doc.go

Lines changed: 18 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)