diff --git a/Cargo.lock b/Cargo.lock index 98f6873f7b3f..85aa73c5c86c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14724,15 +14724,10 @@ dependencies = [ name = "pallet-recovery" version = "28.0.0" dependencies = [ - "frame-benchmarking 28.0.0", - "frame-support 28.0.0", - "frame-system 28.0.0", "pallet-balances 28.0.0", "parity-scale-codec", + "polkadot-sdk-frame 0.1.0", "scale-info", - "sp-core 28.0.0", - "sp-io 30.0.0", - "sp-runtime 31.0.1", ] [[package]] diff --git a/substrate/frame/recovery/Cargo.toml b/substrate/frame/recovery/Cargo.toml index 44335e8f575c..e16c2d535cb7 100644 --- a/substrate/frame/recovery/Cargo.toml +++ b/substrate/frame/recovery/Cargo.toml @@ -18,40 +18,24 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { features = ["derive"], workspace = true } scale-info = { features = ["derive"], workspace = true } -frame-benchmarking = { optional = true, workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } -sp-io = { workspace = true } -sp-runtime = { workspace = true } +frame = { workspace = true, features = ["experimental", "runtime"] } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } -sp-core = { workspace = true, default-features = true } [features] default = ["std"] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", + "frame/runtime-benchmarks", "pallet-balances/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", - 'frame-benchmarking', ] std = [ "codec/std", - "frame-benchmarking?/std", - "frame-support/std", - "frame-system/std", + "frame/std", "pallet-balances/std", "scale-info/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", ] try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", + "frame/try-runtime", "pallet-balances/try-runtime", - "sp-runtime/try-runtime", ] diff --git a/substrate/frame/recovery/src/benchmarking.rs b/substrate/frame/recovery/src/benchmarking.rs index ee97cb77d301..f8889bbda4f2 100644 --- a/substrate/frame/recovery/src/benchmarking.rs +++ b/substrate/frame/recovery/src/benchmarking.rs @@ -21,10 +21,7 @@ use super::*; use crate::Pallet; use alloc::{boxed::Box, vec, vec::Vec}; -use frame_benchmarking::v2::*; -use frame_support::traits::{Currency, Get}; -use frame_system::RawOrigin; -use sp_runtime::traits::Bounded; +use frame::{benchmarking::prelude::*, traits::Currency}; const SEED: u32 = 0; const DEFAULT_DELAY: u32 = 0; diff --git a/substrate/frame/recovery/src/lib.rs b/substrate/frame/recovery/src/lib.rs index f8622880538e..9d41c688c3bf 100644 --- a/substrate/frame/recovery/src/lib.rs +++ b/substrate/frame/recovery/src/lib.rs @@ -155,15 +155,11 @@ extern crate alloc; use alloc::{boxed::Box, vec::Vec}; use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; -use sp_runtime::{ - traits::{CheckedAdd, CheckedMul, Dispatchable, SaturatedConversion, StaticLookup}, - RuntimeDebug, -}; -use frame_support::{ - dispatch::{GetDispatchInfo, PostDispatchInfo}, +use frame::{ + arithmetic::ArithmeticError, + prelude::*, traits::{BalanceStatus, Currency, ReservableCurrency}, - BoundedVec, }; pub use pallet::*; @@ -211,12 +207,12 @@ pub struct RecoveryConfig { threshold: u16, } -#[frame_support::pallet] +#[frame::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; - use sp_runtime::ArithmeticError; + // use frame_support::pallet_prelude::*; + // use frame_system::pallet_prelude::*; + // use sp_runtime::ArithmeticError; #[pallet::pallet] pub struct Pallet(_); diff --git a/substrate/frame/recovery/src/mock.rs b/substrate/frame/recovery/src/mock.rs index 8e30cbe997e1..db274680269d 100644 --- a/substrate/frame/recovery/src/mock.rs +++ b/substrate/frame/recovery/src/mock.rs @@ -18,17 +18,12 @@ //! Test utilities use super::*; - use crate as recovery; -use frame_support::{ - derive_impl, parameter_types, - traits::{OnFinalize, OnInitialize}, -}; -use sp_runtime::BuildStorage; +use frame::{deps::sp_io, testing_prelude::*}; type Block = frame_system::mocking::MockBlock; -frame_support::construct_runtime!( +construct_runtime!( pub enum Test { System: frame_system, diff --git a/substrate/frame/recovery/src/tests.rs b/substrate/frame/recovery/src/tests.rs index 93df07015852..7f4e676fecc8 100644 --- a/substrate/frame/recovery/src/tests.rs +++ b/substrate/frame/recovery/src/tests.rs @@ -18,12 +18,12 @@ //! Tests for the module. use super::*; -use frame_support::{assert_noop, assert_ok, traits::Currency}; -use mock::{ + +use crate::mock::{ new_test_ext, run_to_block, Balances, BalancesCall, MaxFriends, Recovery, RecoveryCall, RuntimeCall, RuntimeOrigin, Test, }; -use sp_runtime::{bounded_vec, traits::BadOrigin}; +use frame::{testing_prelude::*, traits::BadOrigin}; #[test] fn basic_setup_works() { diff --git a/substrate/frame/recovery/src/weights.rs b/substrate/frame/recovery/src/weights.rs index 38b085f0a293..ed2bf927d425 100644 --- a/substrate/frame/recovery/src/weights.rs +++ b/substrate/frame/recovery/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_recovery`. diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index 8031ddf96e6a..a842e52801dd 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -317,6 +317,8 @@ pub mod testing_prelude { pub use sp_io::TestExternalities; pub use sp_io::TestExternalities as TestState; + + pub use sp_runtime::bounded_vec; } /// All of the types and tools needed to build FRAME-based runtimes.