Added missing test cases

This commit is contained in:
Daniel Sanchez Quiros 2024-02-08 15:25:07 +01:00
parent 312a46e209
commit 92c5a64b02
2 changed files with 22 additions and 3 deletions

View File

@ -25,7 +25,7 @@ class DAEncoder:
def __init__(self, params: DAEncoderParams): def __init__(self, params: DAEncoderParams):
self.params = params self.params = params
def _chunkify_data(self) -> List[bytearray]: def _chunkify_data(self, data: bytearray) -> List[bytearray]:
... ...
def _compute_row_kzg_commitments(self, rows: List[bytearray]) -> List[Commitment]: def _compute_row_kzg_commitments(self, rows: List[bytearray]) -> List[Commitment]:
@ -46,7 +46,7 @@ class DAEncoder:
... ...
def encode(self, data: bytearray) -> EncodedData: def encode(self, data: bytearray) -> EncodedData:
rows = self._chunkify_data() rows = self._chunkify_data(data)
row_commitments = self._compute_row_kzg_commitments(rows) row_commitments = self._compute_row_kzg_commitments(rows)
encoded_rows = self._rs_encode_rows(rows) encoded_rows = self._rs_encode_rows(rows)
row_proofs = self._compute_rows_proofs(encoded_rows, row_commitments) row_proofs = self._compute_rows_proofs(encoded_rows, row_commitments)

View File

@ -1,7 +1,8 @@
from typing import List
from unittest import TestCase from unittest import TestCase
from da import encoder from da import encoder
from da.encoder import DAEncoderParams from da.encoder import DAEncoderParams, Commitment
from eth2spec.eip7594.mainnet import BYTES_PER_FIELD_ELEMENT from eth2spec.eip7594.mainnet import BYTES_PER_FIELD_ELEMENT
@ -15,6 +16,24 @@ class TestEncoder(TestCase):
self.assertEqual(len(encoded_data.row_commitments), chunks_size) self.assertEqual(len(encoded_data.row_commitments), chunks_size)
self.assertEqual(len(encoded_data.row_proofs), chunks_size) self.assertEqual(len(encoded_data.row_proofs), chunks_size)
def test_chunkify(self):
pass
def test_compute_row_kzg_commitments(self, rows: List[bytearray]):
pass
def test_rs_encode_rows(self, rows: List[bytearray]):
pass
def test_compute_rows_proofs(self, rows: List[bytearray], row_commitments: List[bytearray]):
pass
def test_compute_column_kzg_commitments(self, rows: List[bytearray]):
pass
def test_generate_aggregated_column_commitments(self, rows: List[bytearray], column_commitments: List[Commitment]):
pass
def test_encode(self): def test_encode(self):
from random import randbytes from random import randbytes
sizes = [pow(2, exp) for exp in range(1, 8, 2)] sizes = [pow(2, exp) for exp in range(1, 8, 2)]