mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-15 03:56:29 +00:00
Add explicit assert to get_permutated_index
There is an implicit assert in `int_to_bytes4`, however I think it's rather hidden.
This commit is contained in:
parent
2be42ebbbf
commit
267f840570
@ -745,6 +745,7 @@ def get_permuted_index(index: int, list_size: int, seed: Bytes32) -> int:
|
||||
See the 'generalized domain' algorithm on page 3.
|
||||
"""
|
||||
assert index < list_size
|
||||
assert list_size < 2**24
|
||||
|
||||
for round in range(SHUFFLE_ROUND_COUNT):
|
||||
pivot = bytes_to_int(hash(seed + int_to_bytes1(round))[0:8]) % list_size
|
||||
|
Loading…
x
Reference in New Issue
Block a user