| Crates.io | rust-kzg-bn254 |
| lib.rs | rust-kzg-bn254 |
| version | 0.2.1 |
| created_at | 2024-05-31 23:05:51.701644+00 |
| updated_at | 2024-11-20 21:21:27.331304+00 |
| description | This library offers a set of functions for generating and interacting with bn254 KZG commitments and proofs in rust, with the motivation of supporting fraud and validity proof logic in EigenDA rollup integrations. |
| homepage | |
| repository | https://github.com/Layr-Labs/rust-kzg-bn254 |
| max_upload_size | |
| id | 1258347 |
| size | 74,436 |
This library offers a set of functions for generating and interacting with bn254 KZG commitments and proofs in rust, with the motivation of supporting fraud and validity proof logic in EigenDA rollup integrations.
This code is unaudited and under construction. This is experimental software and is provided on an "as is" and "as available" basis and may not work at all. It should not be used in production.
kzg.setup() function, leave the g2_power_of2_path empty, and specify srs_order to be 3000.kzg.setup() function, leave the g2_points empty, and specify the srs_order per the guide.Linting can be triggered via running cargo clippy --all --manifest-path Cargo.toml -- -D warnings.
test_compute_kzg_proof function to see the end to end usage of the library for quick start.from_bytes_and_pad()The Blob is loaded with from_bytes_and_pad which accepts bytes and "pads" it so that the data fits within the requirements of Eigen DA functioning. It also keeps track of the blob length after padding.
to_polynomial()From the Blob, a polynomial can be obtained via calling the to_polynomial() function. This converts the Blob to Field elements, then calculates the next power of 2 from this length of field elements and appends zero value elements for the remaining length.
data_setup_custom and data_setup_mins parametersThe data_setup_custom (for testing) or data_setup_mins should be used to specify the number of chunks and chunk length. These parameters are used to calculate the FFT params required for FFT operations.
commit()The commit function takes in a polynomial. It is computed over lagrange basis by performing the (i)FFT depending on the polynomial form specified.
initialize_cache()The initialize_cache function takes in a bool force. If force is set to true which delete's files which ends in .cache in the cache_dir. It computes the needed cache and writes it to files on disk into cache_dir.
commit_with_cache()The commit_with_cache function takes in a polynomial and cache_dir. It computes the commitment over the cached IFFT'd SRS points. The cache has to be already populated.
compute_kzg_proof_with_roots_of_unity()The compute_kzg_proof_with_roots_of_unity takes in a Polynomial and an index at which it needs to be computed.