diff --git a/bindings/java/src/test/java/CKZg4844JNITest.java b/bindings/java/src/test/java/CKZg4844JNITest.java index 78a1e2e..9e121b9 100644 --- a/bindings/java/src/test/java/CKZg4844JNITest.java +++ b/bindings/java/src/test/java/CKZg4844JNITest.java @@ -1,4 +1,5 @@ import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -35,6 +36,9 @@ public class CKZg4844JNITest { assertTrue(CKzg4844JNI.verifyAggregateKzgProof(blobs, commitments, 2, proof)); + final byte[] fakeProof = createRandomProof(); + assertFalse(CKzg4844JNI.verifyAggregateKzgProof(blobs, commitments, 2, fakeProof)); + CKzg4844JNI.freeTrustedSetup(); } @@ -100,6 +104,11 @@ public class CKZg4844JNITest { return blob; } + private byte[] createRandomProof() { + final byte[] blob = createRandomBlob(); + return CKzg4844JNI.computeAggregateKzgProof(blob, 1); + } + private byte[] flatten(byte[]... bytes) { final int capacity = Arrays.stream(bytes).mapToInt(b -> b.length).sum(); final ByteBuffer buffer = ByteBuffer.allocate(capacity);