Remove dependency on rand's SliceRandom shuffle implementation in gossip-support (#2555)
In gossip-support, we shuffled the list of authorities using the `rand::seq::SliceRandom::shuffle`. This function's behavior is unspecified beyond being `O(n)` and could change in the future, leading to network issues between nodes using different shuffling algorithms. In practice, the implementation was a Fisher-Yates shuffle. This PR replaces the call with a re-implementation of Fisher-Yates and adds a test to ensure the behavior is the same between the two at the moment.
Showing
- Cargo.lock 13 additions, 0 deletionsCargo.lock
- polkadot/node/network/gossip-support/Cargo.toml 1 addition, 0 deletionspolkadot/node/network/gossip-support/Cargo.toml
- polkadot/node/network/gossip-support/src/lib.rs 12 additions, 2 deletionspolkadot/node/network/gossip-support/src/lib.rs
- polkadot/node/network/gossip-support/src/tests.rs 22 additions, 0 deletionspolkadot/node/network/gossip-support/src/tests.rs
Please register or sign in to comment