mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-20 06:18:15 +00:00
Add cautionary assert in shuffling function (#622)
This commit is contained in:
parent
6c49270664
commit
d7fb7729e6
@ -744,6 +744,8 @@ def get_permuted_index(index: int, list_size: int, seed: Bytes32) -> int:
|
|||||||
https://link.springer.com/content/pdf/10.1007%2F978-3-642-32009-5_1.pdf
|
https://link.springer.com/content/pdf/10.1007%2F978-3-642-32009-5_1.pdf
|
||||||
See the 'generalized domain' algorithm on page 3.
|
See the 'generalized domain' algorithm on page 3.
|
||||||
"""
|
"""
|
||||||
|
assert index < list_size
|
||||||
|
|
||||||
for round in range(SHUFFLE_ROUND_COUNT):
|
for round in range(SHUFFLE_ROUND_COUNT):
|
||||||
pivot = bytes_to_int(hash(seed + int_to_bytes1(round))[0:8]) % list_size
|
pivot = bytes_to_int(hash(seed + int_to_bytes1(round))[0:8]) % list_size
|
||||||
flip = (pivot - index) % list_size
|
flip = (pivot - index) % list_size
|
||||||
|
Loading…
x
Reference in New Issue
Block a user