Check the proof fails on wrong data
This commit is contained in:
parent
80b1c973cf
commit
bd65d49ffd
|
@ -104,6 +104,7 @@ assert ret == 0
|
||||||
assert ckzg.g1_equal(commitment, commitment_l)
|
assert ckzg.g1_equal(commitment, commitment_l)
|
||||||
|
|
||||||
# Compute proof at an arbitrary point (for both forms)
|
# Compute proof at an arbitrary point (for both forms)
|
||||||
|
|
||||||
x = ckzg.fr_from_uint64s((39, 100, 8, 0))
|
x = ckzg.fr_from_uint64s((39, 100, 8, 0))
|
||||||
ret, π = ckzg.compute_proof_single(p, x, ks)
|
ret, π = ckzg.compute_proof_single(p, x, ks)
|
||||||
assert ret == 0
|
assert ret == 0
|
||||||
|
@ -122,6 +123,13 @@ ret, res = ckzg.check_proof_single(commitment_l, π_l, x, v, ks)
|
||||||
assert ret == 0
|
assert ret == 0
|
||||||
assert res
|
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.")
|
print("All tests passed.")
|
||||||
|
|
||||||
# We need to manually free the C allocated arrays
|
# We need to manually free the C allocated arrays
|
||||||
|
|
Loading…
Reference in New Issue