diff --git a/.maintain/pallet-weight-template.hbs b/.maintain/pallet-weight-template.hbs index 9ecbe5bc0..f18852f14 100644 --- a/.maintain/pallet-weight-template.hbs +++ b/.maintain/pallet-weight-template.hbs @@ -16,8 +16,8 @@ #![allow(unused_parens)] #![allow(unused_imports)] +use core::marker::PhantomData; use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; /// Weights for `{{pallet}}`. pub struct WeightInfo(PhantomData); diff --git a/Cargo.lock b/Cargo.lock index 8b779f84b..76a2085c6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1633,7 +1633,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", "sp-transaction-pool", "sp-version", "staging-parachain-info", @@ -2642,7 +2641,6 @@ dependencies = [ "sp-io", "sp-keyring", "sp-runtime", - "sp-std", "sp-version", ] @@ -2683,7 +2681,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", "staging-xcm", "staging-xcm-executor", ] @@ -2707,7 +2704,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", ] [[package]] @@ -2735,7 +2731,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", "xcm-primitives", ] @@ -2757,7 +2752,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", ] [[package]] @@ -2776,7 +2770,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", ] [[package]] @@ -2864,7 +2857,6 @@ dependencies = [ "sp-runtime", "sp-session", "sp-staking", - "sp-std", "sp-transaction-pool", "sp-version", "staging-parachain-info", @@ -2900,7 +2892,6 @@ dependencies = [ "sp-core", "sp-io", "sp-runtime", - "sp-std", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3c01ae152..65b3079fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -170,7 +170,6 @@ sp-offchain = { git = "https://github.com/parityt sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } sp-session = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } sp-staking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } -sp-std = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } sp-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } sp-transaction-pool = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } sp-version = { git = "https://github.com/paritytech/polkadot-sdk", branch = "stable2409", default-features = false } diff --git a/pallet/account-migration/Cargo.toml b/pallet/account-migration/Cargo.toml index 8c5fecd90..7adf8d654 100644 --- a/pallet/account-migration/Cargo.toml +++ b/pallet/account-migration/Cargo.toml @@ -23,7 +23,6 @@ pallet-assets = { workspace = true } pallet-balances = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } # polkadot-sdk optional frame-benchmarking = { workspace = true, optional = true } @@ -51,7 +50,6 @@ std = [ "pallet-balances/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", # polkadot-sdk optional "frame-benchmarking?/std", ] diff --git a/pallet/account-migration/src/benchmarking.rs b/pallet/account-migration/src/benchmarking.rs index cc8df2f40..43f346812 100644 --- a/pallet/account-migration/src/benchmarking.rs +++ b/pallet/account-migration/src/benchmarking.rs @@ -21,7 +21,6 @@ use crate::*; // polkadot-sdk use frame_benchmarking::v2::*; use frame_system::RawOrigin; -use sp_std::prelude::*; #[v2::benchmarks] mod benchmarks { diff --git a/pallet/account-migration/src/lib.rs b/pallet/account-migration/src/lib.rs index c8bf72e31..22062a132 100644 --- a/pallet/account-migration/src/lib.rs +++ b/pallet/account-migration/src/lib.rs @@ -43,6 +43,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #![deny(missing_docs)] +extern crate alloc; + #[cfg(feature = "runtime-benchmarks")] mod benchmarking; #[cfg(all(test, feature = "runtime-benchmarks"))] @@ -53,6 +55,8 @@ mod tests; mod weights; pub use weights::WeightInfo; +// alloc +use alloc::{borrow::ToOwned, vec, vec::Vec}; // crates.io use array_bytes::Hexify; // darwinia @@ -75,7 +79,6 @@ use sp_runtime::{ traits::{IdentityLookup, Verify}, AccountId32, }; -use sp_std::prelude::*; #[frame_support::pallet] pub mod pallet { diff --git a/pallet/deposit/Cargo.toml b/pallet/deposit/Cargo.toml index 1f9d69549..14c22746f 100644 --- a/pallet/deposit/Cargo.toml +++ b/pallet/deposit/Cargo.toml @@ -25,7 +25,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } pallet-timestamp = { workspace = true } sp-core = { workspace = true } -sp-std = { workspace = true } # polkadot-sdk optional frame-benchmarking = { workspace = true, optional = true } @@ -56,7 +55,6 @@ std = [ "pallet-timestamp/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", # polkadot-sdk optional "frame-benchmarking?/std", ] diff --git a/pallet/deposit/src/benchmarking.rs b/pallet/deposit/src/benchmarking.rs index 6a821db58..75f70ba82 100644 --- a/pallet/deposit/src/benchmarking.rs +++ b/pallet/deposit/src/benchmarking.rs @@ -21,7 +21,6 @@ use crate::{Deposit, *}; // polkadot-sdk use frame_benchmarking::v2::*; use frame_system::RawOrigin; -use sp_std::prelude::*; #[v2::benchmarks] mod benchmarks { diff --git a/pallet/deposit/src/lib.rs b/pallet/deposit/src/lib.rs index b7bde0e72..ccec3fa99 100644 --- a/pallet/deposit/src/lib.rs +++ b/pallet/deposit/src/lib.rs @@ -26,6 +26,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #![deny(missing_docs)] +extern crate alloc; + #[cfg(test)] mod mock; #[cfg(test)] @@ -39,6 +41,8 @@ pub use weights::WeightInfo; // core use core::marker::PhantomData; +// alloc +use alloc::{borrow::ToOwned, boxed::Box, vec, vec::Vec}; // crates.io use ethabi::{Function, Param, ParamType, StateMutability, Token}; // darwinia @@ -52,7 +56,6 @@ use frame_support::{ }; use frame_system::pallet_prelude::*; use sp_core::H160; -use sp_std::prelude::*; #[frame_support::pallet] pub mod pallet { diff --git a/pallet/ethtx-forwarder/Cargo.toml b/pallet/ethtx-forwarder/Cargo.toml index 2ebbf27ce..054f0cd48 100644 --- a/pallet/ethtx-forwarder/Cargo.toml +++ b/pallet/ethtx-forwarder/Cargo.toml @@ -28,7 +28,6 @@ frame-support = { workspace = true } frame-system = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] # crates.io @@ -71,7 +70,6 @@ std = [ "frame-system/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ diff --git a/pallet/ethtx-forwarder/src/lib.rs b/pallet/ethtx-forwarder/src/lib.rs index f73fb06c5..db61c5400 100644 --- a/pallet/ethtx-forwarder/src/lib.rs +++ b/pallet/ethtx-forwarder/src/lib.rs @@ -18,11 +18,15 @@ #![cfg_attr(not(feature = "std"), no_std)] +extern crate alloc; + #[cfg(test)] mod mock; #[cfg(test)] mod test; +// alloc +use alloc::vec::Vec; // crates.io use codec::{Decode, Encode, MaxEncodedLen}; use ethabi::{Function, Token}; @@ -48,7 +52,6 @@ use sp_runtime::{ traits::{BadOrigin, UniqueSaturatedInto}, DispatchError, RuntimeDebug, }; -use sp_std::vec::Vec; pub use pallet::*; diff --git a/pallet/ethtx-forwarder/src/mock.rs b/pallet/ethtx-forwarder/src/mock.rs index b62f7e32d..a5c7bc420 100644 --- a/pallet/ethtx-forwarder/src/mock.rs +++ b/pallet/ethtx-forwarder/src/mock.rs @@ -27,7 +27,6 @@ use crate::*; // polkadot-sdk use frame_support::derive_impl; use sp_runtime::BuildStorage; -use sp_std::prelude::*; pub type AccountId = sp_core::H160; pub type Balance = u64; diff --git a/pallet/staking/Cargo.toml b/pallet/staking/Cargo.toml index b13bfee02..ad1e739b4 100644 --- a/pallet/staking/Cargo.toml +++ b/pallet/staking/Cargo.toml @@ -27,7 +27,6 @@ pallet-authorship = { workspace = true } pallet-session = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } # polkadot-sdk optional frame-benchmarking = { workspace = true, optional = true } @@ -65,7 +64,6 @@ std = [ "pallet-session/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", # polkadot-sdk optional "frame-benchmarking?/std", ] diff --git a/pallet/staking/src/benchmarking.rs b/pallet/staking/src/benchmarking.rs index 6c0905b56..563febfab 100644 --- a/pallet/staking/src/benchmarking.rs +++ b/pallet/staking/src/benchmarking.rs @@ -21,7 +21,6 @@ use crate::*; // polkadot-sdk use frame_benchmarking::v2::*; use frame_system::RawOrigin; -use sp_std::prelude::*; #[v2::benchmarks] mod benchmarks { diff --git a/pallet/staking/src/lib.rs b/pallet/staking/src/lib.rs index b782f9b7e..d23202c93 100644 --- a/pallet/staking/src/lib.rs +++ b/pallet/staking/src/lib.rs @@ -27,6 +27,8 @@ #![deny(missing_docs)] #![allow(clippy::needless_borrows_for_generic_args)] +extern crate alloc; + #[cfg(test)] mod mock; #[cfg(test)] @@ -38,6 +40,8 @@ mod benchmarking; mod weights; pub use weights::WeightInfo; +// alloc +use alloc::{borrow::ToOwned, boxed::Box, collections::btree_map::BTreeMap, vec, vec::Vec}; // crates.io use codec::FullCodec; use ethabi::{Function, Param, ParamType, StateMutability, Token}; @@ -51,7 +55,6 @@ use sp_runtime::{ traits::{AccountIdConversion, Convert, One}, Perbill, }; -use sp_std::{collections::btree_map::BTreeMap, prelude::*}; #[frame_support::pallet] pub mod pallet { diff --git a/precompile/assets/Cargo.toml b/precompile/assets/Cargo.toml index 4e5e4c329..ace0dd5a2 100644 --- a/precompile/assets/Cargo.toml +++ b/precompile/assets/Cargo.toml @@ -20,7 +20,6 @@ frame-system = { workspace = true } pallet-assets = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] # crates.io @@ -54,7 +53,6 @@ std = [ "pallet-assets/std", "sp-core/std", "sp-runtime/std", - "sp-std/std", ] runtime-benchmarks = [ diff --git a/precompile/assets/src/lib.rs b/precompile/assets/src/lib.rs index 6c5d12e2b..530df49f9 100644 --- a/precompile/assets/src/lib.rs +++ b/precompile/assets/src/lib.rs @@ -18,13 +18,19 @@ #![cfg_attr(not(feature = "std"), no_std)] +#[cfg(test)] +extern crate alloc; + #[cfg(test)] mod mock; #[cfg(test)] mod tests; -// std -use core::marker::PhantomData; +// core +use core::{ + convert::{TryFrom, TryInto}, + marker::PhantomData, +}; // polkadot-sdk use frame_support::{ dispatch::{GetDispatchInfo, PostDispatchInfo}, @@ -38,7 +44,6 @@ use frame_support::{ }; use sp_core::{MaxEncodedLen, H160, U256}; use sp_runtime::traits::Bounded; -use sp_std::convert::{TryFrom, TryInto}; // moonbeam use precompile_utils::prelude::*; diff --git a/precompile/assets/src/mock.rs b/precompile/assets/src/mock.rs index a39d71ad1..301d74914 100644 --- a/precompile/assets/src/mock.rs +++ b/precompile/assets/src/mock.rs @@ -18,6 +18,8 @@ // core use core::marker::PhantomData; +// alloc +use alloc::vec::Vec; // crates.io use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; @@ -29,7 +31,6 @@ use crate::*; use frame_support::derive_impl; use sp_core::H160; use sp_runtime::BuildStorage; -use sp_std::prelude::*; pub type Balance = u128; pub type AssetId = u32; diff --git a/precompile/assets/src/tests.rs b/precompile/assets/src/tests.rs index c2f0cda8a..084c0d603 100644 --- a/precompile/assets/src/tests.rs +++ b/precompile/assets/src/tests.rs @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . +// alloc +use alloc::str::from_utf8; // crates.io use sha3::{Digest, Keccak256}; // darwinia @@ -31,7 +33,6 @@ use precompile_utils::{ // polkadot-sdk use frame_support::assert_ok; use sp_core::{H256, U256}; -use sp_std::str::from_utf8; fn precompiles() -> TestPrecompiles { PrecompilesValue::get() diff --git a/precompile/state-storage/Cargo.toml b/precompile/state-storage/Cargo.toml index eab420fd0..6ad408d7c 100644 --- a/precompile/state-storage/Cargo.toml +++ b/precompile/state-storage/Cargo.toml @@ -16,7 +16,6 @@ precompile-utils = { workspace = true } # polkadot-sdk frame-support = { workspace = true } -sp-std = { workspace = true } [dev-dependencies] # crates.io @@ -46,5 +45,4 @@ std = [ # polkadot-sdk "frame-support/std", - "sp-std/std", ] diff --git a/precompile/state-storage/src/lib.rs b/precompile/state-storage/src/lib.rs index 24ba69e74..b20b1e681 100644 --- a/precompile/state-storage/src/lib.rs +++ b/precompile/state-storage/src/lib.rs @@ -18,12 +18,15 @@ #![cfg_attr(not(feature = "std"), no_std)] +#[cfg(test)] +extern crate alloc; + #[cfg(test)] mod mock; #[cfg(test)] mod tests; -// std +// core use core::marker::PhantomData; // moonbeam use precompile_utils::prelude::*; diff --git a/precompile/state-storage/src/mock.rs b/precompile/state-storage/src/mock.rs index af1d9fb48..1ae6c1aa9 100644 --- a/precompile/state-storage/src/mock.rs +++ b/precompile/state-storage/src/mock.rs @@ -16,6 +16,10 @@ // You should have received a copy of the GNU General Public License // along with Darwinia. If not, see . +// core +use core::marker::PhantomData; +// alloc +use alloc::vec::Vec; // crates.io use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; @@ -27,7 +31,6 @@ use precompile_utils::Precompile; use frame_support::{derive_impl, StorageHasher}; use sp_core::H160; use sp_runtime::BuildStorage; -use sp_std::{marker::PhantomData, prelude::*}; pub type Balance = u64; pub type AccountId = H160; diff --git a/runtime/common/Cargo.toml b/runtime/common/Cargo.toml index 981b81375..6599c145e 100644 --- a/runtime/common/Cargo.toml +++ b/runtime/common/Cargo.toml @@ -33,7 +33,6 @@ pallet-message-queue = { workspace = true } sp-core = { workspace = true } sp-io = { workspace = true } sp-runtime = { workspace = true } -sp-std = { workspace = true } xcm = { workspace = true } xcm-executor = { workspace = true } # polkadot-sdk optional @@ -72,7 +71,6 @@ std = [ "sp-core/std", "sp-io/std", "sp-runtime/std", - "sp-std/std", "xcm-executor/std", "xcm/std", # polkadot-sdk optional diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index ca9bc7aa6..b28584c1c 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -20,6 +20,8 @@ // TODO: // #![deny(missing_docs)] +extern crate alloc; + #[cfg(feature = "runtime-benchmarks")] pub mod benchmark_helper; pub mod gov_origin; diff --git a/runtime/common/src/pallet_config.rs b/runtime/common/src/pallet_config.rs index d6f3f8383..ada18a5d5 100644 --- a/runtime/common/src/pallet_config.rs +++ b/runtime/common/src/pallet_config.rs @@ -72,12 +72,13 @@ pub mod precompiles { } } +// alloc +use alloc::vec; // darwinia use dc_primitives::*; // polkadot-sdk use sp_core::U256; use sp_runtime::traits::AccountIdConversion; -use sp_std::vec; /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by /// `Operational` extrinsics. diff --git a/runtime/common/src/xcm_config.rs b/runtime/common/src/xcm_config.rs index 31d4b3430..84c32be53 100644 --- a/runtime/common/src/xcm_config.rs +++ b/runtime/common/src/xcm_config.rs @@ -18,6 +18,8 @@ // core use core::marker::PhantomData; +// alloc +use alloc::vec::Vec; // crates.io use codec::Encode; // darwinia @@ -28,7 +30,6 @@ use frame_support::{ traits::{ConstU128, Contains}, }; use sp_io::hashing::blake2_256; -use sp_std::prelude::*; use xcm::latest::prelude::*; use xcm_executor::traits::ConvertLocation; diff --git a/runtime/crab/Cargo.toml b/runtime/crab/Cargo.toml index 58223408e..628150292 100644 --- a/runtime/crab/Cargo.toml +++ b/runtime/crab/Cargo.toml @@ -95,7 +95,6 @@ sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } sp-staking = { workspace = true } -sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } xcm = { workspace = true } @@ -203,7 +202,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", "xcm-builder/std", diff --git a/runtime/crab/src/lib.rs b/runtime/crab/src/lib.rs index c0c331a38..1a9594bd1 100644 --- a/runtime/crab/src/lib.rs +++ b/runtime/crab/src/lib.rs @@ -21,6 +21,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] +extern crate alloc; + #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); @@ -34,13 +36,14 @@ mod migration; pub use darwinia_common_runtime::*; pub use dc_primitives::*; +// alloc +use alloc::{vec, vec::Vec}; // crates.io use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; // polkadot-sdk use sp_core::{H160, H256, U256}; use sp_runtime::RuntimeDebug; -use sp_std::prelude::*; /// Block type as expected by this runtime. pub type Block = sp_runtime::generic::Block; @@ -402,7 +405,7 @@ sp_api::impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -1114,7 +1117,7 @@ sp_api::impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } diff --git a/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs b/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs index b73d4f017..f498fdf69 100644 --- a/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs +++ b/runtime/crab/src/weights/cumulus_pallet_parachain_system.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs index 7a96b1a03..79e92c2b0 100644 --- a/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/crab/src/weights/cumulus_pallet_xcmp_queue.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/darwinia_account_migration.rs b/runtime/crab/src/weights/darwinia_account_migration.rs index 80299c430..6fd11b61f 100644 --- a/runtime/crab/src/weights/darwinia_account_migration.rs +++ b/runtime/crab/src/weights/darwinia_account_migration.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `darwinia_account_migration`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/darwinia_deposit.rs b/runtime/crab/src/weights/darwinia_deposit.rs index b98831d4e..d73c1f19e 100644 --- a/runtime/crab/src/weights/darwinia_deposit.rs +++ b/runtime/crab/src/weights/darwinia_deposit.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `darwinia_deposit`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/darwinia_staking.rs b/runtime/crab/src/weights/darwinia_staking.rs index 085da5338..021e9d4e7 100644 --- a/runtime/crab/src/weights/darwinia_staking.rs +++ b/runtime/crab/src/weights/darwinia_staking.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `darwinia_staking`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/frame_system.rs b/runtime/crab/src/weights/frame_system.rs index 3c6a6da1e..a23cedca7 100644 --- a/runtime/crab/src/weights/frame_system.rs +++ b/runtime/crab/src/weights/frame_system.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `frame_system`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_assets.rs b/runtime/crab/src/weights/pallet_assets.rs index 0a98c8e60..0a552a7ca 100644 --- a/runtime/crab/src/weights/pallet_assets.rs +++ b/runtime/crab/src/weights/pallet_assets.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_assets`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_balances.rs b/runtime/crab/src/weights/pallet_balances.rs index 1b0b3e1df..0d7d6e8b6 100644 --- a/runtime/crab/src/weights/pallet_balances.rs +++ b/runtime/crab/src/weights/pallet_balances.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_balances`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_collective.rs b/runtime/crab/src/weights/pallet_collective.rs index be5d406a0..f78ea7405 100644 --- a/runtime/crab/src/weights/pallet_collective.rs +++ b/runtime/crab/src/weights/pallet_collective.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_collective`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_conviction_voting.rs b/runtime/crab/src/weights/pallet_conviction_voting.rs index aa7d29e16..25c849478 100644 --- a/runtime/crab/src/weights/pallet_conviction_voting.rs +++ b/runtime/crab/src/weights/pallet_conviction_voting.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_conviction_voting`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_message_queue.rs b/runtime/crab/src/weights/pallet_message_queue.rs index e317ac5be..75d6f3138 100644 --- a/runtime/crab/src/weights/pallet_message_queue.rs +++ b/runtime/crab/src/weights/pallet_message_queue.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_preimage.rs b/runtime/crab/src/weights/pallet_preimage.rs index 0a5b4fd1b..9f8689884 100644 --- a/runtime/crab/src/weights/pallet_preimage.rs +++ b/runtime/crab/src/weights/pallet_preimage.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_preimage`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_proxy.rs b/runtime/crab/src/weights/pallet_proxy.rs index b16596068..291092b67 100644 --- a/runtime/crab/src/weights/pallet_proxy.rs +++ b/runtime/crab/src/weights/pallet_proxy.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_proxy`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_referenda.rs b/runtime/crab/src/weights/pallet_referenda.rs index 76a89ead1..bcd2bed59 100644 --- a/runtime/crab/src/weights/pallet_referenda.rs +++ b/runtime/crab/src/weights/pallet_referenda.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_referenda`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_scheduler.rs b/runtime/crab/src/weights/pallet_scheduler.rs index a9b396a52..94cc100a3 100644 --- a/runtime/crab/src/weights/pallet_scheduler.rs +++ b/runtime/crab/src/weights/pallet_scheduler.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_scheduler`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_session.rs b/runtime/crab/src/weights/pallet_session.rs index 809e3a873..3c22491b0 100644 --- a/runtime/crab/src/weights/pallet_session.rs +++ b/runtime/crab/src/weights/pallet_session.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_session`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_timestamp.rs b/runtime/crab/src/weights/pallet_timestamp.rs index d8802fc62..bb6ae4dfa 100644 --- a/runtime/crab/src/weights/pallet_timestamp.rs +++ b/runtime/crab/src/weights/pallet_timestamp.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_timestamp`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_treasury.rs b/runtime/crab/src/weights/pallet_treasury.rs index 01d23b4d5..6f8905ef0 100644 --- a/runtime/crab/src/weights/pallet_treasury.rs +++ b/runtime/crab/src/weights/pallet_treasury.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_treasury`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_tx_pause.rs b/runtime/crab/src/weights/pallet_tx_pause.rs index bb864debe..92c9c4cba 100644 --- a/runtime/crab/src/weights/pallet_tx_pause.rs +++ b/runtime/crab/src/weights/pallet_tx_pause.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_tx_pause`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_utility.rs b/runtime/crab/src/weights/pallet_utility.rs index 28d3e7257..7b3e25aa4 100644 --- a/runtime/crab/src/weights/pallet_utility.rs +++ b/runtime/crab/src/weights/pallet_utility.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_utility`. pub struct WeightInfo(PhantomData); diff --git a/runtime/crab/src/weights/pallet_whitelist.rs b/runtime/crab/src/weights/pallet_whitelist.rs index ccc524444..359038d51 100644 --- a/runtime/crab/src/weights/pallet_whitelist.rs +++ b/runtime/crab/src/weights/pallet_whitelist.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_whitelist`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/Cargo.toml b/runtime/darwinia/Cargo.toml index feebafaa0..c333a26e2 100644 --- a/runtime/darwinia/Cargo.toml +++ b/runtime/darwinia/Cargo.toml @@ -101,7 +101,6 @@ sp-offchain = { workspace = true } sp-runtime = { workspace = true } sp-session = { workspace = true } sp-staking = { workspace = true } -sp-std = { workspace = true } sp-transaction-pool = { workspace = true } sp-version = { workspace = true } # polkadot-sdk optional @@ -212,7 +211,6 @@ std = [ "sp-runtime/std", "sp-session/std", "sp-staking/std", - "sp-std/std", "sp-transaction-pool/std", "sp-version/std", # polkadot-sdk optional diff --git a/runtime/darwinia/src/lib.rs b/runtime/darwinia/src/lib.rs index a50cd1b20..de2ecf052 100644 --- a/runtime/darwinia/src/lib.rs +++ b/runtime/darwinia/src/lib.rs @@ -21,6 +21,8 @@ #![cfg_attr(not(feature = "std"), no_std)] #![recursion_limit = "256"] +extern crate alloc; + #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); @@ -34,13 +36,14 @@ mod migration; pub use darwinia_common_runtime::*; pub use dc_primitives::*; +// alloc +use alloc::{vec, vec::Vec}; // crates.io use codec::{Decode, Encode, MaxEncodedLen}; use scale_info::TypeInfo; // polkadot-sdk use sp_core::{H160, H256, U256}; use sp_runtime::RuntimeDebug; -use sp_std::prelude::*; /// Block type as expected by this runtime. pub type Block = sp_runtime::generic::Block; @@ -426,7 +429,7 @@ sp_api::impl_runtime_apis! { Runtime::metadata_at_version(version) } - fn metadata_versions() -> sp_std::vec::Vec { + fn metadata_versions() -> alloc::vec::Vec { Runtime::metadata_versions() } } @@ -1120,7 +1123,7 @@ sp_api::impl_runtime_apis! { use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime { - fn setup_set_code_requirements(code: &sp_std::vec::Vec) -> Result<(), BenchmarkError> { + fn setup_set_code_requirements(code: &alloc::vec::Vec) -> Result<(), BenchmarkError> { ParachainSystem::initialize_for_set_code_benchmark(code.len() as u32); Ok(()) } diff --git a/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs b/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs index f711c8d4b..3cce7acea 100644 --- a/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs +++ b/runtime/darwinia/src/weights/cumulus_pallet_parachain_system.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `cumulus_pallet_parachain_system`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs index bbc5594cb..3740e8e75 100644 --- a/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs +++ b/runtime/darwinia/src/weights/cumulus_pallet_xcmp_queue.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `cumulus_pallet_xcmp_queue`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/darwinia_account_migration.rs b/runtime/darwinia/src/weights/darwinia_account_migration.rs index 7d7eb5c81..dde3fb731 100644 --- a/runtime/darwinia/src/weights/darwinia_account_migration.rs +++ b/runtime/darwinia/src/weights/darwinia_account_migration.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `darwinia_account_migration`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/darwinia_deposit.rs b/runtime/darwinia/src/weights/darwinia_deposit.rs index 065459595..3e5774236 100644 --- a/runtime/darwinia/src/weights/darwinia_deposit.rs +++ b/runtime/darwinia/src/weights/darwinia_deposit.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `darwinia_deposit`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/darwinia_staking.rs b/runtime/darwinia/src/weights/darwinia_staking.rs index a93ce8f6a..bd8c8d614 100644 --- a/runtime/darwinia/src/weights/darwinia_staking.rs +++ b/runtime/darwinia/src/weights/darwinia_staking.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `darwinia_staking`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/frame_system.rs b/runtime/darwinia/src/weights/frame_system.rs index 0622f5b77..d83376a3e 100644 --- a/runtime/darwinia/src/weights/frame_system.rs +++ b/runtime/darwinia/src/weights/frame_system.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `frame_system`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_asset_manager.rs b/runtime/darwinia/src/weights/pallet_asset_manager.rs index a33eb9f90..b2c585a7f 100644 --- a/runtime/darwinia/src/weights/pallet_asset_manager.rs +++ b/runtime/darwinia/src/weights/pallet_asset_manager.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_asset_manager`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_assets.rs b/runtime/darwinia/src/weights/pallet_assets.rs index d3db35521..1202b4c1f 100644 --- a/runtime/darwinia/src/weights/pallet_assets.rs +++ b/runtime/darwinia/src/weights/pallet_assets.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_assets`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_balances.rs b/runtime/darwinia/src/weights/pallet_balances.rs index 7ac663316..629d57187 100644 --- a/runtime/darwinia/src/weights/pallet_balances.rs +++ b/runtime/darwinia/src/weights/pallet_balances.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_balances`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_collective.rs b/runtime/darwinia/src/weights/pallet_collective.rs index 38f09e783..5a5be137c 100644 --- a/runtime/darwinia/src/weights/pallet_collective.rs +++ b/runtime/darwinia/src/weights/pallet_collective.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_collective`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_conviction_voting.rs b/runtime/darwinia/src/weights/pallet_conviction_voting.rs index 377cb28e2..167d1b46d 100644 --- a/runtime/darwinia/src/weights/pallet_conviction_voting.rs +++ b/runtime/darwinia/src/weights/pallet_conviction_voting.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_conviction_voting`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_message_queue.rs b/runtime/darwinia/src/weights/pallet_message_queue.rs index 0a8eeb462..98b9e80c6 100644 --- a/runtime/darwinia/src/weights/pallet_message_queue.rs +++ b/runtime/darwinia/src/weights/pallet_message_queue.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_message_queue`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_preimage.rs b/runtime/darwinia/src/weights/pallet_preimage.rs index 3c2ab57ac..f6cfc1818 100644 --- a/runtime/darwinia/src/weights/pallet_preimage.rs +++ b/runtime/darwinia/src/weights/pallet_preimage.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_preimage`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_proxy.rs b/runtime/darwinia/src/weights/pallet_proxy.rs index 9ecb92da9..c4564db06 100644 --- a/runtime/darwinia/src/weights/pallet_proxy.rs +++ b/runtime/darwinia/src/weights/pallet_proxy.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_proxy`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_referenda.rs b/runtime/darwinia/src/weights/pallet_referenda.rs index 68d38948a..38a2d0f3a 100644 --- a/runtime/darwinia/src/weights/pallet_referenda.rs +++ b/runtime/darwinia/src/weights/pallet_referenda.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_referenda`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_scheduler.rs b/runtime/darwinia/src/weights/pallet_scheduler.rs index adc2d8ae7..2ee89a213 100644 --- a/runtime/darwinia/src/weights/pallet_scheduler.rs +++ b/runtime/darwinia/src/weights/pallet_scheduler.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_scheduler`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_session.rs b/runtime/darwinia/src/weights/pallet_session.rs index f73ae53df..e3793690c 100644 --- a/runtime/darwinia/src/weights/pallet_session.rs +++ b/runtime/darwinia/src/weights/pallet_session.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_session`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_timestamp.rs b/runtime/darwinia/src/weights/pallet_timestamp.rs index ba1caaa06..e09cb8b11 100644 --- a/runtime/darwinia/src/weights/pallet_timestamp.rs +++ b/runtime/darwinia/src/weights/pallet_timestamp.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_timestamp`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_treasury.rs b/runtime/darwinia/src/weights/pallet_treasury.rs index ef70c8951..8698f52f9 100644 --- a/runtime/darwinia/src/weights/pallet_treasury.rs +++ b/runtime/darwinia/src/weights/pallet_treasury.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_treasury`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_utility.rs b/runtime/darwinia/src/weights/pallet_utility.rs index 4dd0939ed..d967a2e02 100644 --- a/runtime/darwinia/src/weights/pallet_utility.rs +++ b/runtime/darwinia/src/weights/pallet_utility.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_utility`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_whitelist.rs b/runtime/darwinia/src/weights/pallet_whitelist.rs index 788ca11f6..cd609e6b5 100644 --- a/runtime/darwinia/src/weights/pallet_whitelist.rs +++ b/runtime/darwinia/src/weights/pallet_whitelist.rs @@ -48,7 +48,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_whitelist`. pub struct WeightInfo(PhantomData); diff --git a/runtime/darwinia/src/weights/pallet_xcm_weight_trader.rs b/runtime/darwinia/src/weights/pallet_xcm_weight_trader.rs index 953ee6dd6..0238980c9 100644 --- a/runtime/darwinia/src/weights/pallet_xcm_weight_trader.rs +++ b/runtime/darwinia/src/weights/pallet_xcm_weight_trader.rs @@ -41,7 +41,7 @@ #![allow(unused_imports)] use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; +use core::marker::PhantomData; /// Weights for `pallet_xcm_weight_trader`. pub struct WeightInfo(PhantomData); @@ -101,4 +101,4 @@ impl pallet_xcm_weight_trader::WeightInfo for WeightInf .saturating_add(T::DbWeight::get().reads(1_u64)) .saturating_add(T::DbWeight::get().writes(1_u64)) } -} \ No newline at end of file +} diff --git a/tool/am-signer/.editorconfig b/tool/am-signer/.editorconfig deleted file mode 100644 index 7a124a295..000000000 --- a/tool/am-signer/.editorconfig +++ /dev/null @@ -1,21 +0,0 @@ -root = true - -[*] -charset=utf-8 -end_of_line=lf -indent_size=tab -indent_style=tab -insert_final_newline=true -max_line_length=100 -tab_width=4 -trim_trailing_whitespace=true - -[*.py] -charset=utf-8 -indent_size=4 -indent_style=space - -[*.{sh,yml,yaml}] -indent_size=2 -indent_style=space -tab_width=8 diff --git a/tool/am-signer/.gitignore b/tool/am-signer/.gitignore deleted file mode 100644 index e140cd846..000000000 --- a/tool/am-signer/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -# System -.DS_Store - -# Integrated Development Environment -.idea -.vscode - -# Package Manager -## cargo -target -Cargo.lock -## npm -node_modules - -# Test data -test-data -accounts -am-signer.json diff --git a/tool/am-signer/.rustfmt.toml b/tool/am-signer/.rustfmt.toml deleted file mode 100644 index 8f17dfe50..000000000 --- a/tool/am-signer/.rustfmt.toml +++ /dev/null @@ -1,29 +0,0 @@ -# Basic -edition = "2021" -hard_tabs = true -max_width = 100 -tab_spaces = 4 - -# Imports -imports_granularity = "Crate" -reorder_imports = true - -# Format comments -comment_width = 100 -wrap_comments = true - -# Misc -match_arm_blocks = false -match_block_trailing_comma = true -newline_style = "Unix" -reorder_impl_items = true -reorder_modules = true -use_field_init_shorthand = true -use_small_heuristics = "Max" - -# Wait for stablization -# format_code_in_doc_comments = true - -# Could give it a try -# group_imports = "StdExternalCrate" -# inline_attribute_width = 100 diff --git a/tool/am-signer/Cargo.toml b/tool/am-signer/Cargo.toml deleted file mode 100644 index 29670ffa4..000000000 --- a/tool/am-signer/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -authors = ["Xavier Lau "] -edition = "2021" -name = "am-signer" -version = "0.0.0" - -[dependencies] -# crates.io -array-bytes = { version = "*" } -clap = { version = "*", features = ["derive"] } -serde = { version = "*", features = ["derive"] } -serde_json = { version = "*" } - -# polkadot-sdk -sp-core = { version = "*" } - -[workspace] -exclude = [] diff --git a/tool/am-signer/README.md b/tool/am-signer/README.md deleted file mode 100644 index 0065e40e4..000000000 --- a/tool/am-signer/README.md +++ /dev/null @@ -1,11 +0,0 @@ -### Usage - -```sh -# Build -cargo b -# Get more detail -target/debug/am-signer --help - -# Generate migration proof -target/debug/am-signer -n -``` diff --git a/tool/am-signer/src/main.rs b/tool/am-signer/src/main.rs deleted file mode 100644 index 2d13b1660..000000000 --- a/tool/am-signer/src/main.rs +++ /dev/null @@ -1,153 +0,0 @@ -// std -use std::{ - fs::File, - io::{Read, Write}, - path::PathBuf, -}; -// crates.io -use array_bytes::{Dehexify, Hexify}; -use clap::{Parser, ValueEnum}; -use serde::Serialize; -// polkadot-sdk -use sp_core::{ed25519::Pair as Ep, sr25519::Pair as Sp, Pair as _}; - -#[derive(Parser)] -#[command(rename_all = "kebab")] -struct Cli { - /// 1.0 networks private key. - #[arg(long, value_name = "PRIVATE_KEY", conflicts_with = "file", requires = "to")] - from: Option, - /// 2.0 networks public key. - #[arg(long, value_name = "ADDRESS", conflicts_with = "file", requires = "from")] - to: Option, - /// The path to the migration list file. - /// - /// The format is: - /// ``` - /// form1:to1 - /// from2:to2 - /// ``` - #[arg(long, value_name = "PATH", conflicts_with_all = &["from", "to"])] - file: Option, - #[arg(value_enum, long, short, value_name = "SCHEME", default_value = "sr25519")] - /// Key scheme. - scheme: Scheme, - /// Network name. - #[arg(required = true, value_enum, long, short, value_name = "NETWORK")] - network: Network, -} -#[allow(non_camel_case_types)] -#[derive(Clone, ValueEnum)] -enum Scheme { - sr25519, - ed25519, -} -#[derive(Clone, ValueEnum)] -enum Network { - Darwinia, - Crab, -} -impl Network { - fn as_bytes(&self) -> &'static [u8] { - match self { - Self::Darwinia => b"Darwinia2", - Self::Crab => b"Crab2", - } - } -} - -enum Pair { - S(Box), - E(Box), -} -impl Pair { - fn public_key(&self) -> [u8; 32] { - match self { - Self::S(p) => p.public().0, - Self::E(p) => p.public().0, - } - } - - fn sign(&self, msg: &[u8]) -> [u8; 64] { - match self { - Self::S(p) => p.sign(msg).0, - Self::E(p) => p.sign(msg).0, - } - } -} - -#[derive(Serialize)] -struct MigrationParameters { - from: String, - to: String, - signature: String, -} - -fn main() { - let Cli { from, to, file, scheme, network } = Cli::parse(); - - if let Some(from) = from { - if let Some(to) = to { - let message = message_of(&to, &network); - let (from, signature) = sign_message(&from, &scheme, &message); - - println!("{from},{signature}"); - } - } else if let Some(p) = file { - let mut f = File::open(&p).expect("file not found"); - let mut s = String::new(); - - f.read_to_string(&mut s).expect("file read error"); - - let output = s - .lines() - .filter_map(|l| { - let l = l.trim(); - - if l.is_empty() { - None - } else { - let (from, to) = l.split_once(':').expect("valid format"); - let message = message_of(to, &network); - let (from, signature) = sign_message(from, &scheme, &message); - - Some(MigrationParameters { from, to: to.into(), signature }) - } - }) - .collect::>(); - - let mut f_new = File::create(p.with_file_name("am-signer").with_extension("json")) - .expect("file create error"); - - f_new - .write_all(&serde_json::to_vec_pretty(&output).expect("json serialize error")) - .expect("file write error"); - f_new.flush().expect("file flush error"); - } -} - -fn message_of(to: &str, network: &Network) -> Vec { - let network = network.as_bytes(); - - [ - b"I authorize the migration to ", - to.to_lowercase().as_bytes(), - b", an unused address on ", - network, - b". Sign this message to authorize using the Substrate key associated with the account on ", - &network[..network.len() - 1], - b" that you wish to migrate.", - ] - .concat() -} - -fn sign_message(from: &str, scheme: &Scheme, message: &[u8]) -> (String, String) { - let from = <[u8; 32]>::dehexify(from).expect("invalid private key"); - let from = match scheme { - Scheme::sr25519 => Pair::S(Box::new(Sp::from_seed(&from))), - Scheme::ed25519 => Pair::E(Box::new(Ep::from_seed(&from))), - }; - let signature = from.sign(message); - - (from.public_key().hexify_prefixed(), signature.hexify_prefixed()) -} diff --git a/tool/weight-checker/.editorconfig b/tool/weight-checker/.editorconfig deleted file mode 100644 index 7a124a295..000000000 --- a/tool/weight-checker/.editorconfig +++ /dev/null @@ -1,21 +0,0 @@ -root = true - -[*] -charset=utf-8 -end_of_line=lf -indent_size=tab -indent_style=tab -insert_final_newline=true -max_line_length=100 -tab_width=4 -trim_trailing_whitespace=true - -[*.py] -charset=utf-8 -indent_size=4 -indent_style=space - -[*.{sh,yml,yaml}] -indent_size=2 -indent_style=space -tab_width=8 diff --git a/tool/weight-checker/.gitignore b/tool/weight-checker/.gitignore deleted file mode 100644 index e140cd846..000000000 --- a/tool/weight-checker/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -# System -.DS_Store - -# Integrated Development Environment -.idea -.vscode - -# Package Manager -## cargo -target -Cargo.lock -## npm -node_modules - -# Test data -test-data -accounts -am-signer.json diff --git a/tool/weight-checker/.rustfmt.toml b/tool/weight-checker/.rustfmt.toml deleted file mode 100644 index 8f17dfe50..000000000 --- a/tool/weight-checker/.rustfmt.toml +++ /dev/null @@ -1,29 +0,0 @@ -# Basic -edition = "2021" -hard_tabs = true -max_width = 100 -tab_spaces = 4 - -# Imports -imports_granularity = "Crate" -reorder_imports = true - -# Format comments -comment_width = 100 -wrap_comments = true - -# Misc -match_arm_blocks = false -match_block_trailing_comma = true -newline_style = "Unix" -reorder_impl_items = true -reorder_modules = true -use_field_init_shorthand = true -use_small_heuristics = "Max" - -# Wait for stablization -# format_code_in_doc_comments = true - -# Could give it a try -# group_imports = "StdExternalCrate" -# inline_attribute_width = 100 diff --git a/tool/weight-checker/Cargo.toml b/tool/weight-checker/Cargo.toml deleted file mode 100644 index 733a9c7c0..000000000 --- a/tool/weight-checker/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -authors = ["Xavier Lau "] -edition = "2021" -name = "weight-checker" -version = "0.0.0" - -[dependencies] -# crates.io -clap = { version = "*", features = ["derive"] } -regex = { version = "*" } - -[workspace] -exclude = [] diff --git a/tool/weight-checker/src/main.rs b/tool/weight-checker/src/main.rs deleted file mode 100644 index d75133ceb..000000000 --- a/tool/weight-checker/src/main.rs +++ /dev/null @@ -1,78 +0,0 @@ -// std -use std::{fs, path::PathBuf}; -// crates.io -use clap::Parser; -use regex::Regex; - -const ON_CHAIN_REF_TIME: u128 = 349_900_160_000; -const ON_CHAIN_PROOF_SIZE: u128 = 3_670_016; - -fn main() { - let Cli { paths } = Cli::parse(); - - paths.into_iter().for_each(|p| { - println!("Checking: {}", p.display()); - - if !p.is_dir() { - panic!("invalid path"); - } - - println!("Max on-chain `ref_time`: {ON_CHAIN_REF_TIME}"); - println!("Max on-chain `proof_size`: {ON_CHAIN_PROOF_SIZE}"); - - let mut problems = Vec::new(); - - fs::read_dir(p).unwrap().for_each(|e| { - let e = e.unwrap(); - let p = e.path(); - let t = fs::read_to_string(&p).unwrap(); - let (ref_time, proof_size) = R::new().captures_max(&t); - - if ref_time >= ON_CHAIN_REF_TIME || proof_size >= ON_CHAIN_PROOF_SIZE { - problems.push((ref_time, proof_size, p.display().to_string())); - } - }); - - if !problems.is_empty() { - panic!( - "{}", - problems.into_iter().fold(String::new(), |acc, (t, ps, p)| format!( - "{acc}ref_time({t}) proof_size({ps}) path({p})\n" - )) - ); - } - }); -} - -#[derive(Parser)] -#[command(rename_all = "kebab")] -struct Cli { - /// Path(s) to the weights folder. - #[arg(value_name = "PATH", num_args = 1.., value_delimiter = ',')] - paths: Vec, -} - -struct R(Regex); -impl R { - fn new() -> Self { - R(Regex::new(r"from_parts\((\d+(?:_\d+)*),\s*(\d+(?:_\d+)*)\)").unwrap()) - } - - fn captures_max(&self, text: &str) -> (u128, u128) { - let (mut ref_time, mut proof_size) = (0, 0); - - self.0.captures_iter(text).for_each(|c| { - ref_time = ref_time - .max(c[1].chars().filter(|c| c != &'_').collect::().parse().unwrap()); - proof_size = proof_size - .max(c[2].chars().filter(|c| c != &'_').collect::().parse().unwrap()); - }); - - (ref_time, proof_size) - } -} - -#[test] -fn regex_should_work() { - assert_eq!(R::new().captures_max(include_str!("t.rs")), (36_514_055_000, 0)); -} diff --git a/tool/weight-checker/src/t.rs b/tool/weight-checker/src/t.rs deleted file mode 100644 index 535716112..000000000 --- a/tool/weight-checker/src/t.rs +++ /dev/null @@ -1,116 +0,0 @@ -// This file is part of Darwinia. -// -// Copyright (C) Darwinia Network -// SPDX-License-Identifier: GPL-3.0 -// -// Darwinia is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Darwinia is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Darwinia. If not, see . - -//! Autogenerated weights for `pallet_bridge_parachains` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-05-24, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("darwinia-local"), DB CACHE: 1024 - -// Executed Command: -// ./target/release/darwinia -// benchmark -// pallet -// --header -// .maintain/license-header -// --execution -// wasm -// --heap-pages -// 4096 -// --chain -// darwinia-local -// --output -// runtime/darwinia/src/weights/ -// --extrinsic -// * -// --pallet -// pallet_bridge_parachains - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_bridge_parachains`. -pub struct WeightInfo(PhantomData); -impl pallet_bridge_parachains::WeightInfo for WeightInfo { - /// Storage: BridgeKusamaParachain PalletOperatingMode (r:1 w:0) - /// Proof: BridgeKusamaParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: BridgeKusamaGrandpa ImportedHeaders (r:1 w:0) - /// Proof: BridgeKusamaGrandpa ImportedHeaders (max_values: None, max_size: Some(131104), added: 133579, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ParasInfo (r:1024 w:1024) - /// Proof: BridgeKusamaParachain ParasInfo (max_values: None, max_size: Some(60), added: 2535, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ImportedParaHashes (r:1024 w:1024) - /// Proof: BridgeKusamaParachain ImportedParaHashes (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ImportedParaHeads (r:0 w:1024) - /// Proof: BridgeKusamaParachain ImportedParaHeads (max_values: None, max_size: Some(1092), added: 3567, mode: MaxEncodedLen) - /// The range of component `p` is `[1, 1024]`. - fn submit_parachain_heads_with_n_parachains(_p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `451` - // Estimated: `5333811` - // Minimum execution time: 62_997_000 picoseconds. - Weight::from_parts(36_514_055_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().reads(2050)) - .saturating_add(T::DbWeight::get().writes(3072)) - } - /// Storage: BridgeKusamaParachain PalletOperatingMode (r:1 w:0) - /// Proof: BridgeKusamaParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: BridgeKusamaGrandpa ImportedHeaders (r:1 w:0) - /// Proof: BridgeKusamaGrandpa ImportedHeaders (max_values: None, max_size: Some(131104), added: 133579, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ParasInfo (r:1 w:1) - /// Proof: BridgeKusamaParachain ParasInfo (max_values: None, max_size: Some(60), added: 2535, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ImportedParaHashes (r:1 w:1) - /// Proof: BridgeKusamaParachain ImportedParaHashes (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ImportedParaHeads (r:0 w:1) - /// Proof: BridgeKusamaParachain ImportedParaHeads (max_values: None, max_size: Some(1092), added: 3567, mode: MaxEncodedLen) - fn submit_parachain_heads_with_1kb_proof() -> Weight { - // Proof Size summary in bytes: - // Measured: `451` - // Estimated: `143109` - // Minimum execution time: 96_381_000 picoseconds. - Weight::from_parts(96_381_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: BridgeKusamaParachain PalletOperatingMode (r:1 w:0) - /// Proof: BridgeKusamaParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen) - /// Storage: BridgeKusamaGrandpa ImportedHeaders (r:1 w:0) - /// Proof: BridgeKusamaGrandpa ImportedHeaders (max_values: None, max_size: Some(131104), added: 133579, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ParasInfo (r:1 w:1) - /// Proof: BridgeKusamaParachain ParasInfo (max_values: None, max_size: Some(60), added: 2535, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ImportedParaHashes (r:1 w:1) - /// Proof: BridgeKusamaParachain ImportedParaHashes (max_values: None, max_size: Some(64), added: 2539, mode: MaxEncodedLen) - /// Storage: BridgeKusamaParachain ImportedParaHeads (r:0 w:1) - /// Proof: BridgeKusamaParachain ImportedParaHeads (max_values: None, max_size: Some(1092), added: 3567, mode: MaxEncodedLen) - fn submit_parachain_heads_with_16kb_proof() -> Weight { - // Proof Size summary in bytes: - // Measured: `451` - // Estimated: `143109` - // Minimum execution time: 133_328_000 picoseconds. - Weight::from_parts(133_328_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } -}