Added compute column kzg commitments
This commit is contained in:
parent
9bb5a6270f
commit
6d8a370ee7
|
@ -38,8 +38,8 @@ class DAEncoder:
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _compute_row_kzg_commitments(rows: Sequence[Row]) -> List[Tuple[Polynomial, Commitment]]:
|
def _compute_row_kzg_commitments(matrix: ChunksMatrix) -> List[Tuple[Polynomial, Commitment]]:
|
||||||
return [kzg.bytes_to_commitment(row.as_bytes(), GLOBAL_PARAMETERS) for row in rows]
|
return [kzg.bytes_to_commitment(row.as_bytes(), GLOBAL_PARAMETERS) for row in matrix]
|
||||||
|
|
||||||
def _rs_encode_rows(self, chunks_matrix: ChunksMatrix) -> ChunksMatrix:
|
def _rs_encode_rows(self, chunks_matrix: ChunksMatrix) -> ChunksMatrix:
|
||||||
def __rs_encode_row(row: Row) -> Row:
|
def __rs_encode_row(row: Row) -> Row:
|
||||||
|
@ -67,8 +67,8 @@ class DAEncoder:
|
||||||
)
|
)
|
||||||
return proofs
|
return proofs
|
||||||
|
|
||||||
def _compute_column_kzg_commitments(self, chunks_matrix: ChunksMatrix) -> List[Commitment]:
|
def _compute_column_kzg_commitments(self, chunks_matrix: ChunksMatrix) -> List[Tuple[Polynomial, Commitment]]:
|
||||||
...
|
return self._compute_row_kzg_commitments(chunks_matrix.transposed())
|
||||||
|
|
||||||
def _compute_aggregated_column_commitments(
|
def _compute_aggregated_column_commitments(
|
||||||
self, chunks_matrix: ChunksMatrix, column_commitments: List[Commitment]
|
self, chunks_matrix: ChunksMatrix, column_commitments: List[Commitment]
|
||||||
|
|
|
@ -43,8 +43,9 @@ class TestEncoder(TestCase):
|
||||||
|
|
||||||
def test_compute_row_kzg_commitments(self):
|
def test_compute_row_kzg_commitments(self):
|
||||||
chunks_matrix = self.encoder._chunkify_data(self.data)
|
chunks_matrix = self.encoder._chunkify_data(self.data)
|
||||||
commitments = self.encoder._compute_row_kzg_commitments(chunks_matrix)
|
polynomials, commitments = zip(*self.encoder._compute_row_kzg_commitments(chunks_matrix))
|
||||||
self.assertEqual(len(commitments), len(chunks_matrix))
|
self.assertEqual(len(commitments), len(chunks_matrix))
|
||||||
|
self.assertEqual(len(polynomials), len(chunks_matrix))
|
||||||
|
|
||||||
def test_rs_encode_rows(self):
|
def test_rs_encode_rows(self):
|
||||||
chunks_matrix = self.encoder._chunkify_data(self.data)
|
chunks_matrix = self.encoder._chunkify_data(self.data)
|
||||||
|
@ -74,7 +75,10 @@ class TestEncoder(TestCase):
|
||||||
self.assertTrue(kzg.verify_element_proof(BLSFieldElement.from_bytes(chunk), commitment, proofs[i], i, ROOTS_OF_UNITY))
|
self.assertTrue(kzg.verify_element_proof(BLSFieldElement.from_bytes(chunk), commitment, proofs[i], i, ROOTS_OF_UNITY))
|
||||||
|
|
||||||
def test_compute_column_kzg_commitments(self):
|
def test_compute_column_kzg_commitments(self):
|
||||||
pass
|
chunks_matrix = self.encoder._chunkify_data(self.data)
|
||||||
|
polynomials, commitments = zip(*self.encoder._compute_row_kzg_commitments(chunks_matrix.transposed()))
|
||||||
|
self.assertEqual(len(commitments), len(chunks_matrix))
|
||||||
|
self.assertEqual(len(polynomials), len(chunks_matrix))
|
||||||
|
|
||||||
def test_generate_aggregated_column_commitments(self):
|
def test_generate_aggregated_column_commitments(self):
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in New Issue