diff --git a/Cargo.lock b/Cargo.lock index 02d7da8f7657..3b5bad8037aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14929,18 +14929,15 @@ name = "pallet-safe-mode" version = "9.0.0" dependencies = [ "docify", - "frame-benchmarking 28.0.0", "frame-support 28.0.0", - "frame-system 28.0.0", "pallet-balances 28.0.0", "pallet-proxy 28.0.0", "pallet-utility 28.0.0", "parity-scale-codec", + "polkadot-sdk-frame 0.1.0", "scale-info", - "sp-arithmetic 23.0.0", "sp-core 28.0.0", "sp-io 30.0.0", - "sp-runtime 31.0.1", ] [[package]] diff --git a/substrate/frame/safe-mode/Cargo.toml b/substrate/frame/safe-mode/Cargo.toml index e7f165ae67d8..a78905f90011 100644 --- a/substrate/frame/safe-mode/Cargo.toml +++ b/substrate/frame/safe-mode/Cargo.toml @@ -17,12 +17,8 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { features = ["derive"], workspace = true } docify = { workspace = true } -frame-benchmarking = { optional = true, workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } +frame = { workspace = true, features = ["experimental", "runtime"] } scale-info = { features = ["derive"], workspace = true } -sp-arithmetic = { workspace = true } -sp-runtime = { workspace = true } pallet-balances = { optional = true, workspace = true } pallet-utility = { optional = true, workspace = true } pallet-proxy = { optional = true, workspace = true } @@ -39,32 +35,21 @@ frame-support = { features = ["experimental"], workspace = true, default-feature default = ["std"] std = [ "codec/std", - "frame-benchmarking/std", - "frame-support/std", - "frame-system/std", + "frame/std", "pallet-balances?/std", "pallet-proxy?/std", "pallet-utility?/std", "scale-info/std", - "sp-arithmetic/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", ] runtime-benchmarks = [ - "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", + "frame/runtime-benchmarks", "pallet-balances/runtime-benchmarks", "pallet-proxy/runtime-benchmarks", "pallet-utility/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", ] try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", + "frame/try-runtime", "pallet-balances?/try-runtime", "pallet-proxy?/try-runtime", "pallet-utility?/try-runtime", - "sp-runtime/try-runtime", ] diff --git a/substrate/frame/safe-mode/src/benchmarking.rs b/substrate/frame/safe-mode/src/benchmarking.rs index 7561cf305f45..8836fe70e7c7 100644 --- a/substrate/frame/safe-mode/src/benchmarking.rs +++ b/substrate/frame/safe-mode/src/benchmarking.rs @@ -19,10 +19,8 @@ use super::{Pallet as SafeMode, *}; -use frame_benchmarking::v2::*; -use frame_support::traits::{fungible, UnfilteredDispatchable}; -use frame_system::{Pallet as System, RawOrigin}; -use sp_runtime::traits::{Bounded, One, Zero}; +use frame::{benchmarking::prelude::*, traits::UnfilteredDispatchable}; +use frame::deps::frame_system::{Pallet as System, RawOrigin}; #[benchmarks(where T::Currency: fungible::Mutate)] mod benchmarks { diff --git a/substrate/frame/safe-mode/src/lib.rs b/substrate/frame/safe-mode/src/lib.rs index cfa9097b5412..a29a7cac71a7 100644 --- a/substrate/frame/safe-mode/src/lib.rs +++ b/substrate/frame/safe-mode/src/lib.rs @@ -75,9 +75,8 @@ pub mod mock; mod tests; pub mod weights; -use frame_support::{ - defensive_assert, - pallet_prelude::*, +use frame::{ + prelude::*, traits::{ fungible::{ self, @@ -86,12 +85,7 @@ use frame_support::{ tokens::{Fortitude, Precision}, CallMetadata, Contains, Defensive, GetCallMetadata, PalletInfoAccess, SafeModeNotify, }, - weights::Weight, - DefaultNoBound, }; -use frame_system::pallet_prelude::*; -use sp_arithmetic::traits::Zero; -use sp_runtime::traits::Saturating; pub use pallet::*; pub use weights::*; @@ -99,7 +93,7 @@ pub use weights::*; type BalanceOf = <::Currency as fungible::Inspect<::AccountId>>::Balance; -#[frame_support::pallet] +#[frame::pallet] pub mod pallet { use super::*; @@ -609,7 +603,7 @@ where } } -impl frame_support::traits::SafeMode for Pallet { +impl frame::traits::SafeMode for Pallet { type BlockNumber = BlockNumberFor; fn is_entered() -> bool { @@ -623,20 +617,20 @@ impl frame_support::traits::SafeMode for Pallet { }) } - fn enter(duration: BlockNumberFor) -> Result<(), frame_support::traits::SafeModeError> { + fn enter(duration: BlockNumberFor) -> Result<(), frame::traits::SafeModeError> { Self::do_enter(None, duration).map_err(Into::into) } - fn extend(duration: BlockNumberFor) -> Result<(), frame_support::traits::SafeModeError> { + fn extend(duration: BlockNumberFor) -> Result<(), frame::traits::SafeModeError> { Self::do_extend(None, duration).map_err(Into::into) } - fn exit() -> Result<(), frame_support::traits::SafeModeError> { + fn exit() -> Result<(), frame::traits::SafeModeError> { Self::do_exit(ExitReason::Force).map_err(Into::into) } } -impl From> for frame_support::traits::SafeModeError { +impl From> for frame::traits::SafeModeError { fn from(err: Error) -> Self { match err { Error::::Entered => Self::AlreadyEntered, diff --git a/substrate/frame/safe-mode/src/mock.rs b/substrate/frame/safe-mode/src/mock.rs index ec1ad8249514..d05ddee34015 100644 --- a/substrate/frame/safe-mode/src/mock.rs +++ b/substrate/frame/safe-mode/src/mock.rs @@ -22,16 +22,18 @@ use super::*; use crate as pallet_safe_mode; -use frame_support::{ - derive_impl, parameter_types, - traits::{ConstU64, Everything, InsideBoth, InstanceFilter, IsInVec, SafeModeNotify}, -}; -use frame_system::EnsureSignedBy; -use sp_core::H256; -use sp_runtime::{ - traits::{BlakeTwo256, IdentityLookup}, - BuildStorage, -}; +use frame::{deps::sp_io, testing_prelude::*}; +use frame::traits::{BlakeTwo256, IdentityLookup, ConstU64, Everything, InsideBoth, InstanceFilter, IsInVec, SafeModeNotify}; +// use frame_support::{ +// derive_impl, parameter_types, +// traits::{ConstU64, Everything, InsideBoth, InstanceFilter, IsInVec, SafeModeNotify}, +// }; +// use frame_system::EnsureSignedBy; +// use sp_core::H256; +// use sp_runtime::{ +// traits::{BlakeTwo256, IdentityLookup}, +// BuildStorage, +// }; #[derive_impl(frame_system::config_preludes::TestDefaultConfig)] impl frame_system::Config for Test { diff --git a/substrate/frame/safe-mode/src/tests.rs b/substrate/frame/safe-mode/src/tests.rs index c0a2f45a3e7a..1118272cf81b 100644 --- a/substrate/frame/safe-mode/src/tests.rs +++ b/substrate/frame/safe-mode/src/tests.rs @@ -22,8 +22,7 @@ use super::*; use crate::mock::{RuntimeCall, *}; -use frame_support::{assert_err, assert_noop, assert_ok, hypothetically_ok, traits::Currency}; -use sp_runtime::traits::Dispatchable; +use frame::{deps::frame_support::hypothetically_ok, testing_prelude::*, traits::Currency}; #[test] fn fails_to_filter_calls_to_safe_mode_pallet() { diff --git a/substrate/frame/safe-mode/src/weights.rs b/substrate/frame/safe-mode/src/weights.rs index 631853b19462..04169ec16f39 100644 --- a/substrate/frame/safe-mode/src/weights.rs +++ b/substrate/frame/safe-mode/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_safe_mode`.