Skip to content

Commit 5111cbf

Browse files
authored
Merge pull request #3908 from pawanjay176/csc-u64
Peerdas Change csc types to uint64
2 parents aa3b140 + 88a7657 commit 5111cbf

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

specs/_features/eip7594/das-core.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ The following values are (non-configurable) constants used throughout the specif
6767

6868
| Name | Value | Description |
6969
| - | - | - |
70-
| `DATA_COLUMN_SIDECAR_SUBNET_COUNT` | `uint8(128)` | The number of data column sidecar subnets used in the gossipsub protocol |
70+
| `DATA_COLUMN_SIDECAR_SUBNET_COUNT` | `uint64(128)` | The number of data column sidecar subnets used in the gossipsub protocol |
7171

7272
### Custody setting
7373

@@ -105,15 +105,15 @@ class MatrixEntry(Container):
105105
### `get_custody_columns`
106106

107107
```python
108-
def get_custody_columns(node_id: NodeID, custody_subnet_count: uint8) -> Sequence[ColumnIndex]:
108+
def get_custody_columns(node_id: NodeID, custody_subnet_count: uint64) -> Sequence[ColumnIndex]:
109109
assert custody_subnet_count <= DATA_COLUMN_SIDECAR_SUBNET_COUNT
110110

111111
subnet_ids: List[uint64] = []
112112
current_id = uint256(node_id)
113113
while len(subnet_ids) < custody_subnet_count:
114114
subnet_id = (
115115
bytes_to_uint64(hash(uint_to_bytes(uint256(current_id)))[0:8])
116-
% int(DATA_COLUMN_SIDECAR_SUBNET_COUNT)
116+
% DATA_COLUMN_SIDECAR_SUBNET_COUNT
117117
)
118118
if subnet_id not in subnet_ids:
119119
subnet_ids.append(subnet_id)
@@ -124,9 +124,9 @@ def get_custody_columns(node_id: NodeID, custody_subnet_count: uint8) -> Sequenc
124124

125125
assert len(subnet_ids) == len(set(subnet_ids))
126126

127-
columns_per_subnet = NUMBER_OF_COLUMNS // int(DATA_COLUMN_SIDECAR_SUBNET_COUNT)
127+
columns_per_subnet = NUMBER_OF_COLUMNS // DATA_COLUMN_SIDECAR_SUBNET_COUNT
128128
return sorted([
129-
ColumnIndex(int(DATA_COLUMN_SIDECAR_SUBNET_COUNT) * i + subnet_id)
129+
ColumnIndex(DATA_COLUMN_SIDECAR_SUBNET_COUNT * i + subnet_id)
130130
for i in range(columns_per_subnet)
131131
for subnet_id in subnet_ids
132132
])

specs/_features/eip7594/p2p-interface.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,14 @@ The `MetaData` stored locally by clients is updated with an additional field to
119119
seq_number: uint64
120120
attnets: Bitvector[ATTESTATION_SUBNET_COUNT]
121121
syncnets: Bitvector[SYNC_COMMITTEE_SUBNET_COUNT]
122-
custody_subnet_count: uint8 # csc
122+
custody_subnet_count: uint64 # csc
123123
)
124124
```
125125

126126
Where
127127

128128
- `seq_number`, `attnets`, and `syncnets` have the same meaning defined in the Altair document.
129-
- `csc` represents the node's custody subnet count. Clients MAY reject ENRs with a value less than `CUSTODY_REQUIREMENT`.
129+
- `custody_subnet_count` represents the node's custody subnet count. Clients MAY reject peers with a value less than `CUSTODY_REQUIREMENT`.
130130

131131
### The gossip domain: gossipsub
132132

@@ -322,6 +322,6 @@ Requests the MetaData of a peer, using the new `MetaData` definition given above
322322

323323
A new field is added to the ENR under the key `csc` to facilitate custody data column discovery.
324324

325-
| Key | Value |
326-
|--------|-------------------------------------|
327-
| `csc` | Custody subnet count, uint8 integer |
325+
| Key | Value |
326+
|--------|------------------------------------------|
327+
| `csc` | Custody subnet count, `uint64` big endian integer with no leading zero bytes (`0` is encoded as empty byte string) |

tests/core/pyspec/eth2spec/test/eip7594/networking/test_get_custody_columns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def _run_get_custody_columns(spec, rng, node_id=None, custody_subnet_count=None)
2020

2121
assert len(result) == len(set(result))
2222
assert len(result) == (
23-
int(custody_subnet_count) * spec.config.NUMBER_OF_COLUMNS // int(spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT)
23+
custody_subnet_count * spec.config.NUMBER_OF_COLUMNS // spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT
2424
)
2525
assert all(i < spec.config.NUMBER_OF_COLUMNS for i in result)
2626
python_list_result = [int(i) for i in result]

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
spec_test,
44
with_eip7594_and_later,
55
)
6-
from eth2spec.utils.ssz.ssz_typing import uint8
76

87

98
@with_eip7594_and_later
@@ -13,10 +12,9 @@ def test_invariants(spec):
1312
assert spec.FIELD_ELEMENTS_PER_BLOB % spec.FIELD_ELEMENTS_PER_CELL == 0
1413
assert spec.FIELD_ELEMENTS_PER_EXT_BLOB % spec.config.NUMBER_OF_COLUMNS == 0
1514
assert spec.config.SAMPLES_PER_SLOT <= spec.config.NUMBER_OF_COLUMNS
16-
assert spec.config.NUMBER_OF_COLUMNS == uint8(spec.config.NUMBER_OF_COLUMNS) # ENR field is uint8
1715
assert spec.config.CUSTODY_REQUIREMENT <= spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT
1816
assert spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT <= spec.config.NUMBER_OF_COLUMNS
19-
assert spec.config.NUMBER_OF_COLUMNS % int(spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT) == 0
17+
assert spec.config.NUMBER_OF_COLUMNS % spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT == 0
2018
assert spec.config.MAX_REQUEST_DATA_COLUMN_SIDECARS == (
2119
spec.config.MAX_REQUEST_BLOCKS_DENEB * spec.config.NUMBER_OF_COLUMNS
2220
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
def run_get_custody_columns(spec, peer_count, custody_subnet_count):
1010
assignments = [spec.get_custody_columns(node_id, custody_subnet_count) for node_id in range(peer_count)]
1111

12-
columns_per_subnet = spec.config.NUMBER_OF_COLUMNS // int(spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT)
12+
columns_per_subnet = spec.config.NUMBER_OF_COLUMNS // spec.config.DATA_COLUMN_SIDECAR_SUBNET_COUNT
1313
for assignment in assignments:
14-
assert len(assignment) == int(custody_subnet_count) * columns_per_subnet
14+
assert len(assignment) == custody_subnet_count * columns_per_subnet
1515
assert len(assignment) == len(set(assignment))
1616

1717

0 commit comments

Comments
 (0)