Merge branch 'master' into chore-cluster-tests

This commit is contained in:
Roman Zajic 2024-12-10 09:14:48 +08:00 committed by GitHub
commit d8834eb9a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -28,7 +28,7 @@ fn rs_encode(bencher: Bencher, size: usize) {
})
}
#[divan::bench(args = [3224], sample_size = 10, sample_count = 100)]
#[divan::bench(args = [16399, 32798, 65565, 131099, 262167, 524241, 1048606], sample_size = 10, sample_count = 100)]
fn rs_decode(bencher: Bencher, size: usize) {
bencher
.with_inputs(move || {

View File

@ -58,6 +58,8 @@ pub enum KzgRsError {
PolyCommitError(#[from] ark_poly_commit::Error),
#[error("BLST error: {0}")]
BlstError(BlstError),
#[error("Denominator polynomial cannot be zero")]
DivisionByZeroPolynomial,
}
/// Transform chunks of bytes (of size `CHUNK_SIZE`) into `Fr` which are considered evaluations of a

View File

@ -5,7 +5,7 @@ use ark_ec::pairing::Pairing;
use ark_poly::univariate::DensePolynomial;
use ark_poly::{DenseUVPolynomial, EvaluationDomain, GeneralEvaluationDomain};
use ark_poly_commit::kzg10::{Commitment, Powers, Proof, UniversalParams, KZG10};
use num_traits::One;
use num_traits::{One, Zero};
use std::borrow::Cow;
use std::ops::{Mul, Neg};
@ -33,6 +33,10 @@ pub fn generate_element_proof(
domain: GeneralEvaluationDomain<Fr>,
) -> Result<Proof<Bls12_381>, KzgRsError> {
let u = domain.element(element_index);
if u.is_zero() {
return Err(KzgRsError::DivisionByZeroPolynomial);
};
// Instead of evaluating over the polynomial, we can reuse the evaluation points from the rs encoding
// let v = polynomial.evaluate(&u);
let v = evaluations.evals[element_index];