Update python test for encoding checks
We ensure we are below the modulus by just using a zero final byte for each field element encoding. In the test, I do not understand why changing the final (zero) byte causes verification to succeed instead of failing. But this is why the change is now to the first byte.
This commit is contained in:
parent
cfa36097a3
commit
4101648253
|
@ -7,7 +7,9 @@ BLOB_SIZE = 4096
|
||||||
MAX_BLOBS_PER_BLOCK = 16
|
MAX_BLOBS_PER_BLOCK = 16
|
||||||
|
|
||||||
blobs = [
|
blobs = [
|
||||||
random.randbytes(32 * BLOB_SIZE) for _ in range(3)
|
# use zero final bytes to easily ensure the encodings are valid
|
||||||
|
b''.join([b''.join([random.randbytes(31), bytes(1)]) for _ in range(BLOB_SIZE)])
|
||||||
|
for _ in range(3)
|
||||||
]
|
]
|
||||||
|
|
||||||
ts = ckzg.load_trusted_setup("../../src/trusted_setup.txt")
|
ts = ckzg.load_trusted_setup("../../src/trusted_setup.txt")
|
||||||
|
@ -26,8 +28,8 @@ assert ckzg.verify_aggregate_kzg_proof(blobs_bytes, kzg_commitments, proof, ts),
|
||||||
|
|
||||||
# Verification fails at wrong value
|
# Verification fails at wrong value
|
||||||
|
|
||||||
other = b'x' if not blobs_bytes.endswith(b'x') else b'y'
|
other = b'x' if not blobs_bytes.startswith(b'x') else b'y'
|
||||||
other_bytes = blobs_bytes[:-1] + other
|
other_bytes = other + blobs_bytes[1:]
|
||||||
|
|
||||||
assert not ckzg.verify_aggregate_kzg_proof(other_bytes, kzg_commitments, proof, ts), 'verify succeeded incorrectly'
|
assert not ckzg.verify_aggregate_kzg_proof(other_bytes, kzg_commitments, proof, ts), 'verify succeeded incorrectly'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue