mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
runtime: use babe as randomness source (#2504)
* runtime: use babe as randomness source * runtime: fix randomness api * bridges: fix random_seed * parachains: use mock TestRandomness from frame_support_test * parachains: use mock TestRandomness from frame_support_test * runtime: update randomness source in test-runtime * runtime: remove unused import * parachains: add todo to audit usage of randomness api * "Update Substrate" Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -81,7 +81,7 @@ pub trait Config:
|
||||
+ hrmp::Config
|
||||
{
|
||||
/// A randomness beacon.
|
||||
type Randomness: Randomness<Self::Hash>;
|
||||
type Randomness: Randomness<Self::Hash, Self::BlockNumber>;
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
@@ -181,7 +181,9 @@ impl<T: Config> Module<T> {
|
||||
|
||||
let random_seed = {
|
||||
let mut buf = [0u8; 32];
|
||||
let random_hash = T::Randomness::random(&b"paras"[..]);
|
||||
// TODO: audit usage of randomness API
|
||||
// https://github.com/paritytech/polkadot/issues/2601
|
||||
let (random_hash, _) = T::Randomness::random(&b"paras"[..]);
|
||||
let len = sp_std::cmp::min(32, random_hash.as_ref().len());
|
||||
buf[..len].copy_from_slice(&random_hash.as_ref()[..len]);
|
||||
buf
|
||||
|
||||
Reference in New Issue
Block a user