Compute the commitment another way to test

This commit is contained in:
Ramana Kumar 2022-10-03 07:51:53 +01:00
parent 3c5312cbb3
commit 4f7cf29e5f
No known key found for this signature in database
GPG Key ID: ED471C788B900433
1 changed files with 7 additions and 1 deletions

View File

@ -50,6 +50,8 @@ aggregated_poly = ckzg.alloc_polynomial(values)
aggregated_poly_commitment = ckzg.g1_lincomb(kzg_commitments, r_powers) aggregated_poly_commitment = ckzg.g1_lincomb(kzg_commitments, r_powers)
simple_commitment = ckzg.blob_to_kzg_commitment(values, ts)
# Compute proof # Compute proof
values_sedes = ssz.List(ssz.uint256, MAX_BLOBS_PER_BLOCK) values_sedes = ssz.List(ssz.uint256, MAX_BLOBS_PER_BLOCK)
@ -68,7 +70,11 @@ proof = ckzg.compute_kzg_proof(aggregated_poly, x, ts)
y = ckzg.evaluate_polynomial_in_evaluation_form(aggregated_poly, x, ts) y = ckzg.evaluate_polynomial_in_evaluation_form(aggregated_poly, x, ts)
assert ckzg.verify_kzg_proof(aggregated_poly_commitment, x, y, proof, ts) assert ckzg.bytes_from_g1(simple_commitment) == ckzg.bytes_from_g1(aggregated_poly_commitment)
assert ckzg.verify_kzg_proof(simple_commitment, x, y, proof, ts), 'Simple verification failed'
assert ckzg.verify_kzg_proof(aggregated_poly_commitment, x, y, proof, ts), 'Verification failed'
# Verification fails at wrong value # Verification fails at wrong value