From 395bb714421bc95bf2966ede3d4b74c4cd561a51 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Wed, 20 Sep 2023 00:39:47 +0800 Subject: [PATCH] Add `verify_kzg_proof_case_incorrect_proof_point_at_infinity` --- tests/generators/kzg_4844/main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/generators/kzg_4844/main.py b/tests/generators/kzg_4844/main.py index 5393f8dea..6e43a77ad 100644 --- a/tests/generators/kzg_4844/main.py +++ b/tests/generators/kzg_4844/main.py @@ -214,6 +214,22 @@ def case03_verify_kzg_proof(): 'output': False } + # Incorrect `G1_POINT_AT_INFINITY` proof + blob = BLOB_RANDOM_VALID1 + _, y = spec.compute_kzg_proof(blob, z) + commitment = spec.blob_to_kzg_commitment(blob) + proof = spec.G1_POINT_AT_INFINITY + assert not spec.verify_kzg_proof(commitment, z, y, proof) + yield 'verify_kzg_proof_case_incorrect_proof_point_at_infinity', { + 'input': { + 'commitment': encode_hex(commitment), + 'z': encode_hex(z), + 'y': encode_hex(y), + 'proof': encode_hex(proof), + }, + 'output': False + } + # Edge case: Invalid commitment for commitment in INVALID_G1_POINTS: blob, z = VALID_BLOBS[2], VALID_FIELD_ELEMENTS[1]