Commit Graph

54 Commits

Author SHA1 Message Date
Justin Traglia d637761a2e
Use official trusted setup (#377) 2023-10-18 13:31:55 -05:00
Michael Sproul 13cec820c0
Use LIB_PREFIX in Rust bindings (#317) 2023-06-28 13:55:28 -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 aa8d85dbbb
Fix some minor nits (#298) 2023-05-09 16:40:36 +03:00
Justin Traglia b9e476857c
Add some comments & fix some nits (#275) 2023-04-04 10:09:12 -05:00
Justin Traglia c5920c4ef4
Multi-platform nodejs bindings (#242) 2023-03-28 11:01:07 -05: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 9fbe75f392
Move Polynomial type from header to impl (#244) 2023-03-24 22:51:42 +09:00
Gottfried Herold b7902b2300
More verbose documentation for KZGSettings struct. (#222) 2023-03-20 11:14:18 +02:00
Gottfried Herold 6d75c674ab
Check that FIELD_ELEMENTS_PER_BLOB is defined. (#225) 2023-03-17 15:30:06 -05:00
George Kadianakis a1b52ac9e1
Add c_kzg_free() helper free-and-null macro (#210) 2023-03-14 09:44:03 -05:00
Suphanat Chunhapanya ccf1a4fdf0
Change on compute_[blob_]kzg_proof function signatures (#174) 2023-03-07 13:51:43 -06: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
Justin Traglia dc28b03f9d
Cleanup the Makefile (#119)
* Cleanup the Makefile some

* Fix compiler error

* Fix compiler errors in tests

* Fix problems on Linux

* Add test_c_kzg_4844_cov to gitignore

* Add back closing brace for cpp

* Split clean rule into two lines

* Not echo commands when running them

* Allow other compilers to be used

* Update comment

* Only allow clang, actually
2023-02-08 17:35:33 +00:00
Justin Traglia e487800529
Format the main C file (#116) 2023-02-07 10:35:33 +00:00
Justin Traglia 97c46a8532
Add test for compute_powers (#110)
* Add test for compute_powers

* Remove extra blank line

* Make it better

* Run make format

* Make compute powers more efficient

* Use explicit memcpy

* Fix bug in my new implementation

* Slightly cleaner implementation

* Revert changes to compute_powers

* Run formatter
2023-02-01 19:33:22 +00:00
Justin Traglia e5fa8c7ee1
Simplify log_2_byte & add test (#109) 2023-02-01 17:16:20 +00:00
Justin Traglia eb17071bf3
Add some tests for reverse_bits (#105) 2023-01-31 15:51:35 +00:00
Justin Traglia ea73c3f1ca
Add some validate_kzg_g1 tests (#102) 2023-01-31 11:26:25 +00:00
George Kadianakis 9f443bc5aa
test_compute_kzg_proof() now also verifies the KZG proof (#101)
Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com>
2023-01-31 08:33:02 +00:00
George Kadianakis 98aa54a996
Add a basic unittest framework + a compute KZG proof test (#96)
* Add tinytest.h testing framework

from https://github.com/joewalnes/tinytest/

* Add a basic compute_kzg_proof() test
2023-01-30 13:40:12 +00:00
Justin Traglia 60ead4ee49
Add compute_kzg_proof to rust bindings (#91) 2023-01-27 15:14:13 +00:00
Justin Traglia 03b90ef63f
Use Bytes48 for commitments/proofs (#86)
* Start to use bytes48 type

* Update java bindings

* Update variable names

* Update csharp bindings

* Update node.js bindings

* Update python bindings

* Fix mistake in python bindings

* Add new functions

* Fix nit in java bindings

* Update variable names in java bindings

* Compare to point at infinity

* Update bytes_to_bls_field doc

* Add todo

* Do key validation

* Remove bytes_to_g1

* Fix bug & add remark

* Fix memcmp mistake

* Fix nit in nodejs bindings

* Fix another nit

* Update nodejs parameter names

* Remove to_proof() and to_commitment()

* Fix bug
2023-01-26 14:53:30 +00:00
Justin Traglia 8907fbcfe2
Expose `compute_kzg_proof` (#80)
* Expose computeKzgProof

* Revert changes to bytes_to/from_bls_field

* Update comments

* Revert changes to bytes_from_bls_field

* Revert change to parameter name

* Add compute_kzg_proof to readme

* Refactor in support of asn's PR

* Clean up a little

* Fix param name doc

* Introduce Bytes32 type

* Update bindings

* Replaces bytes with b to match spec
2023-01-24 18:23:42 +00:00
Justin Traglia 69f6155d75
Bytes-only interface (#62)
* Convert argument types to bytes

* Update java bindings

* Update python bindings

* Update node.js bindings

* Update c# bindings

* Fix java binding compile issues

* Fix incorrect memcpy in nodejs bindings

* Fix bug (called the wrong func)

* Fix issues with java bindings

* Fix issues with node.js bindings

* Remove unnecessary wrapped funcs for c#

* Rename struct member to bytes

* Use goto out for callocs

* Fix nit

* Make un-exported funcs static

* Fix python bindings

* Check commitment length in python bindings

* Update python error message

* Steal good ideas from #37

* Fix tests.py which didn't get copied over

* Convert remaining a[] to *a

* Add missing Py_DECREF

* Bytes only rust (#1)

* Make interface bytes only
* Fix benches
* Avoid newtypes for kzg types
* Fix benches again
* Make fields private
* tidy
* Address review comments

* Fix one small thing in rust bindings

* Use ckzg types where possible

* Remove null terminator from domain bytes in rust

* Update rust binding docs

* Use BYTES_PER_* where applicable

* Add extra check for calloc

Co-authored-by: Pawan Dhananjay <pawandhananjay@gmail.com>
2023-01-16 20:05:23 +00:00
Justin Traglia c72ea8e1dc
Convert Blob type to struct (#61)
* Convert Blob type to struct

* Rename blob.data to blob.bytes
2023-01-12 10:10:23 -08:00
Justin Traglia 2d2615f053 Fix some minor nits 2023-01-09 10:54:25 -06:00
Justin Traglia c6f2c1b745 Run astyle on C files 2023-01-05 17:31:40 -06:00
Ramana Kumar cfa36097a3
Add checks that field elements are canonical 2022-12-11 20:23:48 +00:00
Ramana Kumar 547fd39e60
Add non-file-based load_trusted_setup
Closes #3
2022-12-10 16:23:32 +00:00
Ramana Kumar 68f1d2dd7e
Rename load_trusted_setup to load_trusted_setup_file 2022-12-10 16:07:40 +00:00
Ramana Kumar 2bd4c3b252
Check more allocations for failure 2022-12-06 22:13:18 +00:00
Ramana Kumar c9274d8f43
Make FIELD_ELEMENTS_PER_BLOB compile-time configurable 2022-11-29 20:48:12 +00:00
Ramana Kumar bcc138560a
Update interface for verify_kzg_proof 2022-11-19 09:35:55 +00:00
Ramana Kumar 27f0d7fb25
Remove unused Polynomial typedef from interface 2022-11-04 23:29:33 +00:00
dancoffman 062e4e0f30
Simplify, given updated API 2022-11-04 11:56:41 -07:00
dancoffman ac65930b15
Use BYTES_PER_FIELD_ELEMENT 2022-11-04 11:44:57 -07:00
dancoffman 8ca4fd9e83
Merge branch '4844_3038' into dgcoffman/nodejs-bindings 2022-11-04 11:41:17 -07:00
Ramana Kumar 99a990ff32
Add some of the bytes conversions back to the interface
These might still be needed for the G1 elements even though they're not
needed for blobs now.

Also make FIAT_SHAMIR_PROTOCOL_DOMAIN static to avoid redefinitions.
2022-11-04 09:05:39 +00:00
dancoffman b8151db670
Cleanup 2022-11-03 15:13:49 -07:00
dancoffman 672346f017
Closer to working 2022-11-03 14:39:20 -07:00
dancoffman a5ca06450f
Some cleanup 2022-11-03 13:31:02 -07:00
Ramana Kumar 2b0f6a5c09
Update src for merged-3038 specs
bindings/tests not updated
2022-11-03 17:16:57 +00:00
dancoffman d478234491
Revert changes that were only to make SWIG work 2022-11-02 13:30:19 -07:00
dancoffman b169d4ab6e
Remove SWIG 2022-11-02 13:27:00 -07:00
dancoffman 002fc3fa54
Tweaks 2022-11-01 21:58:21 -07:00
dancoffman 203033613f
I learned about extern C 2022-11-01 21:39:04 -07:00
dancoffman 6ec86af547
Generate bindings using SWIG and node-gyp 2022-11-01 15:00:00 -07:00
Ramana Kumar 434c9ae9b9
Remove unused code, remove min- prefix 2022-11-01 14:24:02 +00:00
Ramana Kumar b284636afd
Remove 4844 version from src (use min-src) 2022-10-02 11:12:38 +01:00