Skip to content

Commit cecfd12

Browse files
authored
Make NUMBER_OF_COLUMNS a preset (#4485)
[As discussed on discord](https://discord.com/channels/595666850260713488/1401858592264552501), `NUMBER_OF_COLUMNS` should be a preset, not a configuration value. It's technically an alias of `CELLS_PER_EXT_BLOB` (preset) which is used in KZG libraries. I've also added the latter to the preset files as well so that it is more clear that it's an alias.
1 parent 347a656 commit cecfd12

File tree

8 files changed

+28
-19
lines changed

8 files changed

+28
-19
lines changed

configs/mainnet.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ MAX_BLOBS_PER_BLOCK_ELECTRA: 9
164164
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152
165165

166166
# Fulu
167-
NUMBER_OF_COLUMNS: 128
168167
NUMBER_OF_CUSTODY_GROUPS: 128
169168
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
170169
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384

configs/minimal.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ MAX_BLOBS_PER_BLOCK_ELECTRA: 9
161161
MAX_REQUEST_BLOB_SIDECARS_ELECTRA: 1152
162162

163163
# Fulu
164-
NUMBER_OF_COLUMNS: 128
165164
NUMBER_OF_CUSTODY_GROUPS: 128
166165
DATA_COLUMN_SIDECAR_SUBNET_COUNT: 128
167166
MAX_REQUEST_DATA_COLUMN_SIDECARS: 16384

presets/mainnet/fulu.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH: 4
1111
FIELD_ELEMENTS_PER_CELL: 64
1212
# 2**1 * FIELD_ELEMENTS_PER_BLOB (= 8,192)
1313
FIELD_ELEMENTS_PER_EXT_BLOB: 8192
14+
# FIELD_ELEMENTS_PER_EXT_BLOB // FIELD_ELEMENTS_PER_CELL (= 128)
15+
CELLS_PER_EXT_BLOB: 128
16+
# CELLS_PER_EXT_BLOB (= 128)
17+
NUMBER_OF_COLUMNS: 128

presets/minimal/fulu.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH: 4
1111
FIELD_ELEMENTS_PER_CELL: 64
1212
# 2**1 * FIELD_ELEMENTS_PER_BLOB (= 8,192)
1313
FIELD_ELEMENTS_PER_EXT_BLOB: 8192
14+
# FIELD_ELEMENTS_PER_EXT_BLOB // FIELD_ELEMENTS_PER_CELL (= 128)
15+
CELLS_PER_EXT_BLOB: 128
16+
# CELLS_PER_EXT_BLOB (= 128)
17+
NUMBER_OF_COLUMNS: 128

specs/fulu/das-core.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
- [Misc](#misc)
99
- [Custom types](#custom-types)
1010
- [Configuration](#configuration)
11-
- [Data size](#data-size)
1211
- [Custody setting](#custody-setting)
12+
- [Preset](#preset)
13+
- [Size parameters](#size-parameters)
1314
- [Containers](#containers)
1415
- [`DataColumnSidecar`](#datacolumnsidecar)
1516
- [`MatrixEntry`](#matrixentry)
@@ -54,12 +55,6 @@ specification.
5455

5556
## Configuration
5657

57-
### Data size
58-
59-
| Name | Value | Description |
60-
| ------------------- | ------------------------------------ | --------------------------------------------- |
61-
| `NUMBER_OF_COLUMNS` | `uint64(CELLS_PER_EXT_BLOB)` (= 128) | Number of columns in the extended data matrix |
62-
6358
### Custody setting
6459

6560
| Name | Value | Description |
@@ -68,6 +63,14 @@ specification.
6863
| `NUMBER_OF_CUSTODY_GROUPS` | `128` | Number of custody groups available for nodes to custody |
6964
| `CUSTODY_REQUIREMENT` | `4` | Minimum number of custody groups an honest node custodies and serves samples from |
7065

66+
## Preset
67+
68+
### Size parameters
69+
70+
| Name | Value | Description |
71+
| ------------------- | ------------------------------------ | --------------------------------------------- |
72+
| `NUMBER_OF_COLUMNS` | `uint64(CELLS_PER_EXT_BLOB)` (= 128) | Number of columns in the extended data matrix |
73+
7174
### Containers
7275

7376
#### `DataColumnSidecar`

tests/core/pyspec/eth2spec/test/fulu/networking/test_compute_columns_for_custody_group.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ def _run_compute_columns_for_custody_group(spec, rng, custody_group=None):
1515
yield "custody_group", "meta", custody_group
1616

1717
assert len(result) == len(set(result))
18-
assert len(result) == spec.config.NUMBER_OF_COLUMNS // spec.config.NUMBER_OF_CUSTODY_GROUPS
19-
assert all(i < spec.config.NUMBER_OF_COLUMNS for i in result)
18+
assert len(result) == spec.NUMBER_OF_COLUMNS // spec.config.NUMBER_OF_CUSTODY_GROUPS
19+
assert all(i < spec.NUMBER_OF_COLUMNS for i in result)
2020
python_list_result = [int(i) for i in result]
2121

2222
yield "result", "meta", python_list_result

tests/core/pyspec/eth2spec/test/fulu/unittests/test_config_invariants.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
@single_phase
1515
def test_invariants(spec):
1616
assert spec.FIELD_ELEMENTS_PER_BLOB % spec.FIELD_ELEMENTS_PER_CELL == 0
17-
assert spec.FIELD_ELEMENTS_PER_EXT_BLOB % spec.config.NUMBER_OF_COLUMNS == 0
18-
assert spec.config.SAMPLES_PER_SLOT <= spec.config.NUMBER_OF_COLUMNS
17+
assert spec.FIELD_ELEMENTS_PER_EXT_BLOB % spec.NUMBER_OF_COLUMNS == 0
18+
assert spec.config.SAMPLES_PER_SLOT <= spec.NUMBER_OF_COLUMNS
1919
assert spec.config.CUSTODY_REQUIREMENT <= spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT
20-
assert spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT <= spec.config.NUMBER_OF_COLUMNS
21-
assert spec.config.NUMBER_OF_COLUMNS % spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT == 0
20+
assert spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT <= spec.NUMBER_OF_COLUMNS
21+
assert spec.NUMBER_OF_COLUMNS % spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT == 0
2222
assert spec.config.MAX_REQUEST_DATA_COLUMN_SIDECARS == (
23-
spec.config.MAX_REQUEST_BLOCKS_DENEB * spec.config.NUMBER_OF_COLUMNS
23+
spec.config.MAX_REQUEST_BLOCKS_DENEB * spec.NUMBER_OF_COLUMNS
2424
)
2525

2626

tests/core/pyspec/eth2spec/test/fulu/unittests/test_custody.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def run_get_custody_columns(spec, peer_count, custody_group_count):
1111
spec.get_custody_groups(node_id, custody_group_count) for node_id in range(peer_count)
1212
]
1313

14-
columns_per_group = spec.config.NUMBER_OF_COLUMNS // spec.config.NUMBER_OF_CUSTODY_GROUPS
14+
columns_per_group = spec.NUMBER_OF_COLUMNS // spec.config.NUMBER_OF_CUSTODY_GROUPS
1515
for assignment in assignments:
1616
columns = []
1717
for group in assignment:
@@ -29,7 +29,7 @@ def run_get_custody_columns(spec, peer_count, custody_group_count):
2929
def test_get_custody_columns_peers_within_number_of_columns(spec):
3030
peer_count = 10
3131
custody_group_count = spec.config.CUSTODY_REQUIREMENT
32-
assert spec.config.NUMBER_OF_COLUMNS > peer_count
32+
assert spec.NUMBER_OF_COLUMNS > peer_count
3333
run_get_custody_columns(spec, peer_count, custody_group_count)
3434

3535

@@ -39,7 +39,7 @@ def test_get_custody_columns_peers_within_number_of_columns(spec):
3939
def test_get_custody_columns_peers_more_than_number_of_columns(spec):
4040
peer_count = 200
4141
custody_group_count = spec.config.CUSTODY_REQUIREMENT
42-
assert spec.config.NUMBER_OF_COLUMNS < peer_count
42+
assert spec.NUMBER_OF_COLUMNS < peer_count
4343
run_get_custody_columns(spec, peer_count, custody_group_count)
4444

4545

0 commit comments

Comments
 (0)