Skip to content

Commit

Permalink
test: add verification to DataColumnSidecars tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Sep 9, 2024
1 parent 604ec24 commit dc44577
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/beacon-node/test/unit/util/kzg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,21 @@ describe("C-KZG", () => {
expect(sidecar.kzgProofs.length).toBe(blobs.length);
sidecar.column.forEach((cell, row) => {
expect(Uint8Array.from(cell)).toStrictEqual(mocks[row].cells[column]);
});
sidecar.kzgProofs.forEach((proof, row) => {
const proof = sidecar.kzgProofs[row];
expect(Uint8Array.from(proof)).toStrictEqual(mocks[row].proofs[column]);
const commitment = sidecar.kzgCommitments[row];
const cellIndex = sidecar.index;
expect(ckzg.verifyCellKzgProofBatch([commitment], [cellIndex], [cell], [proof])).toBeTruthy();
});
expect(
ckzg.verifyCellKzgProofBatch(
sidecar.kzgCommitments,
Array.from({length: sidecar.column.length}, () => sidecar.index),
sidecar.column,
sidecar.kzgProofs
)
).toBeTruthy();
});

const sideCarsPerBlob = sidecars.length / blobs.length;
while (sidecars.length > 0) {
const batch = sidecars.splice(0, sideCarsPerBlob);
const commitments = batch.map(({kzgCommitments}) => kzgCommitments).flat();
const cells = batch.map(({column}) => column).flat();
const proofs = batch.map(({kzgProofs}) => kzgProofs).flat();
ckzg.verifyCellKzgProofBatch(commitments, linspace(0, cells.length - 1), cells, proofs);
}
expect(sidecars.length).toBe(0);
});
});

Expand Down

0 comments on commit dc44577

Please sign in to comment.