cleanup
This commit is contained in:
parent
8baab40ea6
commit
6dab867848
|
@ -96,12 +96,9 @@ func get_shuffling*(seed: Eth2Digest,
|
||||||
# Share these buffers.
|
# Share these buffers.
|
||||||
pivot_buffer: array[(32+1), byte]
|
pivot_buffer: array[(32+1), byte]
|
||||||
source_buffer: array[(32+1+4), byte]
|
source_buffer: array[(32+1+4), byte]
|
||||||
shuffled_active_validator_indices = repeat(0.ValidatorIndex, list_size)
|
shuffled_active_validator_indices = mapIt(
|
||||||
sources = repeat(Eth2Digest(), (list_size div 256) + 1) # TODO if works, cleaner?
|
0 ..< list_size.int, it.ValidatorIndex)
|
||||||
|
sources = repeat(Eth2Digest(), max(list_size div 256, 1))
|
||||||
## TODO why isn't toSeq working? are there other options?
|
|
||||||
for i in 0 ..< list_size.int:
|
|
||||||
shuffled_active_validator_indices[i] = i.ValidatorIndex
|
|
||||||
|
|
||||||
## The pivot's a function of seed and round only.
|
## The pivot's a function of seed and round only.
|
||||||
## This doesn't change across rounds.
|
## This doesn't change across rounds.
|
||||||
|
@ -131,10 +128,6 @@ func get_shuffling*(seed: Eth2Digest,
|
||||||
flip = (pivot - cur_idx_permutated.uint64) mod list_size
|
flip = (pivot - cur_idx_permutated.uint64) mod list_size
|
||||||
position = max(cur_idx_permutated, flip.int)
|
position = max(cur_idx_permutated, flip.int)
|
||||||
|
|
||||||
if not ((position div 256) < sources.len):
|
|
||||||
debugEcho position, ", ", sources.len, ", ", list_size
|
|
||||||
assert (position div 256) < sources.len
|
|
||||||
|
|
||||||
let
|
let
|
||||||
source = sources[position div 256].data
|
source = sources[position div 256].data
|
||||||
byte_value = source[(position mod 256) div 8]
|
byte_value = source[(position mod 256) div 8]
|
||||||
|
|
Loading…
Reference in New Issue