Check the proof fails on wrong data

This commit is contained in:
Ramana Kumar 2022-09-19 10:56:52 +01:00
parent 80b1c973cf
commit bd65d49ffd
No known key found for this signature in database
GPG Key ID: ED471C788B900433
1 changed files with 8 additions and 0 deletions

View File

@ -104,6 +104,7 @@ assert ret == 0
assert ckzg.g1_equal(commitment, commitment_l)
# Compute proof at an arbitrary point (for both forms)
x = ckzg.fr_from_uint64s((39, 100, 8, 0))
ret, π = ckzg.compute_proof_single(p, x, ks)
assert ret == 0
@ -122,6 +123,13 @@ ret, res = ckzg.check_proof_single(commitment_l, π_l, x, v, ks)
assert ret == 0
assert res
# Check the proof fails with the wrong value
w = ckzg.fr_add(v, ckzg.fr_one)
ret, res = ckzg.check_proof_single(commitment_l, π_l, x, w, ks)
assert ret == 0
assert not res
print("All tests passed.")
# We need to manually free the C allocated arrays