From 92a2b20c0ee239de05fc5b76fc98d39d682b9bd1 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Sat, 28 Dec 2024 09:36:03 -0600 Subject: [PATCH] In get_custody_groups, don't skip 0 value --- specs/fulu/das-core.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/specs/fulu/das-core.md b/specs/fulu/das-core.md index 31c4af3c38..846f6b206e 100644 --- a/specs/fulu/das-core.md +++ b/specs/fulu/das-core.md @@ -105,19 +105,20 @@ class MatrixEntry(Container): def get_custody_groups(node_id: NodeID, custody_group_count: uint64) -> Sequence[CustodyIndex]: assert custody_group_count <= NUMBER_OF_CUSTODY_GROUPS - custody_groups: List[uint64] = [] current_id = uint256(node_id) + custody_groups: List[CustodyIndex] = [] while len(custody_groups) < custody_group_count: custody_group = CustodyIndex( - bytes_to_uint64(hash(uint_to_bytes(uint256(current_id)))[0:8]) + bytes_to_uint64(hash(uint_to_bytes(current_id))[0:8]) % NUMBER_OF_CUSTODY_GROUPS ) if custody_group not in custody_groups: custody_groups.append(custody_group) if current_id == UINT256_MAX: # Overflow prevention - current_id = NodeID(0) - current_id += 1 + current_id = uint256(0) + else: + current_id += 1 assert len(custody_groups) == len(set(custody_groups)) return sorted(custody_groups)