diff --git a/Cargo.lock b/Cargo.lock index f2379d4ee6de..999d476aa78c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13800,16 +13800,11 @@ dependencies = [ name = "pallet-indices" 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-keyring 31.0.0", - "sp-runtime 31.0.1", ] [[package]] diff --git a/substrate/frame/indices/Cargo.toml b/substrate/frame/indices/Cargo.toml index d81b2d5cabf1..59f5a9641748 100644 --- a/substrate/frame/indices/Cargo.toml +++ b/substrate/frame/indices/Cargo.toml @@ -18,13 +18,8 @@ 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-core = { workspace = true } -sp-io = { workspace = true } +frame = { workspace = true, features = ["experimental", "runtime"] } sp-keyring = { optional = true, workspace = true } -sp-runtime = { workspace = true } [dev-dependencies] pallet-balances = { workspace = true, default-features = true } @@ -33,27 +28,17 @@ pallet-balances = { workspace = true, default-features = true } default = ["std"] 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-keyring", "sp-keyring?/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", - "sp-runtime/runtime-benchmarks", ] 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/indices/src/benchmarking.rs b/substrate/frame/indices/src/benchmarking.rs index 28f5e3bf5cf0..85a3243ff9ec 100644 --- a/substrate/frame/indices/src/benchmarking.rs +++ b/substrate/frame/indices/src/benchmarking.rs @@ -20,10 +20,7 @@ #![cfg(feature = "runtime-benchmarks")] use crate::*; -use frame_benchmarking::v2::*; -use frame_system::RawOrigin; -use sp_runtime::traits::Bounded; - +use frame::benchmarking::prelude::*; const SEED: u32 = 0; #[benchmarks] diff --git a/substrate/frame/indices/src/lib.rs b/substrate/frame/indices/src/lib.rs index 740d69365df3..6dfc062e9c3b 100644 --- a/substrate/frame/indices/src/lib.rs +++ b/substrate/frame/indices/src/lib.rs @@ -29,11 +29,7 @@ extern crate alloc; use alloc::vec::Vec; use codec::Codec; -use frame_support::traits::{BalanceStatus::Reserved, Currency, ReservableCurrency}; -use sp_runtime::{ - traits::{AtLeast32Bit, LookupError, Saturating, StaticLookup, Zero}, - MultiAddress, -}; +use frame::prelude::*; pub use weights::WeightInfo; type BalanceOf = @@ -42,11 +38,9 @@ type AccountIdLookupOf = <::Lookup as StaticLookup pub use pallet::*; -#[frame_support::pallet] +#[frame::pallet] pub mod pallet { use super::*; - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; /// The module's config trait. #[pallet::config] @@ -265,7 +259,7 @@ pub mod pallet { StorageMap<_, Blake2_128Concat, T::AccountIndex, (T::AccountId, BalanceOf, bool)>; #[pallet::genesis_config] - #[derive(frame_support::DefaultNoBound)] + #[derive(DefaultNoBound)] pub struct GenesisConfig { pub indices: Vec<(T::AccountIndex, T::AccountId)>, } diff --git a/substrate/frame/indices/src/mock.rs b/substrate/frame/indices/src/mock.rs index 72bbc6dab4a4..e99fc875e755 100644 --- a/substrate/frame/indices/src/mock.rs +++ b/substrate/frame/indices/src/mock.rs @@ -20,12 +20,11 @@ #![cfg(test)] use crate::{self as pallet_indices, Config}; -use frame_support::{derive_impl, traits::ConstU64}; -use sp_runtime::BuildStorage; +use frame::testing_prelude::*; type Block = frame_system::mocking::MockBlock; -frame_support::construct_runtime!( +construct_runtime!( pub enum Test { System: frame_system, @@ -55,7 +54,7 @@ impl Config for Test { type WeightInfo = (); } -pub fn new_test_ext() -> sp_io::TestExternalities { +pub fn new_test_ext() -> TestExternalities { let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)], diff --git a/substrate/frame/indices/src/tests.rs b/substrate/frame/indices/src/tests.rs index 56b101900038..8b1651f632cb 100644 --- a/substrate/frame/indices/src/tests.rs +++ b/substrate/frame/indices/src/tests.rs @@ -20,9 +20,8 @@ #![cfg(test)] use super::{mock::*, *}; -use frame_support::{assert_noop, assert_ok}; +use frame::testing_prelude::*; use pallet_balances::Error as BalancesError; -use sp_runtime::MultiAddress::Id; #[test] fn claiming_should_work() { diff --git a/substrate/frame/indices/src/weights.rs b/substrate/frame/indices/src/weights.rs index 567e9bab54bd..5ba1ffc8b5d1 100644 --- a/substrate/frame/indices/src/weights.rs +++ b/substrate/frame/indices/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_indices`. diff --git a/substrate/frame/src/lib.rs b/substrate/frame/src/lib.rs index 8031ddf96e6a..b039d2d57994 100644 --- a/substrate/frame/src/lib.rs +++ b/substrate/frame/src/lib.rs @@ -216,6 +216,9 @@ pub mod prelude { /// All hashing related things pub use super::hashing::*; + /// All arithmetic types used for safe math. + pub use super::arithmetic::*; + /// Runtime traits #[doc(no_inline)] pub use sp_runtime::traits::{ @@ -223,9 +226,25 @@ pub mod prelude { Saturating, StaticLookup, TrailingZeroInput, }; + /// Bounded storage related types. + pub use sp_runtime::{BoundedSlice, BoundedVec}; + + /// Currency related traits and types. + pub use frame_support::traits::{ + BalanceStatus::{self, Reserved}, + Currency, + ExistenceRequirement::KeepAlive, + ReservableCurrency, + }; + + pub use super::address::*; + /// Other error/result types for runtime #[doc(no_inline)] - pub use sp_runtime::{DispatchErrorWithPostInfo, DispatchResultWithInfo, TokenError}; + pub use sp_runtime::{ + DispatchError::{self, BadOrigin}, + DispatchErrorWithPostInfo, DispatchResultWithInfo, TokenError, + }; } #[cfg(any(feature = "try-runtime", test))] @@ -532,6 +551,13 @@ pub mod hashing { pub use sp_runtime::traits::{BlakeTwo256, Hash, Keccak256}; } +pub mod address { + pub use sp_runtime::{ + traits::LookupError, + MultiAddress::{self, Id}, + }; +} + /// Access to all of the dependencies of this crate. In case the prelude re-exports are not enough, /// this module can be used. ///