diff --git a/Cargo.lock b/Cargo.lock index 6151ed33c5b6..2ee5f1e401cb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16033,17 +16033,11 @@ dependencies = [ name = "pallet-whitelist" version = "27.0.0" dependencies = [ - "frame-benchmarking 28.0.0", - "frame-support 28.0.0", - "frame-system 28.0.0", "pallet-balances 28.0.0", "pallet-preimage 28.0.0", "parity-scale-codec", + "polkadot-sdk-frame 0.1.0", "scale-info", - "sp-api 26.0.0", - "sp-core 28.0.0", - "sp-io 30.0.0", - "sp-runtime 31.0.1", ] [[package]] diff --git a/substrate/frame/whitelist/Cargo.toml b/substrate/frame/whitelist/Cargo.toml index 68ecc5d0d78e..baeafedf701d 100644 --- a/substrate/frame/whitelist/Cargo.toml +++ b/substrate/frame/whitelist/Cargo.toml @@ -16,47 +16,29 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { features = ["derive", "max-encoded-len"], workspace = true } -frame-benchmarking = { optional = true, workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-api = { workspace = true } -sp-runtime = { workspace = true } +frame = { workspace = true, features = ["experimental", "runtime"] } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } pallet-preimage = { workspace = true, default-features = true } -sp-core = { workspace = true, default-features = true } -sp-io = { workspace = true, default-features = true } [features] default = ["std"] std = [ "codec/std", - "frame-benchmarking?/std", - "frame-support/std", - "frame-system/std", + "frame/std", "pallet-balances/std", "pallet-preimage/std", "scale-info/std", - "sp-api/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", ] runtime-benchmarks = [ - "frame-benchmarking", - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", + "frame/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-preimage/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", ] try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", + "frame/try-runtime", "pallet-balances/try-runtime", "pallet-preimage/try-runtime", - "sp-runtime/try-runtime", ] diff --git a/substrate/frame/whitelist/src/benchmarking.rs b/substrate/frame/whitelist/src/benchmarking.rs index 0d7605d9752b..46a310cb4073 100644 --- a/substrate/frame/whitelist/src/benchmarking.rs +++ b/substrate/frame/whitelist/src/benchmarking.rs @@ -20,11 +20,9 @@ #![cfg(feature = "runtime-benchmarks")] use super::*; -use frame_benchmarking::v2::*; -use frame_support::traits::EnsureOrigin; - #[cfg(test)] use crate::Pallet as Whitelist; +use frame::benchmarking::prelude::*; #[benchmarks] mod benchmarks { diff --git a/substrate/frame/whitelist/src/lib.rs b/substrate/frame/whitelist/src/lib.rs index 28887e0ca4ac..54f91af7c575 100644 --- a/substrate/frame/whitelist/src/lib.rs +++ b/substrate/frame/whitelist/src/lib.rs @@ -44,22 +44,17 @@ extern crate alloc; use alloc::boxed::Box; use codec::{DecodeLimit, Encode, FullCodec}; -use frame_support::{ - dispatch::{GetDispatchInfo, PostDispatchInfo}, - ensure, +use frame::{ + prelude::*, traits::{QueryPreimage, StorePreimage}, - weights::Weight, }; use scale_info::TypeInfo; -use sp_runtime::traits::{Dispatchable, Hash}; pub use pallet::*; -#[frame_support::pallet] +#[frame::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; #[pallet::config] pub trait Config: frame_system::Config { @@ -172,7 +167,7 @@ pub mod pallet { .map_err(|_| Error::::UnavailablePreImage)?; let call = ::RuntimeCall::decode_all_with_depth_limit( - sp_api::MAX_EXTRINSIC_DEPTH, + frame::deps::sp_api::MAX_EXTRINSIC_DEPTH, &mut &call[..], ) .map_err(|_| Error::::UndecodableCall)?; diff --git a/substrate/frame/whitelist/src/mock.rs b/substrate/frame/whitelist/src/mock.rs index 0a97d1c2df54..73e991e0766d 100644 --- a/substrate/frame/whitelist/src/mock.rs +++ b/substrate/frame/whitelist/src/mock.rs @@ -21,11 +21,8 @@ use crate as pallet_whitelist; -use frame_support::{construct_runtime, derive_impl}; -use frame_system::EnsureRoot; -use sp_runtime::BuildStorage; - -type Block = frame_system::mocking::MockBlock; +use frame::testing_prelude::*; +type Block = MockBlock; construct_runtime!( pub enum Test @@ -65,9 +62,9 @@ impl pallet_whitelist::Config for Test { type WeightInfo = (); } -pub fn new_test_ext() -> sp_io::TestExternalities { +pub fn new_test_ext() -> TestExternalities { let t = RuntimeGenesisConfig::default().build_storage().unwrap(); - let mut ext = sp_io::TestExternalities::new(t); + let mut ext = TestExternalities::new(t); ext.execute_with(|| System::set_block_number(1)); ext } diff --git a/substrate/frame/whitelist/src/tests.rs b/substrate/frame/whitelist/src/tests.rs index b53cc93b1953..4e591339a4c3 100644 --- a/substrate/frame/whitelist/src/tests.rs +++ b/substrate/frame/whitelist/src/tests.rs @@ -19,13 +19,10 @@ use crate::mock::*; use codec::Encode; -use frame_support::{ - assert_noop, assert_ok, - dispatch::GetDispatchInfo, +use frame::{ + testing_prelude::*, traits::{QueryPreimage, StorePreimage}, - weights::Weight, }; -use sp_runtime::{traits::Hash, DispatchError}; #[test] fn test_whitelist_call_and_remove() { diff --git a/substrate/frame/whitelist/src/weights.rs b/substrate/frame/whitelist/src/weights.rs index 12a18a8f0107..50e211c1e979 100644 --- a/substrate/frame/whitelist/src/weights.rs +++ b/substrate/frame/whitelist/src/weights.rs @@ -46,7 +46,7 @@ #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use frame::weights_prelude::*; use core::marker::PhantomData; /// Weight functions needed for `pallet_whitelist`.