Add a test for mismatch

This commit is contained in:
dancoffman 2022-11-03 17:08:36 -07:00
parent 32011119cd
commit ab04cdd85d
No known key found for this signature in database
GPG Key ID: 47B1F53E36A9B3CC
2 changed files with 9 additions and 1 deletions

View File

@ -7,5 +7,5 @@ clean:
build: kzg.cxx Makefile
cd ../../src; make lib
yarn build
yarn
cp build/Release/kzg.node .

View File

@ -42,4 +42,12 @@ describe("C-KZG", () => {
const proof = computeAggregateKzgProof(blobs);
expect(verifyAggregateKzgProof(blobs, commitments, proof)).toBe(true);
});
it.only("fails when given incorrect commitments", () => {
const blobs = new Array(2).fill(0).map(generateRandomBlob);
const commitments = blobs.map(blobToKzgCommitment);
commitments[0][0] += 1;
const proof = computeAggregateKzgProof(blobs);
expect(verifyAggregateKzgProof(blobs, commitments, proof)).toBe(false);
});
});