Revive test_compute_kzg_proof_within_domain() -- but not exhaustive

It now creates 6 random proofs instead of all 4096.
This commit is contained in:
George Kadianakis 2023-10-10 16:18:33 +03:00
parent fd082aede6
commit 09983a4416
1 changed files with 22 additions and 0 deletions

View File

@ -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