diff --git a/Cargo.lock b/Cargo.lock index b0fb0586be38..07267afc87de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13864,14 +13864,10 @@ dependencies = [ name = "pallet-insecure-randomness-collective-flip" version = "16.0.0" dependencies = [ - "frame-support 28.0.0", - "frame-system 28.0.0", "parity-scale-codec", + "polkadot-sdk-frame 0.1.0", "safe-mix", "scale-info", - "sp-core 28.0.0", - "sp-io 30.0.0", - "sp-runtime 31.0.1", ] [[package]] diff --git a/substrate/frame/insecure-randomness-collective-flip/Cargo.toml b/substrate/frame/insecure-randomness-collective-flip/Cargo.toml index 1682b52dfbf4..89481be78da3 100644 --- a/substrate/frame/insecure-randomness-collective-flip/Cargo.toml +++ b/substrate/frame/insecure-randomness-collective-flip/Cargo.toml @@ -17,30 +17,18 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { features = ["derive"], workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } safe-mix = { 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 } +frame = { workspace = true, features = ["experimental", "runtime"] } [features] default = ["std"] std = [ "codec/std", - "frame-support/std", - "frame-system/std", + "frame/std", "safe-mix/std", "scale-info/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", ] try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", - "sp-runtime/try-runtime", + "frame/try-runtime", ] diff --git a/substrate/frame/insecure-randomness-collective-flip/src/lib.rs b/substrate/frame/insecure-randomness-collective-flip/src/lib.rs index b605b4d08582..0e7e8001d5df 100644 --- a/substrate/frame/insecure-randomness-collective-flip/src/lib.rs +++ b/substrate/frame/insecure-randomness-collective-flip/src/lib.rs @@ -42,13 +42,11 @@ //! ### 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 { //! use super::*; -//! use frame_support::pallet_prelude::*; -//! use frame_system::pallet_prelude::*; //! //! #[pallet::pallet] //! pub struct Pallet(_); @@ -73,9 +71,7 @@ use safe_mix::TripletMix; use codec::Encode; -use frame_support::{pallet_prelude::Weight, traits::Randomness}; -use frame_system::pallet_prelude::BlockNumberFor; -use sp_runtime::traits::{Hash, Saturating}; +use frame::{prelude::*, traits::Randomness}; const RANDOM_MATERIAL_LEN: u32 = 81; @@ -87,10 +83,9 @@ fn block_number_to_index(block_number: BlockNumberFor) -> usize { pub use pallet::*; -#[frame_support::pallet] +#[frame::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; #[pallet::pallet] pub struct Pallet(_); @@ -167,19 +162,14 @@ impl Randomness> for Pallet { mod tests { use super::*; use crate as pallet_insecure_randomness_collective_flip; - - use sp_core::H256; - use sp_runtime::{traits::Header as _, BuildStorage}; - - use frame_support::{ - derive_impl, parameter_types, - traits::{OnInitialize, Randomness}, + use frame::{ + testing_prelude::{frame_system::limits, *}, + traits::Header as _, }; - use frame_system::limits; type Block = frame_system::mocking::MockBlock; - frame_support::construct_runtime!( + construct_runtime!( pub enum Test { System: frame_system, @@ -199,7 +189,7 @@ mod tests { 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::::default().build_storage().unwrap(); t.into() }