From d91314016411f0fa74d210c6c83d80be49a0af96 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Thu, 18 Apr 2024 17:52:33 +0100 Subject: [PATCH 1/3] fix comments for kzg_proof_multi --- .../eip7594/polynomial-commitments-sampling.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/specs/_features/eip7594/polynomial-commitments-sampling.md b/specs/_features/eip7594/polynomial-commitments-sampling.md index 829e16ebaa..1937ac9793 100644 --- a/specs/_features/eip7594/polynomial-commitments-sampling.md +++ b/specs/_features/eip7594/polynomial-commitments-sampling.md @@ -308,18 +308,26 @@ def compute_kzg_proof_multi_impl( polynomial_coeff: PolynomialCoeff, zs: Sequence[BLSFieldElement]) -> Tuple[KZGProof, Sequence[BLSFieldElement]]: """ - Helper function that computes multi-evaluation KZG proofs. + Compute a KZG multi-evaluation proof for a set of `k` points. + + This is done by committing to the following quotient polynomial: + Q(X) = f(X) - r(X) / Z(X) + Where: + - r(X) is the degree k-1 polynomial that agrees with f(x) at all `k` points + - Z(X) is the degree `k` polynomial that evaluates to zero on all `k` points """ - # For all x_i, compute p(x_i) - p(z) + # For all points, compute the evaluation of those points. ys = [evaluate_polynomialcoeff(polynomial_coeff, z) for z in zs] + # Compute r(X) interpolation_polynomial = interpolate_polynomialcoeff(zs, ys) + # Compute f(X) - r(X) polynomial_shifted = add_polynomialcoeff(polynomial_coeff, neg_polynomialcoeff(interpolation_polynomial)) - # For all x_i, compute (x_i - z) + # Compute Z(X) denominator_poly = vanishing_polynomialcoeff(zs) - # Compute the quotient polynomial directly in evaluation form + # Compute the quotient polynomial directly in monomial form quotient_polynomial = divide_polynomialcoeff(polynomial_shifted, denominator_poly) return KZGProof(g1_lincomb(KZG_SETUP_G1_MONOMIAL[:len(quotient_polynomial)], quotient_polynomial)), ys From 1669723adfa56c327927f61c8cb3a9b942b67907 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Thu, 18 Apr 2024 20:26:46 +0100 Subject: [PATCH 2/3] Update specs/_features/eip7594/polynomial-commitments-sampling.md Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com> --- specs/_features/eip7594/polynomial-commitments-sampling.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/_features/eip7594/polynomial-commitments-sampling.md b/specs/_features/eip7594/polynomial-commitments-sampling.md index 1937ac9793..8702b72a5a 100644 --- a/specs/_features/eip7594/polynomial-commitments-sampling.md +++ b/specs/_features/eip7594/polynomial-commitments-sampling.md @@ -317,7 +317,7 @@ def compute_kzg_proof_multi_impl( - Z(X) is the degree `k` polynomial that evaluates to zero on all `k` points """ - # For all points, compute the evaluation of those points. + # For all points, compute the evaluation of those points ys = [evaluate_polynomialcoeff(polynomial_coeff, z) for z in zs] # Compute r(X) interpolation_polynomial = interpolate_polynomialcoeff(zs, ys) From 8e3500b2b56e128fcd19483ea2c4167afd5d5d77 Mon Sep 17 00:00:00 2001 From: kevaundray Date: Thu, 18 Apr 2024 20:26:52 +0100 Subject: [PATCH 3/3] Update specs/_features/eip7594/polynomial-commitments-sampling.md Co-authored-by: Justin Traglia <95511699+jtraglia@users.noreply.github.com> --- specs/_features/eip7594/polynomial-commitments-sampling.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/_features/eip7594/polynomial-commitments-sampling.md b/specs/_features/eip7594/polynomial-commitments-sampling.md index 8702b72a5a..fb4b46fc86 100644 --- a/specs/_features/eip7594/polynomial-commitments-sampling.md +++ b/specs/_features/eip7594/polynomial-commitments-sampling.md @@ -313,7 +313,7 @@ def compute_kzg_proof_multi_impl( This is done by committing to the following quotient polynomial: Q(X) = f(X) - r(X) / Z(X) Where: - - r(X) is the degree k-1 polynomial that agrees with f(x) at all `k` points + - r(X) is the degree `k-1` polynomial that agrees with f(x) at all `k` points - Z(X) is the degree `k` polynomial that evaluates to zero on all `k` points """