add fake proof test
This commit is contained in:
parent
c944251ca6
commit
f386e524c5
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue