From 97fc4762d66b0baf347cbfe9ffe0793f5c8513a8 Mon Sep 17 00:00:00 2001 From: Ramana Kumar Date: Tue, 4 Oct 2022 07:47:13 +0100 Subject: [PATCH] Add test that verification fails at wrong value --- min-bindings/python/tests.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/min-bindings/python/tests.py b/min-bindings/python/tests.py index c9d5326..8fe989d 100644 --- a/min-bindings/python/tests.py +++ b/min-bindings/python/tests.py @@ -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')