mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 13:54:44 +00:00
Add fast full-list shuffle for swap-or-not
- Passes test vectors - Implemented in beacon state - Added more docs
This commit is contained in:
@@ -12,7 +12,7 @@ use rand::RngCore;
|
||||
use serde_derive::Serialize;
|
||||
use ssz::{hash, Decodable, DecodeError, Encodable, SszStream, TreeHash};
|
||||
use std::collections::HashMap;
|
||||
use swap_or_not_shuffle::get_permutated_list;
|
||||
use swap_or_not_shuffle::shuffle_list;
|
||||
|
||||
pub use builder::BeaconStateBuilder;
|
||||
|
||||
@@ -423,10 +423,11 @@ impl BeaconState {
|
||||
let active_validator_indices: Vec<usize> =
|
||||
active_validator_indices.iter().cloned().collect();
|
||||
|
||||
let shuffled_active_validator_indices = get_permutated_list(
|
||||
&active_validator_indices,
|
||||
&seed[..],
|
||||
let shuffled_active_validator_indices = shuffle_list(
|
||||
active_validator_indices,
|
||||
spec.shuffle_round_count,
|
||||
&seed[..],
|
||||
true,
|
||||
)
|
||||
.ok_or_else(|| Error::UnableToShuffle)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user