From 4c8aee5068d0ed4b77381fc611e146078298ee7e Mon Sep 17 00:00:00 2001 From: Suphanat Chunhapanya Date: Sat, 27 Jul 2024 23:22:59 +0700 Subject: [PATCH] fixup! EIP-7594: Decouple network subnets from das-core --- specs/_features/eip7594/das-core.md | 5 +++-- specs/_features/eip7594/p2p-interface.md | 4 ++-- .../pyspec/eth2spec/test/eip7594/unittests/test_custody.py | 7 +++++++ .../networking/compute_columns_for_custody_group.md | 2 +- tests/formats/networking/get_custody_groups.md | 2 +- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/specs/_features/eip7594/das-core.md b/specs/_features/eip7594/das-core.md index b34dfe94ad..1bbcd0025a 100644 --- a/specs/_features/eip7594/das-core.md +++ b/specs/_features/eip7594/das-core.md @@ -78,7 +78,7 @@ The following values are (non-configurable) constants used throughout the specif | Name | Value | Description | | - | - | - | | `SAMPLES_PER_SLOT` | `8` | Number of `DataColumnSidecar` random samples a node queries per slot | -| `NUMBER_OF_CUSTODY_GROUPS` | `32` | Number of column groups nodes will custody. | +| `NUMBER_OF_CUSTODY_GROUPS` | `32` | Number of column groups available for nodes to custody | | `CUSTODY_REQUIREMENT` | `1` | Minimum number of custody groups an honest node custodies and serves samples from | | `TARGET_NUMBER_OF_PEERS` | `70` | Suggested minimum peer count | @@ -136,6 +136,7 @@ def get_custody_groups(node_id: NodeID, custody_group_count: uint64) -> Sequence ```python def compute_columns_for_custody_group(custody_group: CustodyIndex) -> Sequence[ColumnIndex]: + assert custody_group < NUMBER_OF_CUSTODY_GROUPS columns_per_group = NUMBER_OF_COLUMNS // NUMBER_OF_CUSTODY_GROUPS return sorted([ ColumnIndex(NUMBER_OF_CUSTODY_GROUPS * i + custody_group) @@ -271,7 +272,7 @@ def get_extended_sample_count(allowed_failures: uint64) -> uint64: ### Custody requirement -Columns are grouped in custody groups. Nodes custodying a custody group are supposed to custody all the columns in that group. +Columns are grouped into custody groups. Nodes custodying a custody group MUST custody all the columns in that group. Each node downloads and custodies a minimum of `CUSTODY_REQUIREMENT` custody groups per slot. The particular custody groups that the node is required to custody are selected pseudo-randomly (more on this below). diff --git a/specs/_features/eip7594/p2p-interface.md b/specs/_features/eip7594/p2p-interface.md index d412d67d79..3ed15e92c9 100644 --- a/specs/_features/eip7594/p2p-interface.md +++ b/specs/_features/eip7594/p2p-interface.md @@ -49,8 +49,8 @@ | Name | Value | Description | | - | - | - | | `DATA_COLUMN_SIDECAR_SUBNET_COUNT` | `128` | The number of data column sidecar subnets used in the gossipsub protocol | -| `MAX_REQUEST_DATA_COLUMN_SIDECARS` | `MAX_REQUEST_BLOCKS_DENEB * NUMBER_OF_COLUMNS` | Maximum number of data column sidecars in a single request | -| `MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS` | `2**12` (= 4096 epochs, ~18 days) | The minimum epoch range over which a node must serve data column sidecars | +| `MAX_REQUEST_DATA_COLUMN_SIDECARS` | `MAX_REQUEST_BLOCKS_DENEB * NUMBER_OF_COLUMNS` | Maximum number of data column sidecars in a single request | +| `MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS` | `2**12` (= 4096 epochs, ~18 days) | The minimum epoch range over which a node must serve data column sidecars | ### Containers diff --git a/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_custody.py b/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_custody.py index f8f2f8c906..7e7cef3421 100644 --- a/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_custody.py +++ b/tests/core/pyspec/eth2spec/test/eip7594/unittests/test_custody.py @@ -57,3 +57,10 @@ def test_get_custody_columns_custody_size_more_than_number_of_groups(spec): node_id = 1 custody_group_count = spec.config.NUMBER_OF_CUSTODY_GROUPS + 1 expect_assertion_error(lambda: spec.get_custody_groups(node_id, custody_group_count)) + + +@with_eip7594_and_later +@spec_test +@single_phase +def test_compute_columns_for_custody_group_out_of_bound_custody_group(spec): + expect_assertion_error(lambda: spec.compute_columns_for_custody_group(spec.config.NUMBER_OF_CUSTODY_GROUPS)) diff --git a/tests/formats/networking/compute_columns_for_custody_group.md b/tests/formats/networking/compute_columns_for_custody_group.md index afa4c58679..23e96025de 100644 --- a/tests/formats/networking/compute_columns_for_custody_group.md +++ b/tests/formats/networking/compute_columns_for_custody_group.md @@ -1,6 +1,6 @@ # `compute_columns_for_custody_group` tests -`compute_columns_for_custody_group` tests provide sanity check of the correctness of `compute_columns_for_custody_group` helper. +`compute_columns_for_custody_group` tests provide sanity checks for the correctness of the `compute_columns_for_custody_group` helper function. ## Test case format diff --git a/tests/formats/networking/get_custody_groups.md b/tests/formats/networking/get_custody_groups.md index 22c9d93a83..46206da85d 100644 --- a/tests/formats/networking/get_custody_groups.md +++ b/tests/formats/networking/get_custody_groups.md @@ -1,6 +1,6 @@ # `get_custody_groups` tests -`get_custody_groups` tests provide sanity check of the correctness of `get_custody_groups` helper. +`get_custody_groups` tests provide sanity checks for the correctness of the `get_custody_groups` helper function. ## Test case format