diff --git a/Cargo.lock b/Cargo.lock index 65853a3e29ee..429a18ca4703 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15461,25 +15461,11 @@ dependencies = [ name = "pallet-statement" version = "10.0.0" dependencies = [ - "frame-support 28.0.0", - "frame-system 28.0.0", "log", "pallet-balances 28.0.0", "parity-scale-codec", + "polkadot-sdk-frame 0.1.0", "scale-info", -<<<<<<< HEAD -======= - "sp-api 26.0.0", - "sp-core 28.0.0", - "sp-io 30.0.0", - "sp-runtime 31.0.1", -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> parent of fed7211911 (migrate pallet-statement to use umbrella crate) -======= ->>>>>>> parent of fed7211911 (migrate pallet-statement to use umbrella crate) -======= ->>>>>>> parent of fed7211911 (migrate pallet-statement to use umbrella crate) "sp-statement-store 10.0.0", ] @@ -15507,13 +15493,9 @@ version = "28.0.0" dependencies = [ "docify", "frame-benchmarking 28.0.0", - "frame-support 28.0.0", - "frame-system 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/statement/Cargo.toml b/substrate/frame/statement/Cargo.toml index 1500a7eec919..4774a5d60f2c 100644 --- a/substrate/frame/statement/Cargo.toml +++ b/substrate/frame/statement/Cargo.toml @@ -16,14 +16,9 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { features = ["derive"], workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } +frame = { workspace = true, features = ["experimental", "runtime"]} log = { workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-api = { workspace = true } -sp-core = { workspace = true } -sp-io = { workspace = true } -sp-runtime = { workspace = true } sp-statement-store = { workspace = true } [dev-dependencies] @@ -33,22 +28,13 @@ pallet-balances = { workspace = true, default-features = true } default = ["std"] std = [ "codec/std", - "frame-support/std", - "frame-system/std", + "frame/std", "log/std", "pallet-balances/std", "scale-info/std", - "sp-api/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", "sp-statement-store/std", ] try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", "pallet-balances/try-runtime", "frame/try-runtime", - "sp-runtime/try-runtime", - "sp-runtime/try-runtime", ] diff --git a/substrate/frame/statement/src/lib.rs b/substrate/frame/statement/src/lib.rs index 5434271cdeb9..7be1219dcd73 100644 --- a/substrate/frame/statement/src/lib.rs +++ b/substrate/frame/statement/src/lib.rs @@ -33,12 +33,12 @@ #![cfg_attr(not(feature = "std"), no_std)] -use frame::prelude::*; -use frame::deps::{sp_io, sp_statement_store::{ +use frame::{prelude::*, traits::fungible::Inspect, deps::sp_io}; +use sp_statement_store::{ runtime_api::{InvalidStatement, StatementSource, ValidStatement}, Proof, SignatureVerificationResult, Statement, -}}; -use frame::traits::fungible::Inspect; +}; + #[cfg(test)] mod mock; diff --git a/substrate/frame/statement/src/mock.rs b/substrate/frame/statement/src/mock.rs index 9b514afee3b6..a1c3546ac882 100644 --- a/substrate/frame/statement/src/mock.rs +++ b/substrate/frame/statement/src/mock.rs @@ -21,13 +21,6 @@ use super::*; use crate as pallet_statement; use frame::testing_prelude::*; -use frame::deps::{sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}, sp_core::Pair}; -use frame_support::{ - derive_impl, ord_parameter_types, - traits::{ConstU32, ConstU64}, -}; -use sp_core::Pair; -use sp_runtime::{traits::IdentityLookup, AccountId32, BuildStorage}; type Block = frame_system::mocking::MockBlock; @@ -36,7 +29,7 @@ pub const MAX_ALLOWED_STATEMENTS: u32 = 10; pub const MIN_ALLOWED_BYTES: u32 = 1024; pub const MAX_ALLOWED_BYTES: u32 = 4096; -frame_support::construct_runtime!( +construct_runtime!( pub enum Test { System: frame_system, @@ -74,12 +67,7 @@ impl Config for Test { type MaxAllowedBytes = ConstU32; } -<<<<<<< HEAD pub fn new_test_ext() -> TestState { -pub fn new_test_ext() -> sp_io::TestExternalities { -======= ->>>>>>> parent of fed7211911 (migrate pallet-statement to use umbrella crate) -pub fn new_test_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); let balances = pallet_balances::GenesisConfig:: { balances: vec![ diff --git a/substrate/frame/statement/src/tests.rs b/substrate/frame/statement/src/tests.rs index b0b5056cb791..14717a446e86 100644 --- a/substrate/frame/statement/src/tests.rs +++ b/substrate/frame/statement/src/tests.rs @@ -21,16 +21,12 @@ use super::*; use crate::mock::*; -use frame::deps::{sp_runtime::AccountId32, sp_core::{Pair, H256}, sp_statement_store::{ - runtime_api::{InvalidStatement, StatementSource, ValidStatement}, - Proof, Statement, -}}; -use sp_core::Pair; -use sp_runtime::AccountId32; +use frame::testing_prelude::*; use sp_statement_store::{ runtime_api::{InvalidStatement, StatementSource, ValidStatement}, Proof, Statement, }; + #[test] fn sign_and_validate_no_balance() { new_test_ext().execute_with(|| { diff --git a/substrate/frame/sudo/Cargo.toml b/substrate/frame/sudo/Cargo.toml index e2096bf0668a..788ac8de466c 100644 --- a/substrate/frame/sudo/Cargo.toml +++ b/substrate/frame/sudo/Cargo.toml @@ -17,38 +17,23 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] codec = { features = ["derive"], workspace = true } +frame = { workspace = true, features = ["experimental", "runtime"]} frame-benchmarking = { optional = true, workspace = true } -frame-support = { workspace = true } -frame-system = { workspace = true } scale-info = { features = ["derive"], workspace = true } -sp-io = { workspace = true } -sp-runtime = { workspace = true } docify = { workspace = true } -[dev-dependencies] -sp-core = { workspace = true, default-features = true } - [features] default = ["std"] std = [ "codec/std", + "frame/std", "frame-benchmarking?/std", - "frame-support/std", - "frame-system/std", "scale-info/std", - "sp-core/std", - "sp-io/std", - "sp-runtime/std", ] runtime-benchmarks = [ "frame-benchmarking/runtime-benchmarks", - "frame-support/runtime-benchmarks", - "frame-system/runtime-benchmarks", - "sp-runtime/runtime-benchmarks", ] try-runtime = [ - "frame-support/try-runtime", - "frame-system/try-runtime", - "sp-runtime/try-runtime", + "frame/try-runtime" ] diff --git a/substrate/frame/sudo/src/benchmarking.rs b/substrate/frame/sudo/src/benchmarking.rs index cf96562a30cf..2eb4b73ab5fa 100644 --- a/substrate/frame/sudo/src/benchmarking.rs +++ b/substrate/frame/sudo/src/benchmarking.rs @@ -20,10 +20,9 @@ use super::*; use crate::Pallet; use alloc::{boxed::Box, vec}; -use frame_benchmarking::v2::*; -use frame_support::dispatch::{DispatchInfo, GetDispatchInfo}; -use frame_system::RawOrigin; -use sp_runtime::traits::{ +use frame::prelude::*; +use frame::benchmarking::prelude::* +use frame::deps::sp_runtime::traits::{ AsSystemOriginSigner, AsTransactionAuthorizedOrigin, DispatchTransaction, Dispatchable, }; diff --git a/substrate/frame/sudo/src/extension.rs b/substrate/frame/sudo/src/extension.rs index d2669de79e54..b135e7590ce1 100644 --- a/substrate/frame/sudo/src/extension.rs +++ b/substrate/frame/sudo/src/extension.rs @@ -18,16 +18,8 @@ use crate::{Config, Key}; use codec::{Decode, Encode}; use core::{fmt, marker::PhantomData}; -use frame_support::{dispatch::DispatchInfo, ensure, pallet_prelude::TransactionSource}; use scale_info::TypeInfo; -use sp_runtime::{ - impl_tx_ext_default, - traits::{AsSystemOriginSigner, DispatchInfoOf, Dispatchable, TransactionExtension}, - transaction_validity::{ - InvalidTransaction, TransactionPriority, TransactionValidityError, UnknownTransaction, - ValidTransaction, - }, -}; +use frame::prelude::*; /// Ensure that signed transactions are only valid if they are signed by sudo account. /// diff --git a/substrate/frame/sudo/src/lib.rs b/substrate/frame/sudo/src/lib.rs index 66616bf801eb..6d0be216ec43 100644 --- a/substrate/frame/sudo/src/lib.rs +++ b/substrate/frame/sudo/src/lib.rs @@ -43,11 +43,10 @@ //! Here's an example of a privileged function in another pallet: //! //! ``` -//! #[frame_support::pallet] +//! #[frame::pallet] //! pub mod pallet { //! use super::*; -//! use frame_support::pallet_prelude::*; -//! use frame_system::pallet_prelude::*; +//! use frame::prelude::*; //! //! #[pallet::pallet] //! pub struct Pallet(_); @@ -125,9 +124,8 @@ extern crate alloc; use alloc::boxed::Box; -use sp_runtime::{traits::StaticLookup, DispatchResult}; +// use sp_runtime::{traits::StaticLookup, DispatchResult}; -use frame_support::{dispatch::GetDispatchInfo, traits::UnfilteredDispatchable}; mod extension; #[cfg(test)] @@ -145,11 +143,10 @@ pub use pallet::*; type AccountIdLookupOf = <::Lookup as StaticLookup>::Source; -#[frame_support::pallet] +#[frame::pallet] pub mod pallet { use super::{DispatchResult, *}; - use frame_support::pallet_prelude::*; - use frame_system::{pallet_prelude::*, RawOrigin}; + use frame::prelude::*; /// Default preludes for [`Config`]. pub mod config_preludes { @@ -162,7 +159,7 @@ pub mod pallet { #[derive_impl(frame_system::config_preludes::TestDefaultConfig, no_aggregated_types)] impl frame_system::DefaultConfig for TestDefaultConfig {} - #[frame_support::register_default_impl(TestDefaultConfig)] + #[frame::register_default_impl(TestDefaultConfig)] impl DefaultConfig for TestDefaultConfig { type WeightInfo = (); #[inject_runtime_type] @@ -335,7 +332,7 @@ pub mod pallet { pub(super) type Key = StorageValue<_, T::AccountId, OptionQuery>; #[pallet::genesis_config] - #[derive(frame_support::DefaultNoBound)] + #[derive(DefaultNoBound)] pub struct GenesisConfig { /// The `AccountId` of the sudo key. pub key: Option, diff --git a/substrate/frame/sudo/src/mock.rs b/substrate/frame/sudo/src/mock.rs index 67f896e1c021..444eab26554b 100644 --- a/substrate/frame/sudo/src/mock.rs +++ b/substrate/frame/sudo/src/mock.rs @@ -19,15 +19,12 @@ use super::*; use crate as sudo; -use frame_support::{derive_impl, traits::Contains}; -use sp_io; -use sp_runtime::BuildStorage; +use frame::testing_prelude::*; // Logger module to track execution. -#[frame_support::pallet] +#[frame::pallet] pub mod logger { - use frame_support::pallet_prelude::*; - use frame_system::pallet_prelude::*; + use frame::preliude::* #[pallet::config] pub trait Config: frame_system::Config { @@ -127,7 +124,7 @@ pub type SudoCall = sudo::Call; pub type LoggerCall = logger::Call; // Build test environment by setting the root `key` for the Genesis. -pub fn new_test_ext(root_key: u64) -> sp_io::TestExternalities { +pub fn new_test_ext(root_key: u64) -> TestState { let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); sudo::GenesisConfig:: { key: Some(root_key) } .assimilate_storage(&mut t) diff --git a/substrate/frame/sudo/src/tests.rs b/substrate/frame/sudo/src/tests.rs index 3ed3bd336f53..45dbdbf6a70f 100644 --- a/substrate/frame/sudo/src/tests.rs +++ b/substrate/frame/sudo/src/tests.rs @@ -18,7 +18,7 @@ //! Tests for the module. use super::*; -use frame_support::{assert_noop, assert_ok, weights::Weight}; +use frame::testing_prelude::*; use mock::{ new_test_ext, Logger, LoggerCall, RuntimeCall, RuntimeEvent as TestEvent, RuntimeOrigin, Sudo, SudoCall, System, Test, diff --git a/substrate/frame/sudo/src/weights.rs b/substrate/frame/sudo/src/weights.rs index 1b3bdbaaf42c..ec44505cadbd 100644 --- a/substrate/frame/sudo/src/weights.rs +++ b/substrate/frame/sudo/src/weights.rs @@ -46,8 +46,7 @@ #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use core::marker::PhantomData; +use frame::weights_prelude::* /// Weight functions needed for `pallet_sudo`. pub trait WeightInfo {