From e46c4c39fb0b3d2bf58f372a845e2d06968ef39c Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Fri, 19 Apr 2024 16:44:52 +0800 Subject: [PATCH 1/2] workaround: add a new config `MAX_EXTENDED_MATRIX_SIZE` to avoid `class Container(List[c, a*b])` --- configs/mainnet.yaml | 1 + configs/minimal.yaml | 1 + pysetup/spec_builders/eip7594.py | 1 + specs/_features/eip7594/das-core.md | 3 ++- .../eth2spec/test/eip7594/unittests/test_config_invariants.py | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index 55a973e9a9..56f1f89030 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -157,6 +157,7 @@ WHISK_PROPOSER_SELECTION_GAP: 2 # EIP7594 NUMBER_OF_COLUMNS: 128 +MAX_EXTENDED_MATRIX_SIZE: 768 DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 diff --git a/configs/minimal.yaml b/configs/minimal.yaml index 75e75ce9c2..d55e0c398f 100644 --- a/configs/minimal.yaml +++ b/configs/minimal.yaml @@ -155,6 +155,7 @@ WHISK_PROPOSER_SELECTION_GAP: 1 # EIP7594 NUMBER_OF_COLUMNS: 128 +MAX_EXTENDED_MATRIX_SIZE: 768 DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 diff --git a/pysetup/spec_builders/eip7594.py b/pysetup/spec_builders/eip7594.py index 414d73f327..9c5ce4fd91 100644 --- a/pysetup/spec_builders/eip7594.py +++ b/pysetup/spec_builders/eip7594.py @@ -19,6 +19,7 @@ def hardcoded_custom_type_dep_constants(cls, spec_object) -> str: '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_EXTENDED_MATRIX_SIZE': spec_object.config_vars['MAX_EXTENDED_MATRIX_SIZE'].value, } @classmethod diff --git a/specs/_features/eip7594/das-core.md b/specs/_features/eip7594/das-core.md index 6fee616477..61c79cfd2b 100644 --- a/specs/_features/eip7594/das-core.md +++ b/specs/_features/eip7594/das-core.md @@ -46,7 +46,7 @@ We define the following Python custom types for type hinting and readability: | Name | SSZ equivalent | Description | | - | - | - | | `DataColumn` | `List[Cell, MAX_BLOB_COMMITMENTS_PER_BLOCK]` | The data of each column in EIP-7594 | -| `ExtendedMatrix` | `List[Cell, MAX_BLOBS_PER_BLOCK * NUMBER_OF_COLUMNS]` | The full data of one-dimensional erasure coding extended blobs (in row major format) | +| `ExtendedMatrix` | `List[Cell, MAX_EXTENDED_MATRIX_SIZE]` | The full data of one-dimensional erasure coding extended blobs (in row major format). | ## Configuration @@ -55,6 +55,7 @@ We define the following Python custom types for type hinting and readability: | Name | Value | Description | | - | - | - | | `NUMBER_OF_COLUMNS` | `uint64(FIELD_ELEMENTS_PER_EXT_BLOB // FIELD_ELEMENTS_PER_CELL)` (= 128) | Number of columns in the extended data matrix. | +| `MAX_EXTENDED_MATRIX_SIZE` | `uint64(MAX_BLOBS_PER_BLOCK * NUMBER_OF_COLUMNS)` (= 768) | The data size of `ExtendedMatrix`. | ### Networking 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 999bc97b7f..e2ec28d74f 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,6 +18,7 @@ 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_EXTENDED_MATRIX_SIZE == spec.MAX_BLOBS_PER_BLOCK * spec.config.NUMBER_OF_COLUMNS @with_eip7594_and_later From 3f2d498cee5c8bb1db0f496d5b7b1a3d0c13e7f5 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Mon, 22 Apr 2024 13:02:42 +0100 Subject: [PATCH 2/2] rename --- configs/mainnet.yaml | 2 +- configs/minimal.yaml | 2 +- pysetup/spec_builders/eip7594.py | 2 +- specs/_features/eip7594/das-core.md | 4 ++-- .../eth2spec/test/eip7594/unittests/test_config_invariants.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configs/mainnet.yaml b/configs/mainnet.yaml index 56f1f89030..bbe9195135 100644 --- a/configs/mainnet.yaml +++ b/configs/mainnet.yaml @@ -157,7 +157,7 @@ WHISK_PROPOSER_SELECTION_GAP: 2 # EIP7594 NUMBER_OF_COLUMNS: 128 -MAX_EXTENDED_MATRIX_SIZE: 768 +MAX_CELLS_IN_EXTENDED_MATRIX: 768 DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 diff --git a/configs/minimal.yaml b/configs/minimal.yaml index d55e0c398f..99e84e5fbe 100644 --- a/configs/minimal.yaml +++ b/configs/minimal.yaml @@ -155,7 +155,7 @@ WHISK_PROPOSER_SELECTION_GAP: 1 # EIP7594 NUMBER_OF_COLUMNS: 128 -MAX_EXTENDED_MATRIX_SIZE: 768 +MAX_CELLS_IN_EXTENDED_MATRIX: 768 DATA_COLUMN_SIDECAR_SUBNET_COUNT: 32 MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384 diff --git a/pysetup/spec_builders/eip7594.py b/pysetup/spec_builders/eip7594.py index 9c5ce4fd91..3329378320 100644 --- a/pysetup/spec_builders/eip7594.py +++ b/pysetup/spec_builders/eip7594.py @@ -19,7 +19,7 @@ def hardcoded_custom_type_dep_constants(cls, spec_object) -> str: '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_EXTENDED_MATRIX_SIZE': spec_object.config_vars['MAX_EXTENDED_MATRIX_SIZE'].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 61c79cfd2b..379f1e4f6d 100644 --- a/specs/_features/eip7594/das-core.md +++ b/specs/_features/eip7594/das-core.md @@ -46,7 +46,7 @@ We define the following Python custom types for type hinting and readability: | Name | SSZ equivalent | Description | | - | - | - | | `DataColumn` | `List[Cell, MAX_BLOB_COMMITMENTS_PER_BLOCK]` | The data of each column in EIP-7594 | -| `ExtendedMatrix` | `List[Cell, MAX_EXTENDED_MATRIX_SIZE]` | The full data of one-dimensional erasure coding extended blobs (in row major format). | +| `ExtendedMatrix` | `List[Cell, MAX_CELLS_IN_EXTENDED_MATRIX]` | The full data of one-dimensional erasure coding extended blobs (in row major format). | ## Configuration @@ -55,7 +55,7 @@ We define the following Python custom types for type hinting and readability: | Name | Value | Description | | - | - | - | | `NUMBER_OF_COLUMNS` | `uint64(FIELD_ELEMENTS_PER_EXT_BLOB // FIELD_ELEMENTS_PER_CELL)` (= 128) | Number of columns in the extended data matrix. | -| `MAX_EXTENDED_MATRIX_SIZE` | `uint64(MAX_BLOBS_PER_BLOCK * NUMBER_OF_COLUMNS)` (= 768) | The data size of `ExtendedMatrix`. | +| `MAX_CELLS_IN_EXTENDED_MATRIX` | `uint64(MAX_BLOBS_PER_BLOCK * NUMBER_OF_COLUMNS)` (= 768) | The data size of `ExtendedMatrix`. | ### Networking 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 e2ec28d74f..9ad21d2624 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,7 @@ 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_EXTENDED_MATRIX_SIZE == spec.MAX_BLOBS_PER_BLOCK * spec.config.NUMBER_OF_COLUMNS + assert spec.config.MAX_CELLS_IN_EXTENDED_MATRIX == spec.MAX_BLOBS_PER_BLOCK * spec.config.NUMBER_OF_COLUMNS @with_eip7594_and_later