Restructure dispatch macro related exports (#1162)

* restructure dispatch macro related exports

* moved Dispatchable to lib.rs

* fix .gitignore final newline

* ".git/.scripts/commands/fmt/fmt.sh"

* fix rustdocs

* wip

---------

Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
Co-authored-by: command-bot <>
Co-authored-by: ordian <write@reusable.software>
This commit is contained in:
Juan
2023-08-31 13:08:44 +02:00
committed by GitHub
parent d6af073aa5
commit bdbe982970
84 changed files with 195 additions and 244 deletions
Generated
-1
View File
@@ -9970,7 +9970,6 @@ dependencies = [
name = "pallet-nfts-runtime-api"
version = "4.0.0-dev"
dependencies = [
"frame-support",
"pallet-nfts",
"parity-scale-codec",
"sp-api",
@@ -29,7 +29,7 @@ use bp_messages::{
use bp_runtime::messages::MessageDispatchResult;
use bp_xcm_bridge_hub_router::XcmChannelStatusProvider;
use codec::{Decode, Encode};
use frame_support::{dispatch::Weight, traits::Get, CloneNoBound, EqNoBound, PartialEqNoBound};
use frame_support::{traits::Get, weights::Weight, CloneNoBound, EqNoBound, PartialEqNoBound};
use pallet_bridge_messages::{
Config as MessagesConfig, OutboundLanesCongestedSignals, Pallet as MessagesPallet,
WeightInfoExt as MessagesPalletWeights,
@@ -51,13 +51,13 @@ mod integrity_tests {
use bp_messages::MessageNonce;
use bp_runtime::PreComputedSize;
use frame_support::{
dispatch::{DispatchClass, DispatchInfo, Dispatchable, Pays, PostDispatchInfo},
dispatch::{DispatchClass, DispatchInfo, Pays, PostDispatchInfo},
traits::Get,
};
use pallet_bridge_messages::WeightInfoExt;
use pallet_transaction_payment::OnChargeTransaction;
use sp_runtime::{
traits::{UniqueSaturatedInto, Zero},
traits::{Dispatchable, UniqueSaturatedInto, Zero},
transaction_validity::TransactionPriority,
FixedPointOperand, SaturatedConversion, Saturating,
};
@@ -27,7 +27,7 @@ use bp_relayers::{RewardsAccountOwner, RewardsAccountParams};
use bp_runtime::{Parachain, ParachainIdOf, RangeInclusiveExt, StaticStrProvider};
use codec::{Decode, Encode};
use frame_support::{
dispatch::{CallableCallFor, DispatchInfo, Dispatchable, PostDispatchInfo},
dispatch::{CallableCallFor, DispatchInfo, PostDispatchInfo},
traits::IsSubType,
weights::Weight,
CloneNoBound, DefaultNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound,
@@ -47,7 +47,7 @@ use pallet_transaction_payment::{Config as TransactionPaymentConfig, OnChargeTra
use pallet_utility::{Call as UtilityCall, Config as UtilityConfig, Pallet as UtilityPallet};
use scale_info::TypeInfo;
use sp_runtime::{
traits::{DispatchInfoOf, Get, PostDispatchInfoOf, SignedExtension, Zero},
traits::{DispatchInfoOf, Dispatchable, Get, PostDispatchInfoOf, SignedExtension, Zero},
transaction_validity::{
TransactionPriority, TransactionValidity, TransactionValidityError, ValidTransactionBuilder,
},
@@ -22,10 +22,7 @@ use crate::{Bridge, Call};
use bp_xcm_bridge_hub_router::{BridgeState, MINIMAL_DELIVERY_FEE_FACTOR};
use frame_benchmarking::benchmarks_instance_pallet;
use frame_support::{
dispatch::UnfilteredDispatchable,
traits::{EnsureOrigin, Get, Hooks},
};
use frame_support::traits::{EnsureOrigin, Get, Hooks, UnfilteredDispatchable};
use sp_runtime::traits::Zero;
use xcm::prelude::*;
+2 -2
View File
@@ -36,7 +36,7 @@ use cumulus_primitives_core::{
};
use cumulus_primitives_parachain_inherent::{MessageQueueChain, ParachainInherentData};
use frame_support::{
dispatch::{DispatchError, DispatchResult, Pays, PostDispatchInfo},
dispatch::{DispatchResult, Pays, PostDispatchInfo},
ensure,
inherent::{InherentData, InherentIdentifier, ProvideInherent},
storage,
@@ -52,7 +52,7 @@ use sp_runtime::{
InvalidTransaction, TransactionLongevity, TransactionSource, TransactionValidity,
ValidTransaction,
},
RuntimeDebug,
DispatchError, RuntimeDebug,
};
use sp_std::{cmp, collections::btree_map::BTreeMap, prelude::*};
use xcm::latest::XcmHash;
@@ -23,10 +23,9 @@ use cumulus_primitives_core::{
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
use frame_support::{
assert_ok,
dispatch::UnfilteredDispatchable,
inherent::{InherentData, ProvideInherent},
parameter_types,
traits::{OnFinalize, OnInitialize},
traits::{OnFinalize, OnInitialize, UnfilteredDispatchable},
weights::Weight,
};
use frame_system::{
+1 -1
View File
@@ -24,7 +24,7 @@ use codec::{Decode, DecodeLimit, Encode};
use cumulus_primitives_core::{
relay_chain::BlockNumber as RelayBlockNumber, DmpMessageHandler, ParaId,
};
use frame_support::dispatch::Weight;
use frame_support::weights::Weight;
pub use pallet::*;
use scale_info::TypeInfo;
use sp_runtime::{traits::BadOrigin, RuntimeDebug};
@@ -13,19 +13,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use frame_support::{
pallet_prelude::DispatchError,
traits::{
fungibles::{Balanced, Create, HandleImbalanceDrop, Inspect, Mutate, Unbalanced},
tokens::{
DepositConsequence, Fortitude, Precision, Preservation, Provenance, WithdrawConsequence,
},
AccountTouch, Contains, ContainsPair, Get, PalletInfoAccess,
use frame_support::traits::{
fungibles::{Balanced, Create, HandleImbalanceDrop, Inspect, Mutate, Unbalanced},
tokens::{
DepositConsequence, Fortitude, Precision, Preservation, Provenance, WithdrawConsequence,
},
AccountTouch, Contains, ContainsPair, Get, PalletInfoAccess,
};
use pallet_asset_conversion::{MultiAssetIdConversionResult, MultiAssetIdConverter};
use parachains_common::AccountId;
use sp_runtime::{traits::MaybeEquivalence, DispatchResult};
use sp_runtime::{traits::MaybeEquivalence, DispatchError, DispatchResult};
use sp_std::{boxed::Box, marker::PhantomData};
use xcm::latest::MultiLocation;
@@ -15,13 +15,14 @@
use crate::OriginCaller;
use frame_support::{
dispatch::{DispatchError, DispatchResultWithPostInfo},
dispatch::DispatchResultWithPostInfo,
traits::{Currency, Get, Imbalance, OnUnbalanced, OriginTrait, PrivilegeCmp},
weights::Weight,
};
use log;
use pallet_alliance::{ProposalIndex, ProposalProvider};
use parachains_common::impls::NegativeImbalance;
use sp_runtime::DispatchError;
use sp_std::{cmp::Ordering, marker::PhantomData, prelude::*};
use xcm::latest::{Fungibility, Junction, Parent};
@@ -22,9 +22,9 @@ use cumulus_primitives_core::{
use cumulus_primitives_parachain_inherent::ParachainInherentData;
use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;
use frame_support::{
dispatch::{DispatchResult, RawOrigin, UnfilteredDispatchable},
dispatch::{DispatchResult, RawOrigin},
inherent::{InherentData, ProvideInherent},
traits::{OnFinalize, OnInitialize, OriginTrait},
traits::{OnFinalize, OnInitialize, OriginTrait, UnfilteredDispatchable},
weights::Weight,
};
use frame_system::pallet_prelude::{BlockNumberFor, HeaderFor};
+1 -1
View File
@@ -315,11 +315,11 @@ mod tests {
use cumulus_primitives_core::UpwardMessage;
use frame_support::{
assert_ok,
dispatch::DispatchError,
traits::tokens::{
DepositConsequence, Fortitude, Preservation, Provenance, WithdrawConsequence,
},
};
use sp_runtime::DispatchError;
use xcm_executor::{traits::Error, Assets};
/// Validates [`validate`] for required Some(destination) and Some(message)
+1 -2
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
pub use codec::{Decode, Encode};
pub use codec::{Decode, Encode, EncodeLike};
pub use lazy_static::lazy_static;
pub use log;
pub use paste;
@@ -32,7 +32,6 @@ pub use std::{
// Substrate
pub use frame_support::{
assert_ok,
dispatch::EncodeLike,
sp_runtime::{AccountId32, DispatchResult},
traits::{
tokens::currency::Currency, EnqueueMessage, Get, Hooks, OriginTrait, ProcessMessage,
@@ -15,10 +15,7 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use super::{Config, MaxPermanentSlots, MaxTemporarySlots, Pallet, LOG_TARGET};
use frame_support::{
dispatch::GetStorageVersion,
traits::{Get, OnRuntimeUpgrade},
};
use frame_support::traits::{Get, GetStorageVersion, OnRuntimeUpgrade};
#[cfg(feature = "try-runtime")]
use frame_support::ensure;
+2 -3
View File
@@ -677,9 +677,7 @@ mod tests {
use crate::{auctions, mock::TestRegistrar};
use ::test_helpers::{dummy_hash, dummy_head_data, dummy_validation_code};
use frame_support::{
assert_noop, assert_ok, assert_storage_noop,
dispatch::DispatchError::BadOrigin,
ord_parameter_types, parameter_types,
assert_noop, assert_ok, assert_storage_noop, ord_parameter_types, parameter_types,
traits::{ConstU32, EitherOfDiverse, OnFinalize, OnInitialize},
};
use frame_system::{EnsureRoot, EnsureSignedBy};
@@ -689,6 +687,7 @@ mod tests {
use sp_runtime::{
traits::{BlakeTwo256, IdentityLookup},
BuildStorage,
DispatchError::BadOrigin,
};
use std::{cell::RefCell, collections::BTreeMap};
+5 -3
View File
@@ -711,7 +711,7 @@ mod tests {
use claims::Call as ClaimsCall;
use frame_support::{
assert_err, assert_noop, assert_ok,
dispatch::{DispatchError::BadOrigin, GetDispatchInfo, Pays},
dispatch::{GetDispatchInfo, Pays},
ord_parameter_types, parameter_types,
traits::{ConstU32, ExistenceRequirement, WithdrawReasons},
};
@@ -719,7 +719,9 @@ mod tests {
use sp_runtime::{
traits::{BlakeTwo256, Identity, IdentityLookup},
transaction_validity::TransactionLongevity,
BuildStorage, TokenError,
BuildStorage,
DispatchError::BadOrigin,
TokenError,
};
type Block = frame_system::mocking::MockBlock<Test>;
@@ -1470,7 +1472,7 @@ mod benchmarking {
use super::*;
use crate::claims::Call;
use frame_benchmarking::{account, benchmarks};
use frame_support::dispatch::UnfilteredDispatchable;
use frame_support::traits::UnfilteredDispatchable;
use frame_system::RawOrigin;
use secp_utils::*;
use sp_runtime::{traits::ValidateUnsigned, DispatchResult};
@@ -16,9 +16,8 @@
use super::*;
use frame_support::{
dispatch::GetStorageVersion,
storage_alias,
traits::{OnRuntimeUpgrade, StorageVersion},
traits::{GetStorageVersion, OnRuntimeUpgrade, StorageVersion},
Twox64Concat,
};
+2 -5
View File
@@ -17,16 +17,13 @@
//! Mocking utilities for testing.
use crate::traits::Registrar;
use frame_support::{
dispatch::{DispatchError, DispatchResult},
weights::Weight,
};
use frame_support::{dispatch::DispatchResult, weights::Weight};
use frame_system::pallet_prelude::BlockNumberFor;
use parity_scale_codec::{Decode, Encode};
use primitives::{HeadData, Id as ParaId, PvfCheckStatement, SessionIndex, ValidationCode};
use runtime_parachains::paras;
use sp_keyring::Sr25519Keyring;
use sp_runtime::{traits::SaturatedConversion, Permill};
use sp_runtime::{traits::SaturatedConversion, DispatchError, Permill};
use std::{cell::RefCell, collections::HashMap};
thread_local! {
+4 -4
View File
@@ -484,14 +484,14 @@ mod tests {
// or public keys. `u64` is used as the `AccountId` and no `Signature`s are required.
use crate::purchase;
use frame_support::{
assert_noop, assert_ok,
dispatch::DispatchError::BadOrigin,
ord_parameter_types, parameter_types,
assert_noop, assert_ok, ord_parameter_types, parameter_types,
traits::{Currency, WithdrawReasons},
};
use sp_runtime::{
traits::{BlakeTwo256, Dispatchable, IdentifyAccount, Identity, IdentityLookup, Verify},
ArithmeticError, BuildStorage, MultiSignature,
ArithmeticError, BuildStorage,
DispatchError::BadOrigin,
MultiSignature,
};
type Block = frame_system::mocking::MockBlock<Test>;
@@ -24,10 +24,8 @@ mod mock;
#[frame_support::pallet]
pub mod pallet {
use frame_benchmarking::BenchmarkError;
use frame_support::{
dispatch::{Dispatchable, GetDispatchInfo},
pallet_prelude::Encode,
};
use frame_support::{dispatch::GetDispatchInfo, pallet_prelude::Encode};
use sp_runtime::traits::Dispatchable;
use xcm::latest::{
InteriorMultiLocation, Junction, MultiAsset, MultiAssets, MultiLocation, NetworkId,
Response,
+5 -6
View File
@@ -34,7 +34,8 @@ use frame_support::traits::{
use scale_info::TypeInfo;
use sp_runtime::{
traits::{
AccountIdConversion, BadOrigin, BlakeTwo256, BlockNumberProvider, Hash, Saturating, Zero,
AccountIdConversion, BadOrigin, BlakeTwo256, BlockNumberProvider, Dispatchable, Hash,
Saturating, Zero,
},
RuntimeDebug,
};
@@ -43,10 +44,7 @@ use xcm::{latest::QueryResponseInfo, prelude::*};
use xcm_executor::traits::{ConvertOrigin, Properties};
use frame_support::{
dispatch::{Dispatchable, GetDispatchInfo},
pallet_prelude::*,
traits::WithdrawReasons,
PalletId,
dispatch::GetDispatchInfo, pallet_prelude::*, traits::WithdrawReasons, PalletId,
};
use frame_system::pallet_prelude::*;
pub use pallet::*;
@@ -149,11 +147,12 @@ impl WeightInfo for TestWeightInfo {
pub mod pallet {
use super::*;
use frame_support::{
dispatch::{Dispatchable, GetDispatchInfo, PostDispatchInfo},
dispatch::{GetDispatchInfo, PostDispatchInfo},
parameter_types,
};
use frame_system::Config as SysConfig;
use sp_core::H256;
use sp_runtime::traits::Dispatchable;
use xcm_executor::traits::{MatchesFungible, WeightBounds};
parameter_types! {
+2 -3
View File
@@ -28,11 +28,10 @@ pub use crate::{
use frame_support::traits::{ContainsPair, Everything};
pub use frame_support::{
dispatch::{
DispatchError, DispatchInfo, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
Parameter, PostDispatchInfo,
DispatchInfo, DispatchResultWithPostInfo, GetDispatchInfo, Parameter, PostDispatchInfo,
},
ensure, match_types, parameter_types,
sp_runtime::DispatchErrorWithPostInfo,
sp_runtime::{traits::Dispatchable, DispatchError, DispatchErrorWithPostInfo},
traits::{ConstU32, Contains, Get, IsInVec},
};
pub use parity_scale_codec::{Decode, Encode};
+2 -1
View File
@@ -20,9 +20,10 @@ use crate::traits::{
WeightTrader,
};
use frame_support::{
dispatch::{Dispatchable, GetDispatchInfo, Parameter, PostDispatchInfo},
dispatch::{GetDispatchInfo, Parameter, PostDispatchInfo},
traits::{Contains, ContainsPair, Get, PalletsInfoAccess},
};
use sp_runtime::traits::Dispatchable;
use xcm::prelude::*;
/// The trait to parameterize the `XcmExecutor`.
@@ -16,12 +16,10 @@
use crate::Xcm;
use core::result;
use frame_support::{
dispatch::fmt::Debug,
pallet_prelude::{Get, TypeInfo},
};
use frame_support::pallet_prelude::{Get, TypeInfo};
use parity_scale_codec::{FullCodec, MaxEncodedLen};
use sp_arithmetic::traits::Zero;
use sp_std::fmt::Debug;
use xcm::latest::{
Error as XcmError, InteriorMultiLocation, MultiLocation, QueryId, Response,
Result as XcmResult, Weight, XcmContext,
+3 -6
View File
@@ -98,16 +98,13 @@ use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::pallet_prelude::*;
use frame_system::pallet_prelude::*;
use sp_runtime::{
traits::{Saturating, StaticLookup, Zero},
RuntimeDebug,
traits::{Dispatchable, Saturating, StaticLookup, Zero},
DispatchError, RuntimeDebug,
};
use sp_std::{convert::TryInto, prelude::*};
use frame_support::{
dispatch::{
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
PostDispatchInfo,
},
dispatch::{DispatchResult, DispatchResultWithPostInfo, GetDispatchInfo, PostDispatchInfo},
ensure,
traits::{
ChangeMembers, Currency, Get, InitializeMembers, IsSubType, OnUnbalanced,
+1 -4
View File
@@ -23,10 +23,7 @@ use super::*;
use frame_benchmarking::v1::{
account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, BenchmarkError,
};
use frame_support::{
dispatch::UnfilteredDispatchable,
traits::{EnsureOrigin, Get},
};
use frame_support::traits::{EnsureOrigin, Get, UnfilteredDispatchable};
use frame_system::RawOrigin as SystemOrigin;
use sp_runtime::traits::Bounded;
use sp_std::prelude::*;
+2 -2
View File
@@ -160,12 +160,12 @@ pub use types::*;
use scale_info::TypeInfo;
use sp_runtime::{
traits::{AtLeast32BitUnsigned, CheckedAdd, CheckedSub, Saturating, StaticLookup, Zero},
ArithmeticError, TokenError,
ArithmeticError, DispatchError, TokenError,
};
use sp_std::prelude::*;
use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
ensure,
pallet_prelude::DispatchResultWithPostInfo,
storage::KeyPrefixIterator,
+2 -6
View File
@@ -17,16 +17,12 @@
//! Interfaces, types and utils for benchmarking a FRAME runtime.
use codec::{Decode, Encode};
use frame_support::{
dispatch::{DispatchError, DispatchErrorWithPostInfo},
pallet_prelude::*,
traits::StorageInfo,
};
use frame_support::{dispatch::DispatchErrorWithPostInfo, pallet_prelude::*, traits::StorageInfo};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_io::hashing::blake2_256;
use sp_runtime::traits::TrailingZeroInput;
use sp_runtime::{traits::TrailingZeroInput, DispatchError};
use sp_std::{prelude::Box, vec::Vec};
use sp_storage::TrackedStorageKey;
+5 -3
View File
@@ -45,13 +45,15 @@
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_io::storage;
use sp_runtime::{traits::Hash, RuntimeDebug};
use sp_runtime::{
traits::{Dispatchable, Hash},
DispatchError, RuntimeDebug,
};
use sp_std::{marker::PhantomData, prelude::*, result};
use frame_support::{
dispatch::{
DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable, GetDispatchInfo,
Pays, PostDispatchInfo,
DispatchResult, DispatchResultWithPostInfo, GetDispatchInfo, Pays, PostDispatchInfo,
},
ensure, impl_ensure_origin_with_arg_ignoring_arg,
traits::{
+6 -5
View File
@@ -25,9 +25,7 @@ use crate::{
};
use frame_support::{
crypto::ecdsa::ECDSAExt,
dispatch::{
fmt::Debug, DispatchError, DispatchResult, DispatchResultWithPostInfo, Dispatchable,
},
dispatch::{DispatchResult, DispatchResultWithPostInfo},
ensure,
storage::{with_transaction, TransactionOutcome},
traits::{
@@ -47,8 +45,11 @@ use sp_core::{
Get,
};
use sp_io::{crypto::secp256k1_ecdsa_recover_compressed, hashing::blake2_256};
use sp_runtime::traits::{Convert, Hash, Zero};
use sp_std::{marker::PhantomData, mem, prelude::*, vec::Vec};
use sp_runtime::{
traits::{Convert, Dispatchable, Hash, Zero},
DispatchError,
};
use sp_std::{fmt::Debug, marker::PhantomData, mem, prelude::*, vec::Vec};
pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
pub type MomentOf<T> = <<T as Config>::Time as Time>::Moment;
+2 -4
View File
@@ -17,14 +17,12 @@
use crate::{exec::ExecError, Config, Error};
use frame_support::{
dispatch::{
DispatchError, DispatchErrorWithPostInfo, DispatchResultWithPostInfo, PostDispatchInfo,
},
dispatch::{DispatchErrorWithPostInfo, DispatchResultWithPostInfo, PostDispatchInfo},
weights::Weight,
DefaultNoBound,
};
use sp_core::Get;
use sp_runtime::traits::Zero;
use sp_runtime::{traits::Zero, DispatchError};
use sp_std::marker::PhantomData;
#[cfg(test)]
+3 -6
View File
@@ -111,10 +111,7 @@ use crate::{
use codec::{Codec, Decode, Encode, HasCompact, MaxEncodedLen};
use environmental::*;
use frame_support::{
dispatch::{
DispatchError, Dispatchable, GetDispatchInfo, Pays, PostDispatchInfo, RawOrigin,
WithPostDispatchInfo,
},
dispatch::{GetDispatchInfo, Pays, PostDispatchInfo, RawOrigin, WithPostDispatchInfo},
ensure,
error::BadOrigin,
traits::{
@@ -137,8 +134,8 @@ use pallet_contracts_primitives::{
use scale_info::TypeInfo;
use smallvec::Array;
use sp_runtime::{
traits::{Convert, Hash, Saturating, StaticLookup, Zero},
RuntimeDebug,
traits::{Convert, Dispatchable, Hash, Saturating, StaticLookup, Zero},
DispatchError, RuntimeDebug,
};
use sp_std::{fmt::Debug, prelude::*};
@@ -28,7 +28,7 @@ use crate::{
AccountIdOf, BalanceOf, CodeHash, Config, HoldReason, Pallet, TrieId, Weight, LOG_TARGET,
};
#[cfg(feature = "try-runtime")]
use frame_support::{dispatch::Vec, traits::fungible::InspectHold};
use frame_support::traits::fungible::InspectHold;
use frame_support::{
pallet_prelude::*,
storage_alias,
@@ -43,6 +43,8 @@ use sp_core::hexdisplay::HexDisplay;
#[cfg(feature = "try-runtime")]
use sp_runtime::TryRuntimeError;
use sp_runtime::{traits::Zero, Saturating};
#[cfg(feature = "try-runtime")]
use sp_std::vec::Vec;
mod old {
use super::*;
+1 -2
View File
@@ -27,7 +27,6 @@ use crate::{
};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::DispatchError,
storage::child::{self, ChildInfo},
weights::Weight,
CloneNoBound, DefaultNoBound,
@@ -37,7 +36,7 @@ use sp_core::Get;
use sp_io::KillStorageResult;
use sp_runtime::{
traits::{Hash, Saturating, Zero},
BoundedBTreeMap, DispatchResult, RuntimeDebug,
BoundedBTreeMap, DispatchError, DispatchResult, RuntimeDebug,
};
use sp_std::{marker::PhantomData, prelude::*};
@@ -23,7 +23,6 @@ use crate::{
};
use frame_support::{
dispatch::{fmt::Debug, DispatchError},
ensure,
traits::{
fungible::{Mutate, MutateHold},
@@ -37,9 +36,9 @@ use frame_support::{
use sp_api::HashT;
use sp_runtime::{
traits::{Saturating, Zero},
FixedPointNumber, FixedU128,
DispatchError, FixedPointNumber, FixedU128,
};
use sp_std::{marker::PhantomData, vec, vec::Vec};
use sp_std::{fmt::Debug, marker::PhantomData, vec, vec::Vec};
/// Deposit that uses the native fungible's balance type.
pub type DepositOf<T> = Deposit<BalanceOf<T>>;
+2 -2
View File
@@ -42,7 +42,7 @@ use assert_matches::assert_matches;
use codec::Encode;
use frame_support::{
assert_err, assert_err_ignore_postinfo, assert_err_with_weight, assert_noop, assert_ok,
dispatch::{DispatchError, DispatchErrorWithPostInfo, PostDispatchInfo},
dispatch::{DispatchErrorWithPostInfo, PostDispatchInfo},
parameter_types,
storage::child,
traits::{
@@ -61,7 +61,7 @@ use sp_keystore::{testing::MemoryKeystore, KeystoreExt};
use sp_runtime::{
testing::H256,
traits::{BlakeTwo256, Convert, Hash, IdentityLookup},
AccountId32, BuildStorage, Perbill, TokenError,
AccountId32, BuildStorage, DispatchError, Perbill, TokenError,
};
type Block = frame_system::mocking::MockBlock<Test>;
+2 -2
View File
@@ -42,12 +42,12 @@ use crate::{
};
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
ensure,
traits::{fungible::MutateHold, tokens::Precision::BestEffort},
};
use sp_core::Get;
use sp_runtime::RuntimeDebug;
use sp_runtime::{DispatchError, RuntimeDebug};
use sp_std::prelude::*;
use wasmi::{Instance, Linker, Memory, MemoryType, StackLimits, Store};
@@ -26,13 +26,13 @@ use crate::{
use bitflags::bitflags;
use codec::{Decode, DecodeLimit, Encode, MaxEncodedLen};
use frame_support::{dispatch::DispatchError, ensure, traits::Get, weights::Weight};
use frame_support::{ensure, traits::Get, weights::Weight};
use pallet_contracts_primitives::{ExecReturnValue, ReturnFlags};
use pallet_contracts_proc_macro::define_env;
use sp_io::hashing::{blake2_128, blake2_256, keccak_256, sha2_256};
use sp_runtime::{
traits::{Bounded, Zero},
RuntimeDebug,
DispatchError, RuntimeDebug,
};
use sp_std::{fmt, prelude::*};
use wasmi::{core::HostError, errors::LinkerError, Linker, Memory, Store};
+10 -3
View File
@@ -28,7 +28,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
ensure,
traits::{
fungible, Currency, Get, LockIdentifier, LockableCurrency, PollStatus, Polling,
@@ -38,7 +38,7 @@ use frame_support::{
use frame_system::pallet_prelude::BlockNumberFor;
use sp_runtime::{
traits::{AtLeast32BitUnsigned, Saturating, StaticLookup, Zero},
ArithmeticError, Perbill,
ArithmeticError, DispatchError, Perbill,
};
use sp_std::prelude::*;
@@ -86,8 +86,15 @@ type ClassOf<T, I = ()> = <<T as Config<I>>::Polls as Polling<TallyOf<T, I>>>::C
#[frame_support::pallet]
pub mod pallet {
use super::*;
use frame_support::{pallet_prelude::*, traits::ClassCountOf};
use frame_support::{
pallet_prelude::{
DispatchResultWithPostInfo, IsType, StorageDoubleMap, StorageMap, ValueQuery,
},
traits::ClassCountOf,
Twox64Concat,
};
use frame_system::pallet_prelude::*;
use sp_runtime::BoundedVec;
#[pallet::pallet]
pub struct Pallet<T, I = ()>(_);
@@ -984,12 +984,12 @@ mod tests {
};
use codec::Decode;
use frame_election_provider_support::IndexAssignment;
use frame_support::{assert_noop, assert_ok, dispatch::Dispatchable, traits::OffchainWorker};
use frame_support::{assert_noop, assert_ok, traits::OffchainWorker};
use sp_npos_elections::ElectionScore;
use sp_runtime::{
bounded_vec,
offchain::storage_lock::{BlockAndTime, StorageLock},
traits::{ValidateUnsigned, Zero},
traits::{Dispatchable, ValidateUnsigned, Zero},
ModuleError, PerU16, Perbill,
};
@@ -18,7 +18,8 @@
#![allow(dead_code)]
use frame_support::{
assert_ok, dispatch::UnfilteredDispatchable, parameter_types, traits, traits::Hooks,
assert_ok, parameter_types, traits,
traits::{Hooks, UnfilteredDispatchable},
weights::constants,
};
use frame_system::EnsureRoot;
+2 -2
View File
@@ -56,7 +56,7 @@ pub mod weights;
use codec::{Decode, Encode};
use frame_support::{
dispatch::{DispatchResult, Dispatchable, GetDispatchInfo},
dispatch::{DispatchResult, GetDispatchInfo},
ensure,
pallet_prelude::MaxEncodedLen,
storage::bounded_vec::BoundedVec,
@@ -65,7 +65,7 @@ use frame_support::{
};
pub use pallet::*;
use sp_runtime::{
traits::{AccountIdConversion, Saturating, Zero},
traits::{AccountIdConversion, Dispatchable, Saturating, Zero},
ArithmeticError, DispatchError, RuntimeDebug,
};
use sp_std::prelude::*;
+1 -2
View File
@@ -19,8 +19,7 @@
use super::*;
use frame_support::{
dispatch::GetStorageVersion,
traits::{OnRuntimeUpgrade, WrapperKeepOpaque},
traits::{GetStorageVersion, OnRuntimeUpgrade, WrapperKeepOpaque},
Identity,
};
+1 -2
View File
@@ -14,10 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.1", default-features = false, features = ["derive"] }
frame-support = { path = "../../support", default-features = false}
pallet-nfts = { path = "..", default-features = false}
sp-api = { path = "../../../primitives/api", default-features = false}
[features]
default = [ "std" ]
std = [ "codec/std", "frame-support/std", "pallet-nfts/std", "sp-api/std" ]
std = [ "codec/std", "pallet-nfts/std", "sp-api/std" ]
+1 -1
View File
@@ -20,7 +20,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
use codec::{Decode, Encode};
use frame_support::dispatch::Vec;
use sp_api::vec::Vec;
sp_api::decl_runtime_apis! {
pub trait NftsApi<AccountId, CollectionId, ItemId>
+1 -2
View File
@@ -26,8 +26,7 @@ use frame_benchmarking::v1::{
};
use frame_support::{
assert_ok,
dispatch::UnfilteredDispatchable,
traits::{EnsureOrigin, Get},
traits::{EnsureOrigin, Get, UnfilteredDispatchable},
BoundedVec,
};
use frame_system::{pallet_prelude::BlockNumberFor, RawOrigin as SystemOrigin};
+4 -2
View File
@@ -21,7 +21,6 @@ use crate::{mock::*, Event, *};
use enumflags2::BitFlags;
use frame_support::{
assert_noop, assert_ok,
dispatch::Dispatchable,
traits::{
tokens::nonfungibles_v2::{Create, Destroy, Mutate},
Currency, Get,
@@ -29,7 +28,10 @@ use frame_support::{
};
use pallet_balances::Error as BalancesError;
use sp_core::{bounded::BoundedVec, Pair};
use sp_runtime::{traits::IdentifyAccount, MultiSignature, MultiSigner};
use sp_runtime::{
traits::{Dispatchable, IdentifyAccount},
MultiSignature, MultiSigner,
};
use sp_std::prelude::*;
type AccountIdOf<Test> = <Test as frame_system::Config>::AccountId;
+1 -2
View File
@@ -17,10 +17,9 @@
use super::{Config, Kind, OffenceDetails, Pallet, Perbill, SessionIndex, LOG_TARGET};
use frame_support::{
dispatch::GetStorageVersion,
pallet_prelude::ValueQuery,
storage_alias,
traits::{Get, OnRuntimeUpgrade},
traits::{Get, GetStorageVersion, OnRuntimeUpgrade},
weights::Weight,
Twox64Concat,
};
+2 -2
View File
@@ -35,7 +35,7 @@ pub mod weights;
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::{DispatchError, GetDispatchInfo},
dispatch::GetDispatchInfo,
ensure,
traits::{Currency, Get, InstanceFilter, IsSubType, IsType, OriginTrait, ReservableCurrency},
};
@@ -45,7 +45,7 @@ use scale_info::TypeInfo;
use sp_io::hashing::blake2_256;
use sp_runtime::{
traits::{Dispatchable, Hash, Saturating, StaticLookup, TrailingZeroInput, Zero},
DispatchResult, RuntimeDebug,
DispatchError, DispatchResult, RuntimeDebug,
};
use sp_std::prelude::*;
pub use weights::WeightInfo;
+1 -2
View File
@@ -25,11 +25,10 @@ use crate as proxy;
use codec::{Decode, Encode};
use frame_support::{
assert_noop, assert_ok, derive_impl,
dispatch::DispatchError,
traits::{ConstU32, ConstU64, Contains},
};
use sp_core::H256;
use sp_runtime::{traits::BlakeTwo256, BuildStorage, RuntimeDebug};
use sp_runtime::{traits::BlakeTwo256, BuildStorage, DispatchError, RuntimeDebug};
type Block = frame_system::mocking::MockBlock<Test>;
@@ -24,7 +24,7 @@ use crate::Pallet as RankedCollective;
use frame_benchmarking::v1::{
account, benchmarks_instance_pallet, whitelisted_caller, BenchmarkError,
};
use frame_support::{assert_ok, dispatch::UnfilteredDispatchable};
use frame_support::{assert_ok, traits::UnfilteredDispatchable};
use frame_system::RawOrigin as SystemOrigin;
const SEED: u32 = 0;
+2 -2
View File
@@ -47,12 +47,12 @@ use sp_arithmetic::traits::Saturating;
use sp_runtime::{
traits::{Convert, StaticLookup},
ArithmeticError::Overflow,
Perbill, RuntimeDebug,
DispatchError, Perbill, RuntimeDebug,
};
use sp_std::{marker::PhantomData, prelude::*};
use frame_support::{
dispatch::{DispatchError, DispatchResultWithPostInfo, PostDispatchInfo},
dispatch::{DispatchResultWithPostInfo, PostDispatchInfo},
ensure, impl_ensure_origin_with_arg_ignoring_arg,
traits::{EnsureOrigin, EnsureOriginWithArg, PollStatus, Polling, RankedMembers, VoteTally},
CloneNoBound, EqNoBound, PartialEqNoBound, RuntimeDebugNoBound,
@@ -25,8 +25,7 @@ use frame_benchmarking::v1::{
};
use frame_support::{
assert_ok,
dispatch::UnfilteredDispatchable,
traits::{Bounded, Currency, EnsureOrigin, EnsureOriginWithArg},
traits::{Bounded, Currency, EnsureOrigin, EnsureOriginWithArg, UnfilteredDispatchable},
};
use frame_system::RawOrigin;
use sp_runtime::traits::Bounded as ArithBounded;
+2 -5
View File
@@ -21,12 +21,9 @@ use super::*;
use crate::mock::{RefState::*, *};
use assert_matches::assert_matches;
use codec::Decode;
use frame_support::{
assert_noop, assert_ok,
dispatch::{DispatchError::BadOrigin, RawOrigin},
traits::Contains,
};
use frame_support::{assert_noop, assert_ok, dispatch::RawOrigin, traits::Contains};
use pallet_balances::Error as BalancesError;
use sp_runtime::DispatchError::BadOrigin;
#[test]
fn params_should_work() {
+2 -2
View File
@@ -22,8 +22,8 @@
use super::*;
use crate::mock::{RuntimeCall, *};
use frame_support::{assert_err, assert_noop, assert_ok, dispatch::Dispatchable, traits::Currency};
use sp_runtime::TransactionOutcome;
use frame_support::{assert_err, assert_noop, assert_ok, traits::Currency};
use sp_runtime::{traits::Dispatchable, TransactionOutcome};
/// Do something hypothetically by rolling back any changes afterwards.
///
+3 -5
View File
@@ -87,9 +87,7 @@ pub mod weights;
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::{
DispatchError, DispatchResult, Dispatchable, GetDispatchInfo, Parameter, RawOrigin,
},
dispatch::{DispatchResult, GetDispatchInfo, Parameter, RawOrigin},
ensure,
traits::{
schedule::{self, DispatchTime, MaybeHashed},
@@ -105,8 +103,8 @@ use frame_system::{
use scale_info::TypeInfo;
use sp_io::hashing::blake2_256;
use sp_runtime::{
traits::{BadOrigin, One, Saturating, Zero},
BoundedVec, RuntimeDebug,
traits::{BadOrigin, Dispatchable, One, Saturating, Zero},
BoundedVec, DispatchError, RuntimeDebug,
};
use sp_std::{borrow::Borrow, cmp::Ordering, marker::PhantomData, prelude::*};
+2 -2
View File
@@ -117,7 +117,7 @@ pub mod weights;
use codec::{Decode, MaxEncodedLen};
use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
ensure,
traits::{
EstimateNextNewSession, EstimateNextSessionRotation, FindAuthor, Get, OneSessionHandler,
@@ -129,7 +129,7 @@ use frame_support::{
use frame_system::pallet_prelude::BlockNumberFor;
use sp_runtime::{
traits::{AtLeast32BitUnsigned, Convert, Member, One, OpaqueKeys, Zero},
ConsensusEngineId, KeyTypeId, Permill, RuntimeAppPublic,
ConsensusEngineId, DispatchError, KeyTypeId, Permill, RuntimeAppPublic,
};
use sp_staking::SessionIndex;
use sp_std::{
+1 -2
View File
@@ -24,9 +24,8 @@ use testing_utils::*;
use codec::Decode;
use frame_election_provider_support::{bounds::DataProviderBounds, SortedListProvider};
use frame_support::{
dispatch::UnfilteredDispatchable,
pallet_prelude::*,
traits::{Currency, Get, Imbalance},
traits::{Currency, Get, Imbalance, UnfilteredDispatchable},
};
use sp_runtime::{
traits::{Bounded, One, StaticLookup, TrailingZeroInput, Zero},
+3 -2
View File
@@ -19,8 +19,9 @@
use super::*;
use frame_election_provider_support::SortedListProvider;
use frame_support::{
dispatch::GetStorageVersion, pallet_prelude::ValueQuery, storage_alias,
traits::OnRuntimeUpgrade,
pallet_prelude::ValueQuery,
storage_alias,
traits::{GetStorageVersion, OnRuntimeUpgrade},
};
#[cfg(feature = "try-runtime")]
+1 -1
View File
@@ -17,11 +17,11 @@
//! Staking FRAME Pallet.
use codec::Codec;
use frame_election_provider_support::{
ElectionProvider, ElectionProviderBase, SortedListProvider, VoteWeight,
};
use frame_support::{
dispatch::Codec,
pallet_prelude::*,
traits::{
Currency, Defensive, DefensiveResult, DefensiveSaturating, EnsureOrigin,
@@ -1268,7 +1268,6 @@ mod mock {
#[cfg(test)]
mod test {
use super::{mock::*, *};
use frame_support::dispatch::*;
use sp_runtime::{bounded_vec, traits::Bounded, StateVersion};
#[test]
@@ -124,16 +124,16 @@ pub fn expand_outer_dispatch(
}
}
impl #scrate::dispatch::GetCallMetadata for RuntimeCall {
fn get_call_metadata(&self) -> #scrate::dispatch::CallMetadata {
use #scrate::dispatch::GetCallName;
impl #scrate::traits::GetCallMetadata for RuntimeCall {
fn get_call_metadata(&self) -> #scrate::traits::CallMetadata {
use #scrate::traits::GetCallName;
match self {
#(
#pallet_attrs
#variant_patterns => {
let function_name = call.get_call_name();
let pallet_name = stringify!(#pallet_names);
#scrate::dispatch::CallMetadata { function_name, pallet_name }
#scrate::traits::CallMetadata { function_name, pallet_name }
}
)*
}
@@ -147,7 +147,7 @@ pub fn expand_outer_dispatch(
}
fn get_call_names(module: &str) -> &'static [&'static str] {
use #scrate::dispatch::{Callable, GetCallName};
use #scrate::{dispatch::Callable, traits::GetCallName};
match module {
#(
#pallet_attrs
@@ -159,7 +159,7 @@ pub fn expand_outer_dispatch(
}
}
}
impl #scrate::dispatch::Dispatchable for RuntimeCall {
impl #scrate::__private::Dispatchable for RuntimeCall {
type RuntimeOrigin = RuntimeOrigin;
type Config = RuntimeCall;
type Info = #scrate::dispatch::DispatchInfo;
@@ -351,7 +351,7 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
}
}
impl<#type_impl_gen> #frame_support::dispatch::GetCallName for #call_ident<#type_use_gen>
impl<#type_impl_gen> #frame_support::traits::GetCallName for #call_ident<#type_use_gen>
#where_clause
{
fn get_call_name(&self) -> &'static str {
@@ -366,7 +366,7 @@ pub fn expand_call(def: &mut Def) -> proc_macro2::TokenStream {
}
}
impl<#type_impl_gen> #frame_support::dispatch::GetCallIndex for #call_ident<#type_use_gen>
impl<#type_impl_gen> #frame_support::traits::GetCallIndex for #call_ident<#type_use_gen>
#where_clause
{
fn get_call_index(&self) -> u8 {
+6 -18
View File
@@ -18,30 +18,18 @@
//! Dispatch system. Contains a macro for defining runtime modules and
//! generating values representing lazy module function calls.
pub use crate::traits::{
CallMetadata, GetCallIndex, GetCallMetadata, GetCallName, GetStorageVersion,
UnfilteredDispatchable,
};
pub use codec::{
Codec, Decode, Encode, EncodeAsRef, EncodeLike, HasCompact, Input, MaxEncodedLen, Output,
};
pub use scale_info::TypeInfo;
pub use sp_runtime::{
traits::Dispatchable, transaction_validity::TransactionPriority, DispatchError, RuntimeDebug,
};
pub use sp_std::{
fmt, marker,
prelude::{Clone, Eq, PartialEq, Vec},
result,
};
pub use sp_weights::Weight;
use crate::traits::UnfilteredDispatchable;
use codec::{Codec, Decode, Encode, EncodeLike, MaxEncodedLen};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
use serde::{Deserialize, Serialize};
use sp_runtime::{
generic::{CheckedExtrinsic, UncheckedExtrinsic},
traits::SignedExtension,
DispatchError, RuntimeDebug,
};
use sp_std::fmt;
use sp_weights::Weight;
/// The return type of a `Dispatchable` in frame. When returned explicitly from
/// a dispatchable function it allows overriding the default `PostDispatchInfo`
@@ -26,11 +26,11 @@
//!
//! # FRAME integration
//!
//! The FRAME macros implement [`UnfilteredDispatchable`](crate::traits::UnfilteredDispatchable) for
//! each pallet `Call` enum. Part of this implementation is the call to [`run_in_context`], so that
//! each call to
//! The FRAME macros implement
//! [`UnfilteredDispatchable`](frame_support::traits::UnfilteredDispatchable) for each pallet `Call`
//! enum. Part of this implementation is the call to [`run_in_context`], so that each call to
//! [`UnfilteredDispatchable::dispatch_bypass_filter`](crate::traits::UnfilteredDispatchable::dispatch_bypass_filter)
//! or [`Dispatchable::dispatch`](crate::dispatch::Dispatchable::dispatch) will run in a dispatch
//! or [`Dispatchable::dispatch`](sp_runtime::traits::Dispatchable::dispatch) will run in a dispatch
//! context.
//!
//! # Example
+6 -8
View File
@@ -49,7 +49,7 @@ pub mod __private {
pub use sp_metadata_ir as metadata_ir;
#[cfg(feature = "std")]
pub use sp_runtime::{bounded_btree_map, bounded_vec};
pub use sp_runtime::{RuntimeDebug, StateVersion};
pub use sp_runtime::{traits::Dispatchable, RuntimeDebug, StateVersion};
#[cfg(feature = "std")]
pub use sp_state_machine::BasicExternalities;
pub use sp_std;
@@ -806,10 +806,7 @@ pub mod testing_prelude {
/// Prelude to be used alongside pallet macro, for ease of use.
pub mod pallet_prelude {
pub use crate::{
dispatch::{
DispatchClass, DispatchError, DispatchResult, DispatchResultWithPostInfo, Parameter,
Pays,
},
dispatch::{DispatchClass, DispatchResult, DispatchResultWithPostInfo, Parameter, Pays},
ensure,
inherent::{InherentData, InherentIdentifier, ProvideInherent},
storage,
@@ -855,7 +852,7 @@ pub mod pallet_prelude {
TransactionTag, TransactionValidity, TransactionValidityError, UnknownTransaction,
ValidTransaction,
},
RuntimeDebug, MAX_MODULE_ERROR_ENCODED_SIZE,
DispatchError, RuntimeDebug, MAX_MODULE_ERROR_ENCODED_SIZE,
};
pub use sp_std::marker::PhantomData;
pub use sp_weights::Weight;
@@ -1266,8 +1263,9 @@ pub mod pallet_prelude {
/// Field types in enum variants must also implement [`PalletError`](traits::PalletError),
/// otherwise the pallet will fail to compile. Rust primitive types have already implemented
/// the [`PalletError`](traits::PalletError) trait along with some commonly used stdlib types
/// such as [`Option`] and [`PhantomData`](`frame_support::dispatch::marker::PhantomData`), and
/// hence in most use cases, a manual implementation is not necessary and is discouraged.
/// such as [`Option`] and
/// [`PhantomData`](`frame_support::__private::sp_std::marker::PhantomData`), and hence in most
/// use cases, a manual implementation is not necessary and is discouraged.
///
/// The generic `T` must not bound anything and a `where` clause is not allowed. That said,
/// bounds and/or a where clause should not needed for any use-case.
@@ -21,11 +21,8 @@ use super::{
imbalance::{Imbalance, SignedImbalance},
misc::{Balance, ExistenceRequirement, WithdrawReasons},
};
use crate::{
dispatch::{DispatchError, DispatchResult},
traits::Get,
};
use sp_runtime::traits::MaybeSerializeDeserialize;
use crate::{dispatch::DispatchResult, traits::Get};
use sp_runtime::{traits::MaybeSerializeDeserialize, DispatchError};
mod reservable;
pub use reservable::{NamedReservableCurrency, ReservableCurrency};
@@ -22,9 +22,10 @@ use sp_core::Get;
use super::{super::misc::BalanceStatus, Currency};
use crate::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
traits::{ExistenceRequirement, SignedImbalance, WithdrawReasons},
};
use sp_runtime::DispatchError;
/// A currency where funds can be reserved from the user.
pub trait ReservableCurrency<AccountId>: Currency<AccountId> {
@@ -18,7 +18,6 @@
//! `Inspect` and `Mutate` traits for working with regular balances.
use crate::{
dispatch::DispatchError,
ensure,
traits::{
tokens::{
@@ -36,7 +35,7 @@ use crate::{
},
};
use sp_arithmetic::traits::{CheckedAdd, CheckedSub, One};
use sp_runtime::{traits::Saturating, ArithmeticError, TokenError};
use sp_runtime::{traits::Saturating, ArithmeticError, DispatchError, TokenError};
use sp_std::marker::PhantomData;
use super::{Credit, Debt, HandleImbalanceDrop, Imbalance};
@@ -20,7 +20,6 @@
use sp_std::marker::PhantomData;
use crate::{
dispatch::DispatchError,
ensure,
traits::{
tokens::{
@@ -38,7 +37,7 @@ use crate::{
},
};
use sp_arithmetic::traits::{CheckedAdd, CheckedSub, One};
use sp_runtime::{traits::Saturating, ArithmeticError, TokenError};
use sp_runtime::{traits::Saturating, ArithmeticError, DispatchError, TokenError};
use super::{Credit, Debt, HandleImbalanceDrop, Imbalance};
@@ -27,9 +27,9 @@
//! Implementations of these traits may be converted to implementations of corresponding
//! `nonfungible` traits by using the `nonfungible::ItemOf` type adapter.
use crate::dispatch::{DispatchError, DispatchResult};
use crate::dispatch::DispatchResult;
use codec::{Decode, Encode};
use sp_runtime::TokenError;
use sp_runtime::{DispatchError, TokenError};
use sp_std::prelude::*;
/// Trait for providing an interface to many read-only NFT-like sets of items.
@@ -27,9 +27,9 @@
//! Implementations of these traits may be converted to implementations of corresponding
//! `nonfungible` traits by using the `nonfungible::ItemOf` type adapter.
use crate::dispatch::{DispatchError, DispatchResult, Parameter};
use crate::dispatch::{DispatchResult, Parameter};
use codec::{Decode, Encode};
use sp_runtime::TokenError;
use sp_runtime::{DispatchError, TokenError};
use sp_std::prelude::*;
/// Trait for providing an interface to many read-only NFT-like sets of items.
+2 -2
View File
@@ -18,10 +18,10 @@
//! Traits and associated data structures concerned with voting, and moving between tokens and
//! votes.
use crate::dispatch::{DispatchError, Parameter};
use crate::dispatch::Parameter;
use codec::{HasCompact, MaxEncodedLen};
use sp_arithmetic::Perbill;
use sp_runtime::traits::Member;
use sp_runtime::{traits::Member, DispatchError};
use sp_std::prelude::*;
pub trait VoteTally<Votes, Class> {
@@ -578,14 +578,14 @@ fn call_weight_should_attach_to_call_enum() {
#[test]
fn call_name() {
use frame_support::dispatch::GetCallName;
use frame_support::traits::GetCallName;
let name = module3::Call::<Runtime>::aux_4 {}.get_call_name();
assert_eq!("aux_4", name);
}
#[test]
fn call_metadata() {
use frame_support::dispatch::{CallMetadata, GetCallMetadata};
use frame_support::traits::{CallMetadata, GetCallMetadata};
let call = RuntimeCall::Module3(module3::Call::<Runtime>::aux_4 {});
let metadata = call.get_call_metadata();
let expected = CallMetadata { function_name: "aux_4".into(), pallet_name: "Module3".into() };
@@ -594,14 +594,14 @@ fn call_metadata() {
#[test]
fn get_call_names() {
use frame_support::dispatch::GetCallName;
use frame_support::traits::GetCallName;
let call_names = module3::Call::<Runtime>::get_call_names();
assert_eq!(["fail", "aux_1", "aux_2", "aux_3", "aux_4", "operational"], call_names);
}
#[test]
fn get_module_names() {
use frame_support::dispatch::GetCallMetadata;
use frame_support::traits::GetCallMetadata;
let module_names = RuntimeCall::get_module_names();
assert_eq!(
[
+3 -5
View File
@@ -17,10 +17,7 @@
use frame_support::{
assert_ok,
dispatch::{
DispatchClass, DispatchInfo, Dispatchable, GetDispatchInfo, Parameter, Pays,
UnfilteredDispatchable,
},
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Parameter, Pays},
dispatch_context::with_context,
pallet_prelude::{StorageInfoTrait, ValueQuery},
parameter_types,
@@ -28,6 +25,7 @@ use frame_support::{
traits::{
ConstU32, GetCallIndex, GetCallName, GetStorageVersion, OnFinalize, OnGenesis,
OnInitialize, OnRuntimeUpgrade, PalletError, PalletInfoAccess, StorageVersion,
UnfilteredDispatchable,
},
weights::{RuntimeDbWeight, Weight},
};
@@ -37,7 +35,7 @@ use sp_io::{
TestExternalities,
};
use sp_runtime::{
traits::{Extrinsic as ExtrinsicT, SignaturePayload as SignaturePayloadT},
traits::{Dispatchable, Extrinsic as ExtrinsicT, SignaturePayload as SignaturePayloadT},
DispatchError, ModuleError,
};
@@ -16,11 +16,14 @@
// limitations under the License.
use frame_support::{
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays, UnfilteredDispatchable},
dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays},
pallet_prelude::ValueQuery,
parameter_types,
storage::unhashed,
traits::{ConstU32, GetCallName, OnFinalize, OnGenesis, OnInitialize, OnRuntimeUpgrade},
traits::{
ConstU32, GetCallName, OnFinalize, OnGenesis, OnInitialize, OnRuntimeUpgrade,
UnfilteredDispatchable,
},
weights::Weight,
};
use sp_io::{
@@ -30,10 +30,10 @@ mod tests;
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::{Dispatchable, GetDispatchInfo},
dispatch::GetDispatchInfo,
traits::{Currency, OnUnbalanced, ReservableCurrency},
};
use sp_runtime::traits::{BlakeTwo256, Hash, One, Saturating, Zero};
use sp_runtime::traits::{BlakeTwo256, Dispatchable, Hash, One, Saturating, Zero};
use sp_std::{prelude::*, result};
use sp_transaction_storage_proof::{
encode_index, random_chunk, InherentError, TransactionStorageProof, CHUNK_SIZE,
+1 -2
View File
@@ -23,9 +23,8 @@ use super::{Pallet as Treasury, *};
use frame_benchmarking::v1::{account, benchmarks_instance_pallet, BenchmarkError};
use frame_support::{
dispatch::UnfilteredDispatchable,
ensure,
traits::{EnsureOrigin, OnInitialize},
traits::{EnsureOrigin, OnInitialize, UnfilteredDispatchable},
};
use frame_system::RawOrigin;
+2 -1
View File
@@ -20,7 +20,8 @@
use super::*;
use crate::mock::{RuntimeCall, *};
use frame_support::{assert_err, assert_noop, assert_ok, dispatch::Dispatchable};
use frame_support::{assert_err, assert_noop, assert_ok};
use sp_runtime::DispatchError;
// GENERAL SUCCESS/POSITIVE TESTS ---------------------
+1 -2
View File
@@ -24,8 +24,7 @@ use frame_benchmarking::v1::{
account, benchmarks_instance_pallet, whitelist_account, whitelisted_caller, BenchmarkError,
};
use frame_support::{
dispatch::UnfilteredDispatchable,
traits::{EnsureOrigin, Get},
traits::{EnsureOrigin, Get, UnfilteredDispatchable},
BoundedVec,
};
use frame_system::RawOrigin as SystemOrigin;
+2 -1
View File
@@ -18,8 +18,9 @@
//! Tests for Uniques pallet.
use crate::{mock::*, Event, *};
use frame_support::{assert_noop, assert_ok, dispatch::Dispatchable, traits::Currency};
use frame_support::{assert_noop, assert_ok, traits::Currency};
use pallet_balances::Error as BalancesError;
use sp_runtime::traits::Dispatchable;
use sp_std::prelude::*;
fn items() -> Vec<(u64, u32, u32)> {
+3 -3
View File
@@ -24,7 +24,7 @@ use super::*;
use crate as utility;
use frame_support::{
assert_err_ignore_postinfo, assert_noop, assert_ok,
dispatch::{DispatchError, DispatchErrorWithPostInfo, Dispatchable, Pays},
dispatch::{DispatchErrorWithPostInfo, Pays},
error::BadOrigin,
parameter_types, storage,
traits::{ConstU32, ConstU64, Contains},
@@ -33,8 +33,8 @@ use frame_support::{
use pallet_collective::{EnsureProportionAtLeast, Instance1};
use sp_core::H256;
use sp_runtime::{
traits::{BlakeTwo256, Hash, IdentityLookup},
BuildStorage, TokenError,
traits::{BlakeTwo256, Dispatchable, Hash, IdentityLookup},
BuildStorage, DispatchError, TokenError,
};
type BlockNumber = u64;
+2 -2
View File
@@ -58,7 +58,7 @@ pub mod weights;
use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::{DispatchError, DispatchResult},
dispatch::DispatchResult,
ensure,
storage::bounded_vec::BoundedVec,
traits::{
@@ -74,7 +74,7 @@ use sp_runtime::{
AtLeast32BitUnsigned, Bounded, Convert, MaybeSerializeDeserialize, One, Saturating,
StaticLookup, Zero,
},
RuntimeDebug,
DispatchError, RuntimeDebug,
};
use sp_std::{fmt::Debug, marker::PhantomData, prelude::*};
+2 -1
View File
@@ -15,7 +15,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use frame_support::{assert_noop, assert_ok, assert_storage_noop, dispatch::EncodeLike};
use codec::EncodeLike;
use frame_support::{assert_noop, assert_ok, assert_storage_noop};
use frame_system::RawOrigin;
use sp_runtime::{
traits::{BadOrigin, Identity},