From ab04cdd85dfdf343141a885e987b8ef8f524774a Mon Sep 17 00:00:00 2001 From: dancoffman Date: Thu, 3 Nov 2022 17:08:36 -0700 Subject: [PATCH] Add a test for mismatch --- bindings/node.js/Makefile | 2 +- bindings/node.js/test.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bindings/node.js/Makefile b/bindings/node.js/Makefile index 7311de7..092ab23 100644 --- a/bindings/node.js/Makefile +++ b/bindings/node.js/Makefile @@ -7,5 +7,5 @@ clean: build: kzg.cxx Makefile cd ../../src; make lib - yarn build + yarn cp build/Release/kzg.node . diff --git a/bindings/node.js/test.ts b/bindings/node.js/test.ts index d8eea2d..c71167e 100644 --- a/bindings/node.js/test.ts +++ b/bindings/node.js/test.ts @@ -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); + }); });