Test verifying aggregate proof of nothing

This commit is contained in:
dancoffman 2022-11-17 15:49:12 -08:00
parent fe622a7171
commit 0b019d6a67
No known key found for this signature in database
GPG Key ID: 47B1F53E36A9B3CC
1 changed files with 8 additions and 1 deletions

View File

@ -40,7 +40,8 @@ describe("C-KZG", () => {
});
it("returns the identity (aka zero, aka neutral) element when blobs is an empty array", () => {
expect(computeAggregateKzgProof([]).toString()).toEqual(
const aggregateProofOfNothing = computeAggregateKzgProof([]);
expect(aggregateProofOfNothing.toString()).toEqual(
[
192, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -49,6 +50,12 @@ describe("C-KZG", () => {
);
});
it("verifies the aggregate proof of empty blobs and commitments", () => {
expect(verifyAggregateKzgProof([], [], computeAggregateKzgProof([]))).toBe(
true,
);
});
it("computes the aggregate proof when for a single blob", () => {
let blobs = new Array(1).fill(0).map(generateRandomBlob);
let commitments = blobs.map(blobToKzgCommitment);