From 267f8405702d1b2f808264a4c33456d7a67ffa53 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Fri, 15 Feb 2019 11:57:23 +1100 Subject: [PATCH] Add explicit assert to get_permutated_index There is an implicit assert in `int_to_bytes4`, however I think it's rather hidden. --- specs/core/0_beacon-chain.md | 1 + 1 file changed, 1 insertion(+) diff --git a/specs/core/0_beacon-chain.md b/specs/core/0_beacon-chain.md index a48d881fa..ee8eceee9 100644 --- a/specs/core/0_beacon-chain.md +++ b/specs/core/0_beacon-chain.md @@ -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