mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 17:57:56 +00:00
sp-std -> core (#3199)
First in a series of PRs that reduces our use of sp-std with a view to deprecating it. This is just looking at /substrate and moving some of the references from `sp-std` to `core`. These particular changes should be uncontroversial. Where macros are used `::core` should be used to remove any ambiguity. part of https://github.com/paritytech/polkadot-sdk/issues/2101
This commit is contained in:
@@ -19,13 +19,12 @@
|
||||
|
||||
#![cfg(feature = "runtime-benchmarks")]
|
||||
|
||||
use sp_runtime::traits::{Bounded, Hash, StaticLookup};
|
||||
use sp_std::{
|
||||
use core::{
|
||||
cmp,
|
||||
convert::{TryFrom, TryInto},
|
||||
mem::size_of,
|
||||
prelude::*,
|
||||
};
|
||||
use sp_runtime::traits::{Bounded, Hash, StaticLookup};
|
||||
|
||||
use frame_benchmarking::{account, impl_benchmark_test_suite, v2::*, BenchmarkError};
|
||||
use frame_support::traits::{EnsureOrigin, Get, UnfilteredDispatchable};
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
|
||||
//! Test utilities
|
||||
|
||||
use core::convert::{TryFrom, TryInto};
|
||||
pub use sp_core::H256;
|
||||
use sp_runtime::traits::Hash;
|
||||
pub use sp_runtime::{
|
||||
traits::{BlakeTwo256, IdentifyAccount, Lazy, Verify},
|
||||
BuildStorage,
|
||||
};
|
||||
use sp_std::convert::{TryFrom, TryInto};
|
||||
|
||||
pub use frame_support::{
|
||||
assert_noop, assert_ok, derive_impl, ord_parameter_types, parameter_types,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
use super::*;
|
||||
use crate as pallet_asset_conversion;
|
||||
use core::default::Default;
|
||||
use frame_support::{
|
||||
construct_runtime, derive_impl,
|
||||
instances::{Instance1, Instance2},
|
||||
@@ -39,7 +40,6 @@ use sp_runtime::{
|
||||
traits::{AccountIdConversion, BlakeTwo256, IdentityLookup},
|
||||
BuildStorage,
|
||||
};
|
||||
use sp_std::default::Default;
|
||||
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
use super::*;
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use core::marker::PhantomData;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Represents a swap path with associated asset amounts indicating how much of the asset needs to
|
||||
/// be deposited to get the following asset's amount withdrawn (this is inclusive of fees).
|
||||
|
||||
@@ -38,7 +38,7 @@ impl<T: Config<I>, I: 'static> Drop for ExtraMutator<T, I> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config<I>, I: 'static> sp_std::ops::Deref for ExtraMutator<T, I> {
|
||||
impl<T: Config<I>, I: 'static> core::ops::Deref for ExtraMutator<T, I> {
|
||||
type Target = T::Extra;
|
||||
fn deref(&self) -> &T::Extra {
|
||||
match self.pending {
|
||||
@@ -48,7 +48,7 @@ impl<T: Config<I>, I: 'static> sp_std::ops::Deref for ExtraMutator<T, I> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Config<I>, I: 'static> sp_std::ops::DerefMut for ExtraMutator<T, I> {
|
||||
impl<T: Config<I>, I: 'static> core::ops::DerefMut for ExtraMutator<T, I> {
|
||||
fn deref_mut(&mut self) -> &mut T::Extra {
|
||||
if self.pending.is_none() {
|
||||
self.pending = Some(self.original.clone());
|
||||
@@ -60,7 +60,7 @@ impl<T: Config<I>, I: 'static> sp_std::ops::DerefMut for ExtraMutator<T, I> {
|
||||
impl<T: Config<I>, I: 'static> ExtraMutator<T, I> {
|
||||
pub(super) fn maybe_new(
|
||||
id: T::AssetId,
|
||||
who: impl sp_std::borrow::Borrow<T::AccountId>,
|
||||
who: impl core::borrow::Borrow<T::AccountId>,
|
||||
) -> Option<ExtraMutator<T, I>> {
|
||||
if let Some(a) = Account::<T, I>::get(&id, who.borrow()) {
|
||||
Some(ExtraMutator::<T, I> {
|
||||
|
||||
@@ -64,7 +64,7 @@ pub mod v1 {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct MigrateToV1<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
let current_version = Pallet::<T>::current_storage_version();
|
||||
|
||||
@@ -123,7 +123,7 @@ where
|
||||
return None
|
||||
}
|
||||
if let ExistenceReason::DepositHeld(deposit) =
|
||||
sp_std::mem::replace(self, ExistenceReason::DepositRefunded)
|
||||
core::mem::replace(self, ExistenceReason::DepositRefunded)
|
||||
{
|
||||
Some(deposit)
|
||||
} else {
|
||||
@@ -136,7 +136,7 @@ where
|
||||
return None
|
||||
}
|
||||
if let ExistenceReason::DepositFrom(depositor, deposit) =
|
||||
sp_std::mem::replace(self, ExistenceReason::DepositRefunded)
|
||||
core::mem::replace(self, ExistenceReason::DepositRefunded)
|
||||
{
|
||||
Some((depositor, deposit))
|
||||
} else {
|
||||
|
||||
@@ -43,6 +43,10 @@
|
||||
mod tests;
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use core::{
|
||||
marker::PhantomData,
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
use frame_support::{
|
||||
dispatch::DispatchResult,
|
||||
pallet_prelude::MaxEncodedLen,
|
||||
@@ -54,11 +58,6 @@ use frame_system::pallet_prelude::BlockNumberFor;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_io::hashing::blake2_256;
|
||||
use sp_runtime::RuntimeDebug;
|
||||
use sp_std::{
|
||||
marker::PhantomData,
|
||||
ops::{Deref, DerefMut},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
/// Pending atomic swap operation.
|
||||
#[derive(Clone, Eq, PartialEq, RuntimeDebugNoBound, Encode, Decode, TypeInfo, MaxEncodedLen)]
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
use frame_support::{pallet_prelude::*, traits::Get, weights::Weight};
|
||||
|
||||
struct __LastTimestamp<T>(sp_std::marker::PhantomData<T>);
|
||||
struct __LastTimestamp<T>(core::marker::PhantomData<T>);
|
||||
impl<T: RemoveLastTimestamp> frame_support::traits::StorageInstance for __LastTimestamp<T> {
|
||||
fn pallet_prefix() -> &'static str {
|
||||
T::PalletPrefix::get()
|
||||
|
||||
@@ -51,7 +51,7 @@ use sp_runtime::traits::{Hash, One, Saturating};
|
||||
///
|
||||
/// Adversaries should not possess many block production slots towards the beginning or
|
||||
/// end of every epoch, but they possess some influence over when they possess more slots.
|
||||
pub struct RandomnessFromTwoEpochsAgo<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct RandomnessFromTwoEpochsAgo<T>(core::marker::PhantomData<T>);
|
||||
|
||||
/// Randomness usable by on-chain code that **does not depend** upon finality and takes
|
||||
/// action based upon on-chain commitments made during the previous epoch.
|
||||
@@ -79,7 +79,7 @@ pub struct RandomnessFromTwoEpochsAgo<T>(sp_std::marker::PhantomData<T>);
|
||||
/// As an example usage, we determine parachain auctions ending times in Polkadot using
|
||||
/// `RandomnessFromOneEpochAgo` because it reduces bias from `ParentBlockRandomness` and
|
||||
/// does not require the extra finality delay of `RandomnessFromTwoEpochsAgo`.
|
||||
pub struct RandomnessFromOneEpochAgo<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct RandomnessFromOneEpochAgo<T>(core::marker::PhantomData<T>);
|
||||
|
||||
/// Randomness produced semi-freshly with each block, but inherits limitations of
|
||||
/// `RandomnessFromTwoEpochsAgo` from which it derives.
|
||||
@@ -119,7 +119,7 @@ pub struct RandomnessFromOneEpochAgo<T>(sp_std::marker::PhantomData<T>);
|
||||
/// instead you are using this randomness externally, i.e. after block execution, then
|
||||
/// this randomness will be provided by the "current" block (this stems from the fact that
|
||||
/// we process VRF outputs on block execution finalization, i.e. `on_finalize`).
|
||||
pub struct ParentBlockRandomness<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct ParentBlockRandomness<T>(core::marker::PhantomData<T>);
|
||||
|
||||
/// Randomness produced semi-freshly with each block, but inherits limitations of
|
||||
/// `RandomnessFromTwoEpochsAgo` from which it derives.
|
||||
@@ -128,7 +128,7 @@ pub struct ParentBlockRandomness<T>(sp_std::marker::PhantomData<T>);
|
||||
#[deprecated(note = "Should not be relied upon for correctness, \
|
||||
will not provide fresh randomness for the current block. \
|
||||
Please use `ParentBlockRandomness` instead.")]
|
||||
pub struct CurrentBlockRandomness<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct CurrentBlockRandomness<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config> RandomnessT<T::Hash, BlockNumberFor<T>> for RandomnessFromTwoEpochsAgo<T> {
|
||||
fn random(subject: &[u8]) -> (T::Hash, BlockNumberFor<T>) {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use core::str;
|
||||
use frame_support::{
|
||||
storage::{generator::StorageValue, StoragePrefixedMap},
|
||||
traits::{
|
||||
@@ -25,7 +26,6 @@ use frame_support::{
|
||||
};
|
||||
use sp_core::hexdisplay::HexDisplay;
|
||||
use sp_io::{hashing::twox_128, storage};
|
||||
use sp_std::str;
|
||||
|
||||
use crate as pallet_bounties;
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
use super::*;
|
||||
use crate::Pallet as Collective;
|
||||
|
||||
use core::mem::size_of;
|
||||
use sp_runtime::traits::Bounded;
|
||||
use sp_std::mem::size_of;
|
||||
|
||||
use frame_benchmarking::v1::{account, benchmarks_instance_pallet, whitelisted_caller};
|
||||
use frame_system::{
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{exec::ExecError, Config, Error};
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::{
|
||||
dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, PostDispatchInfo},
|
||||
weights::Weight,
|
||||
@@ -23,7 +24,6 @@ use frame_support::{
|
||||
};
|
||||
use sp_core::Get;
|
||||
use sp_runtime::{traits::Zero, DispatchError};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
#[cfg(test)]
|
||||
use std::{any::Any, fmt::Debug};
|
||||
|
||||
@@ -25,7 +25,10 @@ use crate::{
|
||||
CodeHash, Config, Pallet, TrieId, Weight, LOG_TARGET,
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
use core::cmp::{max, min};
|
||||
use core::{
|
||||
cmp::{max, min},
|
||||
ops::Deref,
|
||||
};
|
||||
use frame_support::{
|
||||
pallet_prelude::*,
|
||||
storage_alias,
|
||||
@@ -42,7 +45,7 @@ use sp_runtime::{
|
||||
traits::{Hash, TrailingZeroInput, Zero},
|
||||
Perbill, Saturating,
|
||||
};
|
||||
use sp_std::{ops::Deref, prelude::*};
|
||||
use sp_std::prelude::*;
|
||||
|
||||
mod old {
|
||||
use super::*;
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
use crate::{weights::WeightInfo, Config};
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::{weights::Weight, DefaultNoBound};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Definition of the cost schedule and other parameterizations for the wasm vm.
|
||||
///
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use core::cell::RefCell;
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, derive_impl, ord_parameter_types,
|
||||
pallet_prelude::Weight,
|
||||
@@ -27,7 +28,6 @@ use frame_support::{
|
||||
};
|
||||
use frame_system::EnsureSignedBy;
|
||||
use sp_runtime::{traits::TryMorphInto, BuildStorage, DispatchError, DispatchResult};
|
||||
use sp_std::cell::RefCell;
|
||||
|
||||
use crate as pallet_core_fellowship;
|
||||
use crate::*;
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
|
||||
use crate::types::Delegations;
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use core::result::Result;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_runtime::{
|
||||
traits::{Bounded, CheckedDiv, CheckedMul, Zero},
|
||||
RuntimeDebug,
|
||||
};
|
||||
use sp_std::{prelude::*, result::Result};
|
||||
|
||||
/// A value denoting the strength of conviction of a vote.
|
||||
#[derive(
|
||||
|
||||
@@ -54,7 +54,7 @@ pub mod v1 {
|
||||
use super::*;
|
||||
|
||||
/// Migration for translating bare `Hash`es into `Bounded<Call>`s.
|
||||
pub struct Migration<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct Migration<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config + frame_system::Config<Hash = H256>> OnRuntimeUpgrade for Migration<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
use crate::Tally;
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use core::ops::{Add, Div, Mul, Rem};
|
||||
use scale_info::TypeInfo;
|
||||
#[cfg(feature = "std")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sp_runtime::traits::{IntegerSquareRoot, Zero};
|
||||
use sp_std::ops::{Add, Div, Mul, Rem};
|
||||
|
||||
/// A means of determining if a vote is past pass threshold.
|
||||
#[derive(
|
||||
|
||||
@@ -496,7 +496,7 @@ frame_benchmarking::benchmarks! {
|
||||
let (_, stake, _) = voters[*idx];
|
||||
stake
|
||||
}).unwrap_or_default();
|
||||
sp_std::cmp::Reverse(stake)
|
||||
core::cmp::Reverse(stake)
|
||||
});
|
||||
|
||||
let mut index_assignments = assignments
|
||||
|
||||
@@ -29,7 +29,7 @@ mod solution_type {
|
||||
// these need to come from the same dev-dependency `frame-election-provider-support`, not from
|
||||
// the crate.
|
||||
use crate::{generate_solution_type, Assignment, Error as NposError, NposSolution};
|
||||
use sp_std::fmt::Debug;
|
||||
use core::fmt::Debug;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod __private {
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
/// Weight functions needed for pallet_election_provider_support_benchmarking.
|
||||
pub trait WeightInfo {
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::{
|
||||
dispatch::{ClassifyDispatch, DispatchClass, DispatchResult, Pays, PaysFee, WeighData},
|
||||
traits::IsSubType,
|
||||
@@ -68,7 +69,7 @@ use sp_runtime::{
|
||||
InvalidTransaction, TransactionValidity, TransactionValidityError, ValidTransaction,
|
||||
},
|
||||
};
|
||||
use sp_std::{marker::PhantomData, prelude::*};
|
||||
use sp_std::vec::Vec;
|
||||
|
||||
// Re-export pallet items so that they can be accessed from the crate namespace.
|
||||
pub use pallet::*;
|
||||
@@ -485,8 +486,8 @@ impl<T: Config> Pallet<T> {
|
||||
#[scale_info(skip_type_params(T))]
|
||||
pub struct WatchDummy<T: Config + Send + Sync>(PhantomData<T>);
|
||||
|
||||
impl<T: Config + Send + Sync> sp_std::fmt::Debug for WatchDummy<T> {
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
impl<T: Config + Send + Sync> core::fmt::Debug for WatchDummy<T> {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
|
||||
write!(f, "WatchDummy")
|
||||
}
|
||||
}
|
||||
@@ -501,7 +502,7 @@ where
|
||||
type AdditionalSigned = ();
|
||||
type Pre = ();
|
||||
|
||||
fn additional_signed(&self) -> sp_std::result::Result<(), TransactionValidityError> {
|
||||
fn additional_signed(&self) -> core::result::Result<(), TransactionValidityError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
||||
use sp_std::marker::PhantomData;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Weight functions needed for pallet_example_basic.
|
||||
pub trait WeightInfo {
|
||||
|
||||
@@ -35,7 +35,7 @@ mod v5;
|
||||
/// This migration should be added with a runtime upgrade that introduces the
|
||||
/// `MaxSetIdSessionEntries` constant to the pallet (although it could also be
|
||||
/// done later on).
|
||||
pub struct CleanupSetIdSessionMap<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct CleanupSetIdSessionMap<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for CleanupSetIdSessionMap<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
// NOTE: since this migration will loop over all stale entries in the
|
||||
|
||||
@@ -56,7 +56,7 @@ pub mod v1 {
|
||||
use super::*;
|
||||
|
||||
/// Simple migration that replaces `ReceivedHeartbeats` values with `true`.
|
||||
pub struct Migration<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct Migration<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config> OnRuntimeUpgrade for Migration<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
|
||||
@@ -30,7 +30,7 @@ pub type NodeOf<T, I, L> = Node<<T as crate::Config<I>>::Hashing, L>;
|
||||
pub type Node<H, L> = DataOrHash<H, L>;
|
||||
|
||||
/// Default Merging & Hashing behavior for MMR.
|
||||
pub struct Hasher<H, L>(sp_std::marker::PhantomData<(H, L)>);
|
||||
pub struct Hasher<H, L>(core::marker::PhantomData<(H, L)>);
|
||||
|
||||
impl<H: traits::Hash, L: FullLeaf> mmr_lib::Merge for Hasher<H, L> {
|
||||
type Item = Node<H, L>;
|
||||
|
||||
@@ -39,7 +39,7 @@ pub mod v1 {
|
||||
(OpaqueCall<T>, <T as frame_system::Config>::AccountId, BalanceOf<T>),
|
||||
>;
|
||||
|
||||
pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct MigrateToV1<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
|
||||
|
||||
@@ -42,7 +42,7 @@ macro_rules! impl_codec_bitflags {
|
||||
impl Decode for $wrapper {
|
||||
fn decode<I: codec::Input>(
|
||||
input: &mut I,
|
||||
) -> sp_std::result::Result<Self, codec::Error> {
|
||||
) -> ::core::result::Result<Self, codec::Error> {
|
||||
let field = <$size>::decode(input)?;
|
||||
Ok(Self(BitFlags::from_bits(field as $size).map_err(|_| "invalid value")?))
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ pub mod v1 {
|
||||
}
|
||||
|
||||
/// A migration utility to update the storage version from v0 to v1 for the pallet.
|
||||
pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct MigrateToV1<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
let current_version = Pallet::<T>::current_storage_version();
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
|
||||
use sp_std::marker::PhantomData;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
pub trait WeightInfo {
|
||||
fn add_well_known_node() -> Weight;
|
||||
|
||||
@@ -23,7 +23,7 @@ use sp_runtime::{bounded_btree_map, traits::Dispatchable, FixedU128};
|
||||
|
||||
macro_rules! unbonding_pools_with_era {
|
||||
($($k:expr => $v:expr),* $(,)?) => {{
|
||||
use sp_std::iter::{Iterator, IntoIterator};
|
||||
use ::core::iter::{Iterator, IntoIterator};
|
||||
let not_bounded: BTreeMap<_, _> = Iterator::collect(IntoIterator::into_iter([$(($k, $v),)*]));
|
||||
BoundedBTreeMap::<EraIndex, UnbondPool<T>, TotalUnbondingPools<T>>::try_from(not_bounded).unwrap()
|
||||
}};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
use super::*;
|
||||
use codec::{Decode, Encode, EncodeLike, MaxEncodedLen};
|
||||
use core::fmt::Debug;
|
||||
use frame_support::{
|
||||
traits::{schedule::v3::Anon, Bounded},
|
||||
Parameter,
|
||||
@@ -26,7 +27,6 @@ use frame_support::{
|
||||
use scale_info::TypeInfo;
|
||||
use sp_arithmetic::{Rounding::*, SignedRounding::*};
|
||||
use sp_runtime::{FixedI64, PerThing, RuntimeDebug};
|
||||
use sp_std::fmt::Debug;
|
||||
|
||||
pub type BalanceOf<T, I = ()> =
|
||||
<<T as Config<I>>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
|
||||
|
||||
@@ -79,6 +79,7 @@ pub mod mock;
|
||||
mod tests;
|
||||
pub mod weights;
|
||||
|
||||
use core::convert::TryInto;
|
||||
use frame_support::{
|
||||
defensive_assert,
|
||||
pallet_prelude::*,
|
||||
@@ -96,7 +97,6 @@ use frame_support::{
|
||||
use frame_system::pallet_prelude::*;
|
||||
use sp_arithmetic::traits::Zero;
|
||||
use sp_runtime::traits::Saturating;
|
||||
use sp_std::{convert::TryInto, prelude::*};
|
||||
|
||||
pub use pallet::*;
|
||||
pub use weights::*;
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
use codec::{Decode, Encode, MaxEncodedLen};
|
||||
use core::marker::PhantomData;
|
||||
use scale_info::TypeInfo;
|
||||
use sp_arithmetic::traits::{Saturating, Zero};
|
||||
use sp_runtime::{Perbill, RuntimeDebug};
|
||||
use sp_std::{marker::PhantomData, prelude::*};
|
||||
|
||||
use frame_support::{
|
||||
defensive,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use core::cell::RefCell;
|
||||
use frame_support::{
|
||||
assert_noop, assert_ok, derive_impl,
|
||||
pallet_prelude::Weight,
|
||||
@@ -26,7 +27,6 @@ use frame_support::{
|
||||
traits::{tokens::ConvertRank, ConstU64},
|
||||
};
|
||||
use sp_runtime::{traits::Identity, BuildStorage, DispatchResult};
|
||||
use sp_std::cell::RefCell;
|
||||
|
||||
use crate as pallet_salary;
|
||||
use crate::*;
|
||||
|
||||
@@ -99,7 +99,7 @@ pub fn new_test_ext_with_pairs(
|
||||
pallet_sassafras::GenesisConfig::<Test> {
|
||||
authorities: authorities.clone(),
|
||||
epoch_config: TEST_EPOCH_CONFIGURATION,
|
||||
_phantom: sp_std::marker::PhantomData,
|
||||
_phantom: core::marker::PhantomData,
|
||||
}
|
||||
.assimilate_storage(&mut storage)
|
||||
.unwrap();
|
||||
|
||||
@@ -81,7 +81,7 @@ pub mod v3 {
|
||||
StorageMap<Pallet<T>, Twox64Concat, Vec<u8>, TaskAddress<BlockNumberFor<T>>>;
|
||||
|
||||
/// Migrate the scheduler pallet from V3 to V4.
|
||||
pub struct MigrateToV4<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct MigrateToV4<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV4<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
@@ -194,7 +194,7 @@ pub mod v4 {
|
||||
///
|
||||
/// This should be run on a scheduler that does not have
|
||||
/// <https://github.com/paritytech/substrate/pull/12989> since it piles up `None`-only agendas. This does not modify the pallet version.
|
||||
pub struct CleanupAgendas<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct CleanupAgendas<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Config> OnRuntimeUpgrade for CleanupAgendas<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use core::str;
|
||||
use sp_io::hashing::twox_128;
|
||||
use sp_std::str;
|
||||
|
||||
use frame_support::{
|
||||
storage::{generator::StorageValue, StoragePrefixedMap},
|
||||
|
||||
@@ -29,7 +29,7 @@ const TARGET: &'static str = "runtime::society::migration";
|
||||
|
||||
/// This migration moves all the state to v2 of Society.
|
||||
pub struct VersionUncheckedMigrateToV2<T: Config<I>, I: 'static, PastPayouts>(
|
||||
sp_std::marker::PhantomData<(T, I, PastPayouts)>,
|
||||
core::marker::PhantomData<(T, I, PastPayouts)>,
|
||||
);
|
||||
|
||||
impl<
|
||||
|
||||
Generated
+1
-1
@@ -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;
|
||||
|
||||
/// Weight functions needed for pallet_society.
|
||||
pub trait WeightInfo {
|
||||
|
||||
@@ -84,7 +84,7 @@ use frame_election_provider_support::{
|
||||
pub struct StaticTracker<DataProvider> {
|
||||
pub size: usize,
|
||||
pub counter: usize,
|
||||
_marker: sp_std::marker::PhantomData<DataProvider>,
|
||||
_marker: core::marker::PhantomData<DataProvider>,
|
||||
}
|
||||
|
||||
impl<DataProvider> Default for StaticTracker<DataProvider> {
|
||||
|
||||
@@ -64,7 +64,7 @@ type StorageVersion<T: Config> = StorageValue<Pallet<T>, ObsoleteReleases, Value
|
||||
pub mod v14 {
|
||||
use super::*;
|
||||
|
||||
pub struct MigrateToV14<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct MigrateToV14<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV14<T> {
|
||||
fn on_runtime_upgrade() -> Weight {
|
||||
let current = Pallet::<T>::current_storage_version();
|
||||
@@ -95,7 +95,7 @@ pub mod v14 {
|
||||
pub mod v13 {
|
||||
use super::*;
|
||||
|
||||
pub struct MigrateToV13<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct MigrateToV13<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV13<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
|
||||
@@ -151,7 +151,7 @@ pub mod v12 {
|
||||
///
|
||||
/// We will be depending on the configurable value of `T::HistoryDepth` post
|
||||
/// this release.
|
||||
pub struct MigrateToV12<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct MigrateToV12<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV12<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<Vec<u8>, TryRuntimeError> {
|
||||
@@ -205,7 +205,7 @@ pub mod v11 {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
use sp_io::hashing::twox_128;
|
||||
|
||||
pub struct MigrateToV11<T, P, N>(sp_std::marker::PhantomData<(T, P, N)>);
|
||||
pub struct MigrateToV11<T, P, N>(core::marker::PhantomData<(T, P, N)>);
|
||||
impl<T: Config, P: GetStorageVersion + PalletInfoAccess, N: Get<&'static str>> OnRuntimeUpgrade
|
||||
for MigrateToV11<T, P, N>
|
||||
{
|
||||
@@ -301,7 +301,7 @@ pub mod v10 {
|
||||
/// That means we might slash someone a bit too early, but we will definitely
|
||||
/// won't forget to slash them. The cap of 512 is somewhat randomly taken to
|
||||
/// prevent us from iterating over an arbitrary large number of keys `on_runtime_upgrade`.
|
||||
pub struct MigrateToV10<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct MigrateToV10<T>(core::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV10<T> {
|
||||
fn on_runtime_upgrade() -> frame_support::weights::Weight {
|
||||
if StorageVersion::<T>::get() == ObsoleteReleases::V9_0_0 {
|
||||
|
||||
@@ -178,7 +178,7 @@ pub fn expand_outer_dispatch(
|
||||
type PostInfo = #scrate::dispatch::PostDispatchInfo;
|
||||
fn dispatch(self, origin: RuntimeOrigin) -> #scrate::dispatch::DispatchResultWithPostInfo {
|
||||
if !<Self::RuntimeOrigin as #scrate::traits::OriginTrait>::filter_call(&origin, &self) {
|
||||
return #scrate::__private::sp_std::result::Result::Err(
|
||||
return ::core::result::Result::Err(
|
||||
#system_path::Error::<#runtime>::CallFiltered.into()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,6 @@ pub fn expand_outer_enum(
|
||||
enum_ty,
|
||||
));
|
||||
enum_conversions.extend(expand_enum_conversion(
|
||||
scrate,
|
||||
pallet_decl,
|
||||
&pallet_enum,
|
||||
&enum_name_ident,
|
||||
@@ -220,7 +219,6 @@ fn expand_enum_variant(
|
||||
}
|
||||
|
||||
fn expand_enum_conversion(
|
||||
scrate: &TokenStream,
|
||||
pallet: &Pallet,
|
||||
pallet_enum: &TokenStream,
|
||||
enum_name_ident: &Ident,
|
||||
@@ -247,7 +245,7 @@ fn expand_enum_conversion(
|
||||
impl TryInto<#pallet_enum> for #enum_name_ident {
|
||||
type Error = ();
|
||||
|
||||
fn try_into(self) -> #scrate::__private::sp_std::result::Result<#pallet_enum, Self::Error> {
|
||||
fn try_into(self) -> ::core::result::Result<#pallet_enum, Self::Error> {
|
||||
match self {
|
||||
Self::#variant_name(evt) => Ok(evt),
|
||||
_ => Err(()),
|
||||
|
||||
@@ -304,7 +304,7 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
#[doc(hidden)]
|
||||
#[codec(skip)]
|
||||
__Ignore(
|
||||
#frame_support::__private::sp_std::marker::PhantomData<(#type_use_gen,)>,
|
||||
::core::marker::PhantomData<(#type_use_gen,)>,
|
||||
#frame_support::Never,
|
||||
),
|
||||
#(
|
||||
|
||||
@@ -87,7 +87,7 @@ pub fn expand_event(def: &mut Def) -> proc_macro2::TokenStream {
|
||||
#[doc(hidden)]
|
||||
#[codec(skip)]
|
||||
__Ignore(
|
||||
#frame_support::__private::sp_std::marker::PhantomData<(#event_use_gen)>,
|
||||
::core::marker::PhantomData<(#event_use_gen)>,
|
||||
#frame_support::Never,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -171,7 +171,7 @@ impl CompositeDef {
|
||||
#[doc(hidden)]
|
||||
#[codec(skip)]
|
||||
__Ignore(
|
||||
#scrate::__private::sp_std::marker::PhantomData<I>,
|
||||
::core::marker::PhantomData<I>,
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ fn generate_storage_instance(
|
||||
|
||||
quote! {
|
||||
#visibility struct #counter_name< #impl_generics >(
|
||||
#crate_::__private::sp_std::marker::PhantomData<(#type_generics)>
|
||||
::core::marker::PhantomData<(#type_generics)>
|
||||
) #where_clause;
|
||||
|
||||
impl<#impl_generics> #crate_::traits::StorageInstance
|
||||
@@ -653,7 +653,7 @@ fn generate_storage_instance(
|
||||
let code = quote! {
|
||||
#[allow(non_camel_case_types)]
|
||||
#visibility struct #name< #impl_generics >(
|
||||
#crate_::__private::sp_std::marker::PhantomData<(#type_generics)>
|
||||
::core::marker::PhantomData<(#type_generics)>
|
||||
) #where_clause;
|
||||
|
||||
impl<#impl_generics> #crate_::traits::StorageInstance
|
||||
|
||||
@@ -171,7 +171,7 @@ pub mod frame_system {
|
||||
pub data: Vec<(u32, u64)>,
|
||||
pub test_config: Vec<(u32, u32, u64)>,
|
||||
#[serde(skip)]
|
||||
pub _config: sp_std::marker::PhantomData<T>,
|
||||
pub _config: core::marker::PhantomData<T>,
|
||||
}
|
||||
|
||||
impl<T: Config> Default for GenesisConfig<T> {
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
use crate::dispatch::{DispatchResultWithPostInfo, Parameter, RawOrigin};
|
||||
use codec::MaxEncodedLen;
|
||||
use core::{cmp::Ordering, marker::PhantomData};
|
||||
use sp_runtime::{
|
||||
traits::{BadOrigin, Get, Member, Morph, TryMorph},
|
||||
Either,
|
||||
};
|
||||
use sp_std::{cmp::Ordering, marker::PhantomData};
|
||||
|
||||
use super::misc;
|
||||
|
||||
@@ -85,7 +85,7 @@ pub trait EnsureOrigin<OuterOrigin> {
|
||||
/// ```rust
|
||||
/// # use frame_support::traits::{EnsureOriginEqualOrHigherPrivilege, PrivilegeCmp, EnsureOrigin as _};
|
||||
/// # use sp_runtime::traits::{parameter_types, Get};
|
||||
/// # use sp_std::cmp::Ordering;
|
||||
/// # use core::cmp::Ordering;
|
||||
///
|
||||
/// #[derive(Eq, PartialEq, Debug)]
|
||||
/// pub enum Origin {
|
||||
@@ -124,7 +124,7 @@ pub trait EnsureOrigin<OuterOrigin> {
|
||||
/// assert!(EnsureOrigin::ensure_origin(Origin::NormalUser).is_err());
|
||||
/// ```
|
||||
pub struct EnsureOriginEqualOrHigherPrivilege<Origin, PrivilegeCmp>(
|
||||
sp_std::marker::PhantomData<(Origin, PrivilegeCmp)>,
|
||||
core::marker::PhantomData<(Origin, PrivilegeCmp)>,
|
||||
);
|
||||
|
||||
impl<OuterOrigin, Origin, PrivilegeCmp> EnsureOrigin<OuterOrigin>
|
||||
@@ -218,7 +218,7 @@ macro_rules! impl_ensure_origin_with_arg_ignoring_arg {
|
||||
}
|
||||
|
||||
/// [`EnsureOrigin`] implementation that always fails.
|
||||
pub struct NeverEnsureOrigin<Success>(sp_std::marker::PhantomData<Success>);
|
||||
pub struct NeverEnsureOrigin<Success>(core::marker::PhantomData<Success>);
|
||||
impl<OO, Success> EnsureOrigin<OO> for NeverEnsureOrigin<Success> {
|
||||
type Success = Success;
|
||||
fn try_origin(o: OO) -> Result<Success, OO> {
|
||||
@@ -235,7 +235,7 @@ impl_ensure_origin_with_arg_ignoring_arg! {
|
||||
{}
|
||||
}
|
||||
|
||||
pub struct AsEnsureOriginWithArg<EO>(sp_std::marker::PhantomData<EO>);
|
||||
pub struct AsEnsureOriginWithArg<EO>(core::marker::PhantomData<EO>);
|
||||
impl<OuterOrigin, Argument, EO: EnsureOrigin<OuterOrigin>>
|
||||
EnsureOriginWithArg<OuterOrigin, Argument> for AsEnsureOriginWithArg<EO>
|
||||
{
|
||||
@@ -353,7 +353,7 @@ impl<
|
||||
/// Origin check will pass if `L` or `R` origin check passes. `L` is tested first.
|
||||
///
|
||||
/// Successful origin is derived from the left side.
|
||||
pub struct EitherOfDiverse<L, R>(sp_std::marker::PhantomData<(L, R)>);
|
||||
pub struct EitherOfDiverse<L, R>(core::marker::PhantomData<(L, R)>);
|
||||
impl<OuterOrigin, L: EnsureOrigin<OuterOrigin>, R: EnsureOrigin<OuterOrigin>>
|
||||
EnsureOrigin<OuterOrigin> for EitherOfDiverse<L, R>
|
||||
{
|
||||
@@ -402,7 +402,7 @@ pub type EnsureOneOf<L, R> = EitherOfDiverse<L, R>;
|
||||
/// Origin check will pass if `L` or `R` origin check passes. `L` is tested first.
|
||||
///
|
||||
/// Successful origin is derived from the left side.
|
||||
pub struct EitherOf<L, R>(sp_std::marker::PhantomData<(L, R)>);
|
||||
pub struct EitherOf<L, R>(core::marker::PhantomData<(L, R)>);
|
||||
impl<
|
||||
OuterOrigin,
|
||||
L: EnsureOrigin<OuterOrigin>,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
//! Traits for describing and constraining pallet error types.
|
||||
use codec::{Compact, Decode, Encode};
|
||||
use sp_std::marker::PhantomData;
|
||||
use core::marker::PhantomData;
|
||||
|
||||
/// Trait indicating that the implementing type is going to be included as a field in a variant of
|
||||
/// the `#[pallet::error]` enum type.
|
||||
|
||||
@@ -81,7 +81,7 @@ pub trait StoredMap<K, T: Default> {
|
||||
/// be the default value), or where the account is being removed or reset back to the default value
|
||||
/// where previously it did exist (though may have been in a default state). This works well with
|
||||
/// system module's `CallOnCreatedAccount` and `CallKillAccount`.
|
||||
pub struct StorageMapShim<S, K, T>(sp_std::marker::PhantomData<(S, K, T)>);
|
||||
pub struct StorageMapShim<S, K, T>(core::marker::PhantomData<(S, K, T)>);
|
||||
impl<S: StorageMap<K, T, Query = T>, K: FullCodec, T: FullCodec + Default> StoredMap<K, T>
|
||||
for StorageMapShim<S, K, T>
|
||||
{
|
||||
|
||||
@@ -211,7 +211,7 @@ pub trait Currency<AccountId> {
|
||||
|
||||
/// A non-const `Get` implementation parameterised by a `Currency` impl which provides the result
|
||||
/// of `total_issuance`.
|
||||
pub struct TotalIssuanceOf<C: Currency<A>, A>(sp_std::marker::PhantomData<(C, A)>);
|
||||
pub struct TotalIssuanceOf<C: Currency<A>, A>(core::marker::PhantomData<(C, A)>);
|
||||
impl<C: Currency<A>, A> Get<C::Balance> for TotalIssuanceOf<C, A> {
|
||||
fn get() -> C::Balance {
|
||||
C::total_issuance()
|
||||
@@ -220,7 +220,7 @@ impl<C: Currency<A>, A> Get<C::Balance> for TotalIssuanceOf<C, A> {
|
||||
|
||||
/// A non-const `Get` implementation parameterised by a `Currency` impl which provides the result
|
||||
/// of `active_issuance`.
|
||||
pub struct ActiveIssuanceOf<C: Currency<A>, A>(sp_std::marker::PhantomData<(C, A)>);
|
||||
pub struct ActiveIssuanceOf<C: Currency<A>, A>(core::marker::PhantomData<(C, A)>);
|
||||
impl<C: Currency<A>, A> Get<C::Balance> for ActiveIssuanceOf<C, A> {
|
||||
fn get() -> C::Balance {
|
||||
C::active_issuance()
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
//! with unbalanced operations.
|
||||
|
||||
use crate::traits::misc::{SameOrOther, TryDrop};
|
||||
use core::ops::Div;
|
||||
use sp_runtime::traits::Saturating;
|
||||
use sp_std::ops::Div;
|
||||
|
||||
mod on_unbalanced;
|
||||
mod signed_imbalance;
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use core::str;
|
||||
use sp_io::hashing::twox_128;
|
||||
use sp_std::str;
|
||||
|
||||
use super::super::LOG_TARGET;
|
||||
use frame_support::{
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
/// ! Traits and default implementation for paying transaction fees.
|
||||
use crate::Config;
|
||||
|
||||
use core::marker::PhantomData;
|
||||
use sp_runtime::{
|
||||
traits::{DispatchInfoOf, PostDispatchInfoOf, Saturating, Zero},
|
||||
transaction_validity::InvalidTransaction,
|
||||
};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
use frame_support::{
|
||||
traits::{Currency, ExistenceRequirement, Imbalance, OnUnbalanced, WithdrawReasons},
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
//! Various pieces of common functionality.
|
||||
use super::*;
|
||||
use core::marker::PhantomData;
|
||||
use frame_support::traits::{Get, OnRuntimeUpgrade};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
mod v1 {
|
||||
use super::*;
|
||||
|
||||
@@ -243,7 +243,7 @@ fn generate_wasm_interface(impls: &[ItemImpl]) -> Result<TokenStream> {
|
||||
&[0u8; 0]
|
||||
} else {
|
||||
unsafe {
|
||||
#c::slice::from_raw_parts(input_data, input_len)
|
||||
::core::slice::from_raw_parts(input_data, input_len)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -345,7 +345,7 @@ fn generate_runtime_api_base_structures() -> Result<TokenStream> {
|
||||
&self,
|
||||
backend: &B,
|
||||
parent_hash: Block::Hash,
|
||||
) -> core::result::Result<
|
||||
) -> ::core::result::Result<
|
||||
#crate_::StorageChanges<Block>,
|
||||
String
|
||||
> where Self: Sized {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//! multiplication implementation provided there.
|
||||
|
||||
use crate::{biguint, Rounding};
|
||||
use sp_std::cmp::{max, min};
|
||||
use core::cmp::{max, min};
|
||||
|
||||
/// Helper gcd function used in Rational128 implementation.
|
||||
pub fn gcd(a: u128, b: u128) -> u128 {
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
//! Primitive traits for the runtime arithmetic.
|
||||
|
||||
use codec::HasCompact;
|
||||
use core::ops::{
|
||||
Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, RemAssign, Shl, Shr, Sub, SubAssign,
|
||||
};
|
||||
pub use ensure::{
|
||||
ensure_pow, Ensure, EnsureAdd, EnsureAddAssign, EnsureDiv, EnsureDivAssign,
|
||||
EnsureFixedPointNumber, EnsureFrom, EnsureInto, EnsureMul, EnsureMulAssign, EnsureOp,
|
||||
@@ -28,9 +31,6 @@ pub use num_traits::{
|
||||
checked_pow, Bounded, CheckedAdd, CheckedDiv, CheckedMul, CheckedNeg, CheckedRem, CheckedShl,
|
||||
CheckedShr, CheckedSub, One, Signed, Unsigned, Zero,
|
||||
};
|
||||
use sp_std::ops::{
|
||||
Add, AddAssign, Div, DivAssign, Mul, MulAssign, Rem, RemAssign, Shl, Shr, Sub, SubAssign,
|
||||
};
|
||||
|
||||
use crate::MultiplyRational;
|
||||
|
||||
@@ -262,7 +262,7 @@ pub trait Saturating {
|
||||
Self: One,
|
||||
{
|
||||
let mut o = Self::one();
|
||||
sp_std::mem::swap(&mut o, self);
|
||||
core::mem::swap(&mut o, self);
|
||||
*self = o.saturating_add(One::one());
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ pub trait Saturating {
|
||||
Self: One,
|
||||
{
|
||||
let mut o = Self::one();
|
||||
sp_std::mem::swap(&mut o, self);
|
||||
core::mem::swap(&mut o, self);
|
||||
*self = o.saturating_sub(One::one());
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ pub trait Saturating {
|
||||
Self: One,
|
||||
{
|
||||
let mut o = Self::one();
|
||||
sp_std::mem::swap(&mut o, self);
|
||||
core::mem::swap(&mut o, self);
|
||||
*self = o.saturating_add(amount);
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ pub trait Saturating {
|
||||
Self: One,
|
||||
{
|
||||
let mut o = Self::one();
|
||||
sp_std::mem::swap(&mut o, self);
|
||||
core::mem::swap(&mut o, self);
|
||||
*self = o.saturating_sub(amount);
|
||||
}
|
||||
}
|
||||
@@ -949,7 +949,7 @@ mod ensure {
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_std::ops::Mul for Signum {
|
||||
impl core::ops::Mul for Signum {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, rhs: Self) -> Self {
|
||||
|
||||
@@ -69,7 +69,7 @@ impl InherentDataProvider {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl sp_std::ops::Deref for InherentDataProvider {
|
||||
impl core::ops::Deref for InherentDataProvider {
|
||||
type Target = InherentType;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
|
||||
//! Inherents for BABE
|
||||
|
||||
use core::result::Result;
|
||||
use sp_inherents::{Error, InherentData, InherentIdentifier};
|
||||
use sp_std::result::Result;
|
||||
|
||||
/// The BABE inherent identifier.
|
||||
pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"babeslot";
|
||||
@@ -75,7 +75,7 @@ impl InherentDataProvider {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl sp_std::ops::Deref for InherentDataProvider {
|
||||
impl core::ops::Deref for InherentDataProvider {
|
||||
type Target = InherentType;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
||||
@@ -155,9 +155,9 @@ impl SlotDuration {
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl SlotDuration {
|
||||
/// Returns `self` as [`sp_std::time::Duration`].
|
||||
pub const fn as_duration(&self) -> sp_std::time::Duration {
|
||||
sp_std::time::Duration::from_millis(self.0)
|
||||
/// Returns `self` as [`core::time::Duration`].
|
||||
pub const fn as_duration(&self) -> core::time::Duration {
|
||||
core::time::Duration::from_millis(self.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ macro_rules! wasm_export_functions {
|
||||
&[0u8; 0]
|
||||
} else {
|
||||
unsafe {
|
||||
$crate::sp_std::slice::from_raw_parts(input_data, input_len)
|
||||
::core::slice::from_raw_parts(input_data, input_len)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -117,7 +117,7 @@ macro_rules! wasm_export_functions {
|
||||
&[0u8; 0]
|
||||
} else {
|
||||
unsafe {
|
||||
$crate::sp_std::slice::from_raw_parts(input_data, input_len)
|
||||
::core::slice::from_raw_parts(input_data, input_len)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
pub fn pack_ptr_and_len(ptr: u32, len: u32) -> u64 {
|
||||
// The static assertions from above are changed into a runtime check.
|
||||
#[cfg(all(not(feature = "std"), feature = "disable_target_static_assertions"))]
|
||||
assert_eq!(4, sp_std::mem::size_of::<usize>());
|
||||
assert_eq!(4, core::mem::size_of::<usize>());
|
||||
|
||||
(u64::from(len) << 32) | u64::from(ptr)
|
||||
}
|
||||
@@ -34,7 +34,7 @@ pub fn pack_ptr_and_len(ptr: u32, len: u32) -> u64 {
|
||||
pub fn unpack_ptr_and_len(val: u64) -> (u32, u32) {
|
||||
// The static assertions from above are changed into a runtime check.
|
||||
#[cfg(all(not(feature = "std"), feature = "disable_target_static_assertions"))]
|
||||
assert_eq!(4, sp_std::mem::size_of::<usize>());
|
||||
assert_eq!(4, core::mem::size_of::<usize>());
|
||||
|
||||
let ptr = (val & (!0u32 as u64)) as u32;
|
||||
let len = (val >> 32) as u32;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
use crate::RIType;
|
||||
|
||||
use sp_std::cell::Cell;
|
||||
use core::cell::Cell;
|
||||
|
||||
/// Something that can be created from a ffi value.
|
||||
///
|
||||
|
||||
@@ -133,7 +133,7 @@ where
|
||||
impl<Number, Hash> Header<Number, Hash>
|
||||
where
|
||||
Number: Member
|
||||
+ sp_std::hash::Hash
|
||||
+ core::hash::Hash
|
||||
+ Copy
|
||||
+ MaybeDisplay
|
||||
+ AtLeast32BitUnsigned
|
||||
|
||||
@@ -66,9 +66,9 @@ use crate::{
|
||||
traits::BlockNumberProvider,
|
||||
};
|
||||
use codec::{Codec, Decode, Encode};
|
||||
use core::fmt;
|
||||
use sp_core::offchain::{Duration, Timestamp};
|
||||
use sp_io::offchain;
|
||||
use sp_std::fmt;
|
||||
|
||||
/// Default expiry duration for time based locks in milliseconds.
|
||||
const STORAGE_LOCK_DEFAULT_EXPIRY_DURATION: Duration = Duration::from_millis(20_000);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
/// State Machine Errors
|
||||
use sp_std::fmt;
|
||||
use core::fmt;
|
||||
|
||||
/// State Machine Error bound.
|
||||
///
|
||||
|
||||
@@ -79,7 +79,7 @@ where
|
||||
|
||||
/// Apply the given transaction to this backend and set the root to the given value.
|
||||
pub fn apply_transaction(&mut self, root: H::Out, transaction: PrefixedMemoryDB<H>) {
|
||||
let mut storage = sp_std::mem::take(self).into_storage();
|
||||
let mut storage = core::mem::take(self).into_storage();
|
||||
|
||||
storage.consolidate(transaction);
|
||||
*self = TrieBackendBuilder::new(storage, root).build();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
//! Usage statistics for state db
|
||||
|
||||
use sp_std::cell::RefCell;
|
||||
use core::cell::RefCell;
|
||||
#[cfg(feature = "std")]
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use codec::{Decode, Encode};
|
||||
use core::time::Duration;
|
||||
use sp_inherents::{InherentData, InherentIdentifier, IsFatalError};
|
||||
use sp_std::time::Duration;
|
||||
|
||||
/// The identifier for the `timestamp` inherent.
|
||||
pub const INHERENT_IDENTIFIER: InherentIdentifier = *b"timstap0";
|
||||
@@ -69,7 +69,7 @@ impl Timestamp {
|
||||
}
|
||||
}
|
||||
|
||||
impl sp_std::ops::Deref for Timestamp {
|
||||
impl core::ops::Deref for Timestamp {
|
||||
type Target = u64;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
@@ -219,7 +219,7 @@ impl InherentDataProvider {
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl sp_std::ops::Deref for InherentDataProvider {
|
||||
impl core::ops::Deref for InherentDataProvider {
|
||||
type Target = InherentType;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
use crate::trie_constants;
|
||||
use codec::{Decode, Encode, Input, Output};
|
||||
use sp_std::iter::once;
|
||||
use core::iter::once;
|
||||
|
||||
/// A node header
|
||||
#[derive(Copy, Clone, PartialEq, Eq, sp_core::RuntimeDebug)]
|
||||
@@ -118,7 +118,7 @@ pub(crate) fn size_and_prefix_iterator(
|
||||
prefix_mask: usize,
|
||||
) -> impl Iterator<Item = u8> {
|
||||
let max_value = 255u8 >> prefix_mask;
|
||||
let l1 = sp_std::cmp::min((max_value as usize).saturating_sub(1), size);
|
||||
let l1 = core::cmp::min((max_value as usize).saturating_sub(1), size);
|
||||
let (first_byte, mut rem) = if size == l1 {
|
||||
(once(prefix + l1 as u8), 0)
|
||||
} else {
|
||||
@@ -138,7 +138,7 @@ pub(crate) fn size_and_prefix_iterator(
|
||||
None
|
||||
}
|
||||
};
|
||||
first_byte.chain(sp_std::iter::from_fn(next_bytes))
|
||||
first_byte.chain(core::iter::from_fn(next_bytes))
|
||||
}
|
||||
|
||||
/// Encodes size and prefix to a stream output.
|
||||
|
||||
@@ -235,7 +235,7 @@ where
|
||||
}
|
||||
|
||||
/// Implementor of `WeightToFee` that maps one unit of weight to one unit of fee.
|
||||
pub struct IdentityFee<T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct IdentityFee<T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<T> WeightToFee for IdentityFee<T>
|
||||
where
|
||||
@@ -249,7 +249,7 @@ where
|
||||
}
|
||||
|
||||
/// Implementor of [`WeightToFee`] such that it maps any unit of weight to a fixed fee.
|
||||
pub struct FixedFee<const F: u32, T>(sp_std::marker::PhantomData<T>);
|
||||
pub struct FixedFee<const F: u32, T>(core::marker::PhantomData<T>);
|
||||
|
||||
impl<const F: u32, T> WeightToFee for FixedFee<F, T>
|
||||
where
|
||||
@@ -275,7 +275,7 @@ pub type NoFee<T> = FixedFee<0, T>;
|
||||
/// // Results in a multiplier of 10 for each unit of weight (or length)
|
||||
/// type LengthToFee = ConstantMultiplier::<u128, ConstU128<10u128>>;
|
||||
/// ```
|
||||
pub struct ConstantMultiplier<T, M>(sp_std::marker::PhantomData<(T, M)>);
|
||||
pub struct ConstantMultiplier<T, M>(core::marker::PhantomData<(T, M)>);
|
||||
|
||||
impl<T, M> WeightToFee for ConstantMultiplier<T, M>
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user