diff --git a/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py b/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py index 3819c95ae..14841ccbb 100644 --- a/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py +++ b/tests/core/pyspec/eth2spec/test/deneb/unittests/polynomial_commitments/test_polynomial_commitments.py @@ -167,6 +167,28 @@ def test_barycentric_within_domain(spec): assert p_z_coeff == p_z_eval == poly_eval[i] +@with_deneb_and_later +@spec_test +@single_phase +def test_compute_kzg_proof_within_domain(spec): + """ + Create and verify KZG proof that p(z) == y + where z is in the domain of our KZG scheme (i.e. a relevant root of unity). + """ + rng = random.Random(5566) + blob = get_sample_blob(spec) + commitment = spec.blob_to_kzg_commitment(blob) + polynomial = spec.blob_to_polynomial(blob) + + roots_of_unity_brp = spec.bit_reversal_permutation(spec.ROOTS_OF_UNITY) + + # Let's test some roots of unity + for _ in range(6): + z = rng.choice(roots_of_unity_brp) + proof, y = spec.compute_kzg_proof_impl(polynomial, z) + assert spec.verify_kzg_proof_impl(commitment, z, y, proof) + + @with_deneb_and_later @spec_test @single_phase