From ffcd1e6409de08c00d3bd3a07ef460780d197a9f Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 23 May 2019 23:22:11 +1000 Subject: [PATCH] Clarify order-of-operations in shuffling --- eth2/utils/swap_or_not_shuffle/src/get_permutated_index.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth2/utils/swap_or_not_shuffle/src/get_permutated_index.rs b/eth2/utils/swap_or_not_shuffle/src/get_permutated_index.rs index f6b8065f89..8c62961805 100644 --- a/eth2/utils/swap_or_not_shuffle/src/get_permutated_index.rs +++ b/eth2/utils/swap_or_not_shuffle/src/get_permutated_index.rs @@ -41,7 +41,7 @@ pub fn get_permutated_index( } fn do_round(seed: &[u8], index: usize, pivot: usize, round: u8, list_size: usize) -> Option { - let flip = (pivot + list_size - index) % list_size; + let flip = (pivot + (list_size - index)) % list_size; let position = max(index, flip); let source = hash_with_round_and_position(seed, round, position)?; let byte = source[(position % 256) / 8];