Add test that verification fails at wrong value

This commit is contained in:
Ramana Kumar 2022-10-04 07:47:13 +01:00
parent e60b5c2d77
commit 97fc4762d6
No known key found for this signature in database
GPG Key ID: ED471C788B900433
1 changed files with 9 additions and 0 deletions

View File

@ -102,4 +102,13 @@ assert ckzg.verify_kzg_proof(aggregated_poly_commitment, x, y, proof, ts), 'Veri
# Verification fails at wrong value
x2_bytes = random.randbytes(32)
while x2_bytes == hashed_polynomial_and_commitment:
x2_bytes = random.randbytes(32)
x2 = ckzg.bytes_to_bls_field(x2_bytes)
y2 = ckzg.evaluate_polynomial_in_evaluation_form(aggregated_poly, x2, ts)
assert not ckzg.verify_kzg_proof(aggregated_poly_commitment, x, y2, proof, ts), 'Verification should fail'
print('Tests passed')