333 Commits

Author SHA1 Message Date
omahs
0d3708cc42
fix typos 2024-02-22 13:20:35 +01:00
Justin Traglia
d637761a2e
Use official trusted setup (#377) 2023-10-18 13:31:55 -05:00
Justin Traglia
f3fffecd1c
Fix edge case in expand_root_of_unity (#375) 2023-10-10 17:07:44 +03:00
Justin Traglia
456c3d8fab
Enable pedantic warnings (#371)
* Enable pedantic warnings

* Make same change in other places

* Disable some warnings in java bindings
2023-10-10 15:21:14 +03:00
Justin Traglia
a1d0380305
Update comment to say 7 is the primitive root (#374)
* Update comment to say 7 is the primitive root

* Remove 5 from list
2023-10-05 19:19:14 +03:00
Justin Traglia
9e68a47f9c
Use blst's generator functions (#340) 2023-08-14 22:01:35 +03:00
Justin Traglia
74069dad68
Force use of portable blst in C (#337) 2023-08-11 15:20:34 +01:00
Michael Sproul
13cec820c0
Use LIB_PREFIX in Rust bindings (#317) 2023-06-28 13:55:28 -05:00
George Kadianakis
f19cee9c3f
Sanity check that trusted setup was loaded in Lagrange form (#309)
* Sanity check that trusted setup was loaded in Lagrange form

* fixup! Sanity check that trusted setup was loaded in Lagrange form

* Fix some nits

* Fix another nit

---------

Co-authored-by: Justin Traglia <jtraglia@pm.me>
2023-06-01 14:58:46 +03:00
Justin Traglia
3adec442de
Switch to big-endian (#305) 2023-05-24 08:44:05 -05:00
Justin Traglia
6d21a0ea98
Speed up loading trusted setup (#299)
* Replace g1 points with g1 lagrange points

* Swap out validate_kzg_g1 with blst funcs

* Update minimal preset too

* Fix java & nodejs bindings

* Put variables in smaller scope

* Update some comments

* Remove FFTSettings (#2)

* Fix issue when expanding roots of unity

* Fix formatting

* Revert back to using intermediate array

* Add missing c_kzg_free

* Fix some nits

* Replace free_kzg_settings with free_trusted_setup

* Add parens to NUM_ELEMENTS

Co-authored-by: George Kadianakis <desnacked@riseup.net>

* Move memcpy to the end

* Revert "Move memcpy to the end"

This reverts commit 5331c7feadc92e4b5dd5d4e7512e4be563d7f386.

* Add comment about free_trusted_setup

* Move check before alloc

* Add remark

* Delete unnecessary blank line

* Fix asn's nits

* Update comment for roots_of_unity in header

Co-authored-by: Gottfried Herold <GottfriedHerold@users.noreply.github.com>

* Fix formatting

* Update comment about max_scale

Co-authored-by: Gottfried Herold <GottfriedHerold@users.noreply.github.com>

---------

Co-authored-by: Suphanat Chunhapanya <haxx.pop@gmail.com>
Co-authored-by: George Kadianakis <desnacked@riseup.net>
Co-authored-by: Gottfried Herold <GottfriedHerold@users.noreply.github.com>
2023-05-12 16:44:37 +03:00
Justin Traglia
8e3dd60424
Use g2 points from spec in minimal preset (#301) 2023-05-10 12:06:44 +03:00
Justin Traglia
aa8d85dbbb
Fix some minor nits (#298) 2023-05-09 16:40:36 +03:00
Justin Traglia
5703f6f353
Check the result of blst_p2_uncompress (#297) 2023-05-05 14:31:34 +03:00
Justin Traglia
ecb5499077
Add new validate_kzg_g1 tests (#296)
* Add new validate_kzg_g1 tests

* Add "bits" to the test names
2023-05-04 11:20:42 +03:00
Justin Traglia
47ddabde63
Update C tests to support minimal config (#263) 2023-04-04 10:29:40 -05:00
Justin Traglia
b9e476857c
Add some comments & fix some nits (#275) 2023-04-04 10:09:12 -05:00
Justin Traglia
6bac4e1b6c
Run C tests on all platforms (#270)
* Run C tests on all platforms

* Don't install llvm on mac & add windows define

* Update blst settings for windows

* Install msvc on windows

* Don't specify blst as a library

* Try including -lmingw32

* Clean up makefile & test setting target

* Try using gcc for windows

* Don't treat warnings as errors on windows

* Test upping stack size

* Ignore some tasks on windows

* Clean up some things

* Fix indentations

* Delete extra blank line

* More organization

* Remove windows check around sanitize

* Move XCRUN initialization back to top

* Move extra sanitize cflags out like the others
2023-03-31 13:39:57 +09:00
Justin Traglia
9059ba5ae2
Add new NUM_G1_POINTS var for consistency (#257) 2023-03-29 16:01:24 +09:00
Justin Traglia
c5920c4ef4
Multi-platform nodejs bindings (#242) 2023-03-28 11:01:07 -05:00
Justin Traglia
3c6b9346b3
make inits submodule & builds blst (#250)
* Make inits submodule & builds blst

* Update the README

* Clean up C workflow
2023-03-28 22:26:51 +09:00
Gottfried Herold
8de0aa54ce
Only support FIELD_ELEMENTS_PER_BLOB values that are a power of 2. (#249)
* Intentionally fail to compile with a FIELD_ELEMENTS_PER_BLOB value that is not a power of 2.
We do not want to support or maintain this case, so let us be explicit about it.

* Update src/c_kzg_4844.h

Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>

* Update src/c_kzg_4844.h

Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>

---------

Co-authored-by: George Kadianakis <desnacked@riseup.net>
Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>
2023-03-28 00:02:01 +09:00
Justin Traglia
7695db3330
Use do {} while(0) for c_kzg_free macro (#245) 2023-03-25 00:42:08 +09:00
Justin Traglia
9fbe75f392
Move Polynomial type from header to impl (#244) 2023-03-24 22:51:42 +09:00
George Kadianakis
015e043475
Short circuit batch verification if n==1 (#234) 2023-03-23 07:50:36 -05:00
Gottfried Herold
577d146c0a
c_kzg_4844.c: In verify_blog_kzg_proof_batch, reuse temporary variable. (#235) 2023-03-21 15:44:56 -05:00
George Kadianakis
cc10ef024d
Some misc minor codebase improvements (#229) 2023-03-20 21:31:53 -05:00
Gottfried Herold
b7902b2300
More verbose documentation for KZGSettings struct. (#222) 2023-03-20 11:14:18 +02:00
Gottfried Herold
20ad6fca5e
Document that bit_reversal_permutation does not work for n==1 (#224) 2023-03-17 15:30:47 -05:00
Gottfried Herold
6d75c674ab
Check that FIELD_ELEMENTS_PER_BLOB is defined. (#225) 2023-03-17 15:30:06 -05:00
Gottfried Herold
93714c2a8c
changed VLA to an explicit c_kzg_malloc - call. (#223)
VLA's are prone to cause (silent!) stack overflows and a potential cause of security vulns.
While the usage pattern is probably safe in our context, changing to a more robust solution seems prudent.
2023-03-17 06:11:45 -05:00
Gottfried Herold
51d15222c6
Documentation fix. (#227) 2023-03-17 11:54:19 +02:00
George Kadianakis
903a13fb98
Simplify fr_batch_inv and reject zero inputs (#215) 2023-03-16 12:52:59 -05:00
Justin Traglia
2ba8f35dc4
Simplify and cleanup C code (#212) 2023-03-16 08:35:22 -05:00
George Kadianakis
a1b52ac9e1
Add c_kzg_free() helper free-and-null macro (#210) 2023-03-14 09:44:03 -05:00
Gottfried Herold
b4eb8d003e
Documentation updates (#208)
* Documentation update

* Documentation for division. Note that the doc says that the behaviour for a/0 is unspecified. Feel free to change.

* Add some Documentation. This fixes item #3 in https://hackmd.io/@6iQDuIePQjyYBqDChYw_jg/ByXAsi21h

* Moved documentation remark for doxygen @remark to in-code remark. The remark is not useful for API-documentation (it refers to a macro that is not part of the API).

* More verbose comment for bit_reversal_permutation.

* doxygen comment parameter name did not match variable name. Fix this.

* Remove parameter n from doxygen comment of compute_challenge, as there is no such argument.
This fixes #4 in https://hackmd.io/@6iQDuIePQjyYBqDChYw_jg/ByXAsi21h

* In compute_kzg_proof_impl, document the role of the m variable that is used to indicate whether the evaluation point is one of the interpolation points.

* Run  `make format`

* Improve multiline comments from `make format` in middle of the code

---------

Co-authored-by: George Kadianakis <desnacked@riseup.net>
2023-03-14 11:40:06 +02:00
Justin Traglia
4f0546af81
Run clang sanitizers in CI + workflow cleanup (#196)
* Run clang sanitizers in CI + workflow cleanup

* Update makefile

* Update workflow names

* Simplify more

* Run go benchmarks in CI

* Fix indentation nits

* Initialize variable in fr_is_one

* Revert "Initialize variable in fr_is_one"

This reverts commit f4c2749e410c68479f83d78c9a1780efe191c7fe.

* Move .PHONY outside of condition
2023-03-13 12:42:12 +02:00
Justin Traglia
4211d4b427
Update profiling funcs to new interface (#198) 2023-03-10 11:41:16 +02:00
Gottfried Herold
fa851f1b2c
fr_batch_inv() now fails if output and input pointers alias (#185)
instead of giving wrong result with no error

Co-authored-by: George Kadianakis <desnacked@riseup.net>
2023-03-09 18:24:49 +02:00
Gottfried Herold
2548d489a6
Documentation fix: (#193)
The previous statement was slightly wrong. Being a primite root does not mean r^( (q-1)/2) != 1.
If q=1 == 2^s * t, the latter is satisfied by e.g. t'th roots of unity, but those are not primitive roots by the usual definition.
Fortunately, the actual computation of 2^i'th roots of unity does not require a primitve root to start with, only a non-square.
2023-03-09 18:11:48 +02:00
George Kadianakis
02b7855eb7
Make verify_*() functions pessimistic by default (#184) 2023-03-08 11:00:12 -06:00
Suphanat Chunhapanya
ccf1a4fdf0
Change on compute_[blob_]kzg_proof function signatures (#174) 2023-03-07 13:51:43 -06:00
George Kadianakis
088b062d36
Simplify g1_mul() and make it look like g2_mul() (#179) 2023-03-07 07:54:38 -07:00
George Kadianakis
53b38face0
Fix little-endian serialization in compute_challenge() (#168) 2023-03-02 11:35:37 -07:00
Justin Traglia
ae0aeaf33d
Remove duplicate p1_on_curve check (#107)
Co-authored-by: George Kadianakis <desnacked@riseup.net>
2023-03-01 12:52:44 +02:00
George Kadianakis
94198b5c18
Refactor use of MSM around the base code (#159)
* Separate naive MSM and fast MSM into separate functions

* Use naive MSM in batch verify, and fast MSM when points are trusted
2023-02-24 17:38:30 +02:00
Justin Traglia
6b2ee20102
Add bindings to readme (#154)
* Add bindings section to readme

* Reorganize a little bit

* Remove extra blank lines
2023-02-23 17:53:08 +02:00
dankrad
e171cb92ff
Add more unit tests (#137) 2023-02-22 08:42:57 -06:00
Justin Traglia
b04c35437f
Fix the position dependent test (#151) 2023-02-21 18:19:50 +00:00
George Kadianakis
46d529cf00
Interface changes to free the blobs (#123)
* Update C files to new interface

* Switch CHALLENGE_INPUT_SIZE from a macro to a `const int`.

* Update README with the new public methods

---------

Co-authored-by: Justin Traglia <jtraglia@pm.me>
2023-02-20 15:52:12 +00:00