mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 15:55:49 +00:00
Remove implementation of Randomness for () (#6959)
This commit is contained in:
@@ -20,7 +20,8 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use frame_support::{
|
use frame_support::{
|
||||||
impl_outer_origin, parameter_types, ord_parameter_types, traits::{OnInitialize, OnFinalize}
|
impl_outer_origin, parameter_types, ord_parameter_types,
|
||||||
|
traits::{OnInitialize, OnFinalize, TestRandomness},
|
||||||
};
|
};
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
@@ -99,7 +100,7 @@ impl pallet_balances::Trait for Test {
|
|||||||
impl Trait for Test {
|
impl Trait for Test {
|
||||||
type Event = ();
|
type Event = ();
|
||||||
type Currency = pallet_balances::Module<Self>;
|
type Currency = pallet_balances::Module<Self>;
|
||||||
type Randomness = ();
|
type Randomness = TestRandomness;
|
||||||
type CandidateDeposit = CandidateDeposit;
|
type CandidateDeposit = CandidateDeposit;
|
||||||
type WrongSideDeduction = WrongSideDeduction;
|
type WrongSideDeduction = WrongSideDeduction;
|
||||||
type MaxStrikes = MaxStrikes;
|
type MaxStrikes = MaxStrikes;
|
||||||
|
|||||||
@@ -1345,7 +1345,10 @@ pub trait Randomness<Output> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<Output: Decode + Default> Randomness<Output> for () {
|
/// Provides an implementation of [`Randomness`] that should only be used in tests!
|
||||||
|
pub struct TestRandomness;
|
||||||
|
|
||||||
|
impl<Output: Decode + Default> Randomness<Output> for TestRandomness {
|
||||||
fn random(subject: &[u8]) -> Output {
|
fn random(subject: &[u8]) -> Output {
|
||||||
Output::decode(&mut TrailingZeroInput::new(subject)).unwrap_or_default()
|
Output::decode(&mut TrailingZeroInput::new(subject)).unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user