Skip to content
Snippets Groups Projects
Unverified Commit 89b02284 authored by FereMouSiopi's avatar FereMouSiopi Committed by GitHub
Browse files

Migrate `pallet-insecure-randomness-collective-flip` to umbrella crate (#6738)


Part of https://github.com/paritytech/polkadot-sdk/issues/6504

---------

Co-authored-by: command-bot <>
Co-authored-by: default avatarBastian Köcher <git@kchr.de>
parent fd64a1e7
No related merge requests found
Pipeline #512840 waiting for manual action with stages
in 30 minutes and 47 seconds
...@@ -13925,14 +13925,10 @@ dependencies = [ ...@@ -13925,14 +13925,10 @@ dependencies = [
name = "pallet-insecure-randomness-collective-flip" name = "pallet-insecure-randomness-collective-flip"
version = "16.0.0" version = "16.0.0"
dependencies = [ dependencies = [
"frame-support 28.0.0",
"frame-system 28.0.0",
"parity-scale-codec", "parity-scale-codec",
"polkadot-sdk-frame 0.1.0",
"safe-mix", "safe-mix",
"scale-info", "scale-info",
"sp-core 28.0.0",
"sp-io 30.0.0",
"sp-runtime 31.0.1",
] ]
   
[[package]] [[package]]
......
...@@ -17,30 +17,18 @@ targets = ["x86_64-unknown-linux-gnu"] ...@@ -17,30 +17,18 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies] [dependencies]
codec = { features = ["derive"], workspace = true } codec = { features = ["derive"], workspace = true }
frame-support = { workspace = true } frame = { workspace = true, features = ["runtime"] }
frame-system = { workspace = true }
safe-mix = { workspace = true } safe-mix = { workspace = true }
scale-info = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true }
sp-runtime = { workspace = true }
[dev-dependencies]
sp-core = { workspace = true, default-features = true }
sp-io = { workspace = true, default-features = true }
[features] [features]
default = ["std"] default = ["std"]
std = [ std = [
"codec/std", "codec/std",
"frame-support/std", "frame/std",
"frame-system/std",
"safe-mix/std", "safe-mix/std",
"scale-info/std", "scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
] ]
try-runtime = [ try-runtime = [
"frame-support/try-runtime", "frame/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
] ]
...@@ -42,13 +42,11 @@ ...@@ -42,13 +42,11 @@
//! ### Example - Get random seed for the current block //! ### Example - Get random seed for the current block
//! //!
//! ``` //! ```
//! use frame_support::traits::Randomness; //! use frame::{prelude::*, traits::Randomness};
//! //!
//! #[frame_support::pallet] //! #[frame::pallet]
//! pub mod pallet { //! pub mod pallet {
//! use super::*; //! use super::*;
//! use frame_support::pallet_prelude::*;
//! use frame_system::pallet_prelude::*;
//! //!
//! #[pallet::pallet] //! #[pallet::pallet]
//! pub struct Pallet<T>(_); //! pub struct Pallet<T>(_);
...@@ -73,9 +71,7 @@ ...@@ -73,9 +71,7 @@
use safe_mix::TripletMix; use safe_mix::TripletMix;
use codec::Encode; use codec::Encode;
use frame_support::{pallet_prelude::Weight, traits::Randomness}; use frame::{prelude::*, traits::Randomness};
use frame_system::pallet_prelude::BlockNumberFor;
use sp_runtime::traits::{Hash, Saturating};
const RANDOM_MATERIAL_LEN: u32 = 81; const RANDOM_MATERIAL_LEN: u32 = 81;
...@@ -87,10 +83,9 @@ fn block_number_to_index<T: Config>(block_number: BlockNumberFor<T>) -> usize { ...@@ -87,10 +83,9 @@ fn block_number_to_index<T: Config>(block_number: BlockNumberFor<T>) -> usize {
pub use pallet::*; pub use pallet::*;
#[frame_support::pallet] #[frame::pallet]
pub mod pallet { pub mod pallet {
use super::*; use super::*;
use frame_support::pallet_prelude::*;
#[pallet::pallet] #[pallet::pallet]
pub struct Pallet<T>(_); pub struct Pallet<T>(_);
...@@ -167,19 +162,14 @@ impl<T: Config> Randomness<T::Hash, BlockNumberFor<T>> for Pallet<T> { ...@@ -167,19 +162,14 @@ impl<T: Config> Randomness<T::Hash, BlockNumberFor<T>> for Pallet<T> {
mod tests { mod tests {
use super::*; use super::*;
use crate as pallet_insecure_randomness_collective_flip; use crate as pallet_insecure_randomness_collective_flip;
use frame::{
use sp_core::H256; testing_prelude::{frame_system::limits, *},
use sp_runtime::{traits::Header as _, BuildStorage}; traits::Header as _,
use frame_support::{
derive_impl, parameter_types,
traits::{OnInitialize, Randomness},
}; };
use frame_system::limits;
type Block = frame_system::mocking::MockBlock<Test>; type Block = frame_system::mocking::MockBlock<Test>;
frame_support::construct_runtime!( construct_runtime!(
pub enum Test pub enum Test
{ {
System: frame_system, System: frame_system,
...@@ -199,7 +189,7 @@ mod tests { ...@@ -199,7 +189,7 @@ mod tests {
impl pallet_insecure_randomness_collective_flip::Config for Test {} impl pallet_insecure_randomness_collective_flip::Config for Test {}
fn new_test_ext() -> sp_io::TestExternalities { fn new_test_ext() -> TestExternalities {
let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap(); let t = frame_system::GenesisConfig::<Test>::default().build_storage().unwrap();
t.into() t.into()
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment