Skip to content

Commit

Permalink
Apply @dankrad's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
hwwhww committed May 7, 2024
1 parent 950136c commit fdad206
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions specs/_features/eip7594/das-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,18 @@ def get_custody_columns(node_id: NodeID, custody_subnet_count: uint64) -> Sequen
assert custody_subnet_count <= DATA_COLUMN_SIDECAR_SUBNET_COUNT

subnet_ids: List[uint64] = []
i = uint256(node_id)
current_id = uint256(node_id)
while len(subnet_ids) < custody_subnet_count:
# Overflow prevention
if i == UINT256_MAX:
i = NodeID(0)

subnet_id = (
bytes_to_uint64(hash(uint_to_bytes(uint256(i)))[0:8])
bytes_to_uint64(hash(uint_to_bytes(uint256(current_id)))[0:8])
% DATA_COLUMN_SIDECAR_SUBNET_COUNT
)
if subnet_id not in subnet_ids:
subnet_ids.append(subnet_id)
i += 1
if current_id == UINT256_MAX:
# Overflow prevention
current_id = NodeID(0)
current_id += 1

assert len(subnet_ids) == len(set(subnet_ids))

Expand Down

0 comments on commit fdad206

Please sign in to comment.