Merge branch 'master' into chore-cluster-tests
This commit is contained in:
commit
d8834eb9a7
|
@ -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) {
|
fn rs_decode(bencher: Bencher, size: usize) {
|
||||||
bencher
|
bencher
|
||||||
.with_inputs(move || {
|
.with_inputs(move || {
|
||||||
|
|
|
@ -58,6 +58,8 @@ pub enum KzgRsError {
|
||||||
PolyCommitError(#[from] ark_poly_commit::Error),
|
PolyCommitError(#[from] ark_poly_commit::Error),
|
||||||
#[error("BLST error: {0}")]
|
#[error("BLST error: {0}")]
|
||||||
BlstError(BlstError),
|
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
|
/// Transform chunks of bytes (of size `CHUNK_SIZE`) into `Fr` which are considered evaluations of a
|
||||||
|
|
|
@ -5,7 +5,7 @@ use ark_ec::pairing::Pairing;
|
||||||
use ark_poly::univariate::DensePolynomial;
|
use ark_poly::univariate::DensePolynomial;
|
||||||
use ark_poly::{DenseUVPolynomial, EvaluationDomain, GeneralEvaluationDomain};
|
use ark_poly::{DenseUVPolynomial, EvaluationDomain, GeneralEvaluationDomain};
|
||||||
use ark_poly_commit::kzg10::{Commitment, Powers, Proof, UniversalParams, KZG10};
|
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::borrow::Cow;
|
||||||
use std::ops::{Mul, Neg};
|
use std::ops::{Mul, Neg};
|
||||||
|
|
||||||
|
@ -33,6 +33,10 @@ pub fn generate_element_proof(
|
||||||
domain: GeneralEvaluationDomain<Fr>,
|
domain: GeneralEvaluationDomain<Fr>,
|
||||||
) -> Result<Proof<Bls12_381>, KzgRsError> {
|
) -> Result<Proof<Bls12_381>, KzgRsError> {
|
||||||
let u = domain.element(element_index);
|
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
|
// Instead of evaluating over the polynomial, we can reuse the evaluation points from the rs encoding
|
||||||
// let v = polynomial.evaluate(&u);
|
// let v = polynomial.evaluate(&u);
|
||||||
let v = evaluations.evals[element_index];
|
let v = evaluations.evals[element_index];
|
||||||
|
|
Loading…
Reference in New Issue