diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index 1c2911f8f..831d20afd 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -161,7 +161,6 @@ WHISK_PROPOSER_SELECTION_GAP: 2 # EIP7594 NUMBER_OF_COLUMNS: 128 -MAX_CELLS_IN_EXTENDED_MATRIX: 768 DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 SAMPLES_PER_SLOT: 8 diff --git a/configs/minimal.yaml b/configs/minimal.yaml index eb4f77aa2..e1f23b68e 100644 --- a/configs/minimal.yaml +++ b/configs/minimal.yaml @@ -160,7 +160,6 @@ WHISK_PROPOSER_SELECTION_GAP: 1 # EIP7594 NUMBER_OF_COLUMNS: 128 -MAX_CELLS_IN_EXTENDED_MATRIX: 768 DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 SAMPLES_PER_SLOT: 8 diff --git a/pysetup/spec_builders/eip7594.py b/pysetup/spec_builders/eip7594.py index dfbc427a7..109ad8736 100644 --- a/pysetup/spec_builders/eip7594.py +++ b/pysetup/spec_builders/eip7594.py @@ -27,7 +27,6 @@ def retrieve_column_sidecars(beacon_block_root: Root) -> Sequence[DataColumnSide 'FIELD_ELEMENTS_PER_CELL': spec_object.preset_vars['FIELD_ELEMENTS_PER_CELL'].value, 'FIELD_ELEMENTS_PER_EXT_BLOB': spec_object.preset_vars['FIELD_ELEMENTS_PER_EXT_BLOB'].value, 'NUMBER_OF_COLUMNS': spec_object.config_vars['NUMBER_OF_COLUMNS'].value, - 'MAX_CELLS_IN_EXTENDED_MATRIX': spec_object.config_vars['MAX_CELLS_IN_EXTENDED_MATRIX'].value, } @classmethod diff --git a/specs/_features/eip7594/das-core.md b/specs/_features/eip7594/das-core.md index 3d43db483..2096fb9a3 100644 --- a/specs/_features/eip7594/das-core.md +++ b/specs/_features/eip7594/das-core.md @@ -20,7 +20,7 @@ - [`MatrixEntry`](#matrixentry) - [Helper functions](#helper-functions) - [`get_custody_columns`](#get_custody_columns) - - [`compute_extended_matrix`](#compute_extended_matrix) + - [`compute_matrix`](#compute_matrix) - [`recover_matrix`](#recover_matrix) - [`get_data_column_sidecars`](#get_data_column_sidecars) - [Custody](#custody) @@ -62,7 +62,6 @@ The following values are (non-configurable) constants used throughout the specif | Name | Value | Description | | - | - | - | | `NUMBER_OF_COLUMNS` | `uint64(CELLS_PER_EXT_BLOB)` (= 128) | Number of columns in the extended data matrix | -| `MAX_CELLS_IN_EXTENDED_MATRIX` | `uint64(MAX_BLOBS_PER_BLOCK * NUMBER_OF_COLUMNS)` (= 768) | The data size of `ExtendedMatrix` | ### Networking @@ -133,54 +132,52 @@ def get_custody_columns(node_id: NodeID, custody_subnet_count: uint64) -> Sequen ]) ``` -### `compute_extended_matrix` +### `compute_matrix` ```python -def compute_extended_matrix(blobs: Sequence[Blob]) -> List[MatrixEntry, MAX_CELLS_IN_EXTENDED_MATRIX]: +def compute_matrix(blobs: Sequence[Blob]) -> Sequence[MatrixEntry]: """ - Return the full ``ExtendedMatrix``. + Return the full, flattened sequence of matrix entries. - This helper demonstrates the relationship between blobs and ``ExtendedMatrix``. - The data structure for storing cells is implementation-dependent. + This helper demonstrates the relationship between blobs and the matrix of cells/proofs. + The data structure for storing cells/proofs is implementation-dependent. """ - extended_matrix = [] + matrix = [] for blob_index, blob in enumerate(blobs): cells, proofs = compute_cells_and_kzg_proofs(blob) for cell_index, (cell, proof) in enumerate(zip(cells, proofs)): - extended_matrix.append(MatrixEntry( + matrix.append(MatrixEntry( cell=cell, kzg_proof=proof, row_index=blob_index, column_index=cell_index, )) - return extended_matrix + return matrix ``` ### `recover_matrix` ```python -def recover_matrix(partial_matrix: Sequence[MatrixEntry], - blob_count: uint64) -> List[MatrixEntry, MAX_CELLS_IN_EXTENDED_MATRIX]: +def recover_matrix(partial_matrix: Sequence[MatrixEntry], blob_count: uint64) -> Sequence[MatrixEntry]: """ - Return the recovered extended matrix. + Recover the full, flattened sequence of matrix entries. This helper demonstrates how to apply ``recover_cells_and_kzg_proofs``. - The data structure for storing cells is implementation-dependent. + The data structure for storing cells/proofs is implementation-dependent. """ - extended_matrix = [] + matrix = [] for blob_index in range(blob_count): cell_indices = [e.column_index for e in partial_matrix if e.row_index == blob_index] cells = [e.cell for e in partial_matrix if e.row_index == blob_index] - recovered_cells, recovered_proofs = recover_cells_and_kzg_proofs(cell_indices, cells) for cell_index, (cell, proof) in enumerate(zip(recovered_cells, recovered_proofs)): - extended_matrix.append(MatrixEntry( + matrix.append(MatrixEntry( cell=cell, kzg_proof=proof, row_index=blob_index, column_index=cell_index, )) - return extended_matrix + return matrix ``` ### `get_data_column_sidecars` @@ -241,7 +238,7 @@ At each slot, a node advertising `custody_subnet_count` downloads a minimum of ` ## Extended data -In this construction, we extend the blobs using a one-dimensional erasure coding extension. The matrix comprises maximum `MAX_BLOBS_PER_BLOCK` rows and fixed `NUMBER_OF_COLUMNS` columns, with each row containing a `Blob` and its corresponding extension. `compute_extended_matrix` demonstrates the relationship between blobs and custom type `ExtendedMatrix`. +In this construction, we extend the blobs using a one-dimensional erasure coding extension. The matrix comprises maximum `MAX_BLOBS_PER_BLOCK` rows and fixed `NUMBER_OF_COLUMNS` columns, with each row containing a `Blob` and its corresponding extension. `compute_matrix` demonstrates the relationship between blobs and the matrix, a potential method of storing cells/proofs. ## Column gossip diff --git a/tests/core/pyspec/eth2spec/test/eip7594/unittests/das/test_das.py b/tests/core/pyspec/eth2spec/test/eip7594/unittests/das/test_das.py index 7110f2373..625136b73 100644 --- a/tests/core/pyspec/eth2spec/test/eip7594/unittests/das/test_das.py +++ b/tests/core/pyspec/eth2spec/test/eip7594/unittests/das/test_das.py @@ -19,15 +19,15 @@ def chunks(lst, n): @with_eip7594_and_later @spec_test @single_phase -def test_compute_extended_matrix(spec): +def test_compute_matrix(spec): rng = random.Random(5566) blob_count = 2 input_blobs = [get_sample_blob(spec, rng=rng) for _ in range(blob_count)] - extended_matrix = spec.compute_extended_matrix(input_blobs) - assert len(extended_matrix) == spec.CELLS_PER_EXT_BLOB * blob_count + matrix = spec.compute_matrix(input_blobs) + assert len(matrix) == spec.CELLS_PER_EXT_BLOB * blob_count - rows = chunks(extended_matrix, spec.CELLS_PER_EXT_BLOB) + rows = chunks(matrix, spec.CELLS_PER_EXT_BLOB) assert len(rows) == blob_count for row in rows: assert len(row) == spec.CELLS_PER_EXT_BLOB @@ -53,11 +53,11 @@ def test_recover_matrix(spec): # Compute an extended matrix with two blobs blob_count = 2 blobs = [get_sample_blob(spec, rng=rng) for _ in range(blob_count)] - extended_matrix = spec.compute_extended_matrix(blobs) + matrix = spec.compute_matrix(blobs) # Construct a matrix with some entries missing partial_matrix = [] - for blob_entries in chunks(extended_matrix, spec.CELLS_PER_EXT_BLOB): + for blob_entries in chunks(matrix, spec.CELLS_PER_EXT_BLOB): rng.shuffle(blob_entries) partial_matrix.extend(blob_entries[:N_SAMPLES]) @@ -65,7 +65,7 @@ def test_recover_matrix(spec): recovered_matrix = spec.recover_matrix(partial_matrix, blob_count) # Ensure that the recovered matrix matches the original matrix - assert recovered_matrix == extended_matrix + assert recovered_matrix == matrix @with_eip7594_and_later diff --git a/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py b/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py index 776ea883a..fc54cc308 100644 --- a/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py +++ b/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py @@ -18,7 +18,6 @@ def test_invariants(spec): assert spec.config.MAX_REQUEST_DATA_COLUMN_SIDECARS == ( spec.config.MAX_REQUEST_BLOCKS_DENEB * spec.config.NUMBER_OF_COLUMNS ) - assert spec.config.MAX_CELLS_IN_EXTENDED_MATRIX == spec.config.MAX_BLOBS_PER_BLOCK * spec.config.NUMBER_OF_COLUMNS @with_eip7594_and_later