Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KZGProof at G1_POINT_AT_INFINITY test cases #3507

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion tests/generators/kzg_4844/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,20 @@ def case05_verify_blob_kzg_proof():
'output': None
}

# Edge case: Incorrect `G1_POINT_AT_INFINITY` Proof
hwwhww marked this conversation as resolved.
Show resolved Hide resolved
blob = BLOB_RANDOM_VALID1
commitment = spec.blob_to_kzg_commitment(blob)
proof = spec.G1_POINT_AT_INFINITY
assert not spec.verify_blob_kzg_proof(blob, commitment, proof)
yield 'verify_blob_kzg_proof_case_incorrect_proof_point_at_infinity', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit. I think we should group this with the other "incorrect" tests. So move this test case below the verify_blob_kzg_proof_case_incorrect_proof test case.

'input': {
'blob': encode_hex(blob),
'commitment': encode_hex(commitment),
'proof': encode_hex(proof),
},
'output': False
}


def case06_verify_blob_kzg_proof_batch():
# Valid cases
Expand All @@ -423,7 +437,7 @@ def case06_verify_blob_kzg_proof_batch():
# Incorrect proof
proofs_incorrect = [bls_add_one(proofs[0])] + proofs[1:]
assert not spec.verify_blob_kzg_proof_batch(VALID_BLOBS, commitments, proofs_incorrect)
yield 'verify_blob_kzg_proof_batch_case_invalid_proof', {
yield 'verify_blob_kzg_proof_batch_case_incorrect_proof_add_one', {
'input': {
'blobs': encode_hex_list(VALID_BLOBS),
'commitments': encode_hex_list(commitments),
Expand Down Expand Up @@ -509,6 +523,21 @@ def case06_verify_blob_kzg_proof_batch():
'output': None
}

# Edge case: Incorrect `G1_POINT_AT_INFINITY` Proof
hwwhww marked this conversation as resolved.
Show resolved Hide resolved
blob = BLOB_RANDOM_VALID1
commitment = spec.blob_to_kzg_commitment(blob)
proof = spec.G1_POINT_AT_INFINITY
assert not spec.verify_blob_kzg_proof_batch([blob], [commitment], [proof])

yield 'verify_blob_kzg_proof_batch_case_incorrect_proof_point_at_infinity', {
hwwhww marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the other one, I think this should be in the "incorrect" group of tests. So below the verify_blob_kzg_proof_batch_case_incorrect_proof_add_one test.

'input': {
'blobs': encode_hex_list([blob]),
'commitments': encode_hex_list([commitment]),
'proofs': encode_hex_list([proof]),
},
'output': False
}


def create_provider(fork_name: SpecForkName,
handler_name: str,
Expand Down