mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Rename pallet trait Trait to Config (#7599)
* rename Trait to Config * add test asserting using Trait is still valid. * fix ui tests
This commit is contained in:
committed by
GitHub
parent
dd3c84c362
commit
1cbfc9257f
@@ -16,7 +16,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use crate::{Trait, Module};
|
||||
use crate::{Config, Module};
|
||||
use sp_runtime::{
|
||||
traits::{SignedExtension, Zero},
|
||||
transaction_validity::TransactionValidityError,
|
||||
@@ -24,9 +24,9 @@ use sp_runtime::{
|
||||
|
||||
/// Genesis hash check to provide replay protection between different networks.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
|
||||
pub struct CheckGenesis<T: Trait + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
pub struct CheckGenesis<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckGenesis<T> {
|
||||
impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckGenesis<T> {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "CheckGenesis")
|
||||
@@ -38,16 +38,16 @@ impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckGenesis<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> CheckGenesis<T> {
|
||||
impl<T: Config + Send + Sync> CheckGenesis<T> {
|
||||
/// Creates new `SignedExtension` to check genesis hash.
|
||||
pub fn new() -> Self {
|
||||
Self(sp_std::marker::PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> SignedExtension for CheckGenesis<T> {
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckGenesis<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type Call = <T as Trait>::Call;
|
||||
type Call = <T as Config>::Call;
|
||||
type AdditionalSigned = T::Hash;
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckGenesis";
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use crate::{Trait, Module, BlockHash};
|
||||
use crate::{Config, Module, BlockHash};
|
||||
use frame_support::StorageMap;
|
||||
use sp_runtime::{
|
||||
generic::Era,
|
||||
@@ -28,16 +28,16 @@ use sp_runtime::{
|
||||
|
||||
/// Check for transaction mortality.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
|
||||
pub struct CheckMortality<T: Trait + Send + Sync>(Era, sp_std::marker::PhantomData<T>);
|
||||
pub struct CheckMortality<T: Config + Send + Sync>(Era, sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Trait + Send + Sync> CheckMortality<T> {
|
||||
impl<T: Config + Send + Sync> CheckMortality<T> {
|
||||
/// utility constructor. Used only in client/factory code.
|
||||
pub fn from(era: Era) -> Self {
|
||||
Self(era, sp_std::marker::PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckMortality<T> {
|
||||
impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckMortality<T> {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "CheckMortality({:?})", self.0)
|
||||
@@ -49,7 +49,7 @@ impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckMortality<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> SignedExtension for CheckMortality<T> {
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckMortality<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type Call = T::Call;
|
||||
type AdditionalSigned = T::Hash;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use codec::{Encode, Decode};
|
||||
use crate::Trait;
|
||||
use crate::Config;
|
||||
use frame_support::{
|
||||
weights::DispatchInfo,
|
||||
StorageMap,
|
||||
@@ -35,16 +35,16 @@ use sp_std::vec;
|
||||
/// Note that this does not set any priority by default. Make sure that AT LEAST one of the signed
|
||||
/// extension sets some kind of priority upon validating transactions.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
|
||||
pub struct CheckNonce<T: Trait>(#[codec(compact)] T::Index);
|
||||
pub struct CheckNonce<T: Config>(#[codec(compact)] T::Index);
|
||||
|
||||
impl<T: Trait> CheckNonce<T> {
|
||||
impl<T: Config> CheckNonce<T> {
|
||||
/// utility constructor. Used only in client/factory code.
|
||||
pub fn from(nonce: T::Index) -> Self {
|
||||
Self(nonce)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> sp_std::fmt::Debug for CheckNonce<T> {
|
||||
impl<T: Config> sp_std::fmt::Debug for CheckNonce<T> {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "CheckNonce({})", self.0)
|
||||
@@ -56,7 +56,7 @@ impl<T: Trait> sp_std::fmt::Debug for CheckNonce<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> SignedExtension for CheckNonce<T> where
|
||||
impl<T: Config> SignedExtension for CheckNonce<T> where
|
||||
T::Call: Dispatchable<Info=DispatchInfo>
|
||||
{
|
||||
type AccountId = T::AccountId;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{Trait, Module};
|
||||
use crate::{Config, Module};
|
||||
use codec::{Encode, Decode};
|
||||
use sp_runtime::{
|
||||
traits::SignedExtension,
|
||||
@@ -24,9 +24,9 @@ use sp_runtime::{
|
||||
|
||||
/// Ensure the runtime version registered in the transaction is the same as at present.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
|
||||
pub struct CheckSpecVersion<T: Trait + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
pub struct CheckSpecVersion<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckSpecVersion<T> {
|
||||
impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckSpecVersion<T> {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "CheckSpecVersion")
|
||||
@@ -38,16 +38,16 @@ impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckSpecVersion<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> CheckSpecVersion<T> {
|
||||
impl<T: Config + Send + Sync> CheckSpecVersion<T> {
|
||||
/// Create new `SignedExtension` to check runtime version.
|
||||
pub fn new() -> Self {
|
||||
Self(sp_std::marker::PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> SignedExtension for CheckSpecVersion<T> {
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckSpecVersion<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type Call = <T as Trait>::Call;
|
||||
type Call = <T as Config>::Call;
|
||||
type AdditionalSigned = u32;
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckSpecVersion";
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{Trait, Module};
|
||||
use crate::{Config, Module};
|
||||
use codec::{Encode, Decode};
|
||||
use sp_runtime::{
|
||||
traits::SignedExtension,
|
||||
@@ -24,9 +24,9 @@ use sp_runtime::{
|
||||
|
||||
/// Ensure the transaction version registered in the transaction is the same as at present.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq)]
|
||||
pub struct CheckTxVersion<T: Trait + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
pub struct CheckTxVersion<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckTxVersion<T> {
|
||||
impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckTxVersion<T> {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "CheckTxVersion")
|
||||
@@ -38,16 +38,16 @@ impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckTxVersion<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> CheckTxVersion<T> {
|
||||
impl<T: Config + Send + Sync> CheckTxVersion<T> {
|
||||
/// Create new `SignedExtension` to check transaction version.
|
||||
pub fn new() -> Self {
|
||||
Self(sp_std::marker::PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> SignedExtension for CheckTxVersion<T> {
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckTxVersion<T> {
|
||||
type AccountId = T::AccountId;
|
||||
type Call = <T as Trait>::Call;
|
||||
type Call = <T as Config>::Call;
|
||||
type AdditionalSigned = u32;
|
||||
type Pre = ();
|
||||
const IDENTIFIER: &'static str = "CheckTxVersion";
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{Trait, Module};
|
||||
use crate::{Config, Module};
|
||||
use codec::{Encode, Decode};
|
||||
use sp_runtime::{
|
||||
traits::{SignedExtension, DispatchInfoOf, Dispatchable, PostDispatchInfoOf, Printable},
|
||||
@@ -33,9 +33,9 @@ use frame_support::{
|
||||
|
||||
/// Block resource (weight) limit check.
|
||||
#[derive(Encode, Decode, Clone, Eq, PartialEq, Default)]
|
||||
pub struct CheckWeight<T: Trait + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
pub struct CheckWeight<T: Config + Send + Sync>(sp_std::marker::PhantomData<T>);
|
||||
|
||||
impl<T: Trait + Send + Sync> CheckWeight<T> where
|
||||
impl<T: Config + Send + Sync> CheckWeight<T> where
|
||||
T::Call: Dispatchable<Info=DispatchInfo, PostInfo=PostDispatchInfo>
|
||||
{
|
||||
/// Get the quota ratio of each dispatch class type. This indicates that all operational and mandatory
|
||||
@@ -213,7 +213,7 @@ impl<T: Trait + Send + Sync> CheckWeight<T> where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> SignedExtension for CheckWeight<T> where
|
||||
impl<T: Config + Send + Sync> SignedExtension for CheckWeight<T> where
|
||||
T::Call: Dispatchable<Info=DispatchInfo, PostInfo=PostDispatchInfo>
|
||||
{
|
||||
type AccountId = T::AccountId;
|
||||
@@ -294,7 +294,7 @@ impl<T: Trait + Send + Sync> SignedExtension for CheckWeight<T> where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait + Send + Sync> sp_std::fmt::Debug for CheckWeight<T> {
|
||||
impl<T: Config + Send + Sync> sp_std::fmt::Debug for CheckWeight<T> {
|
||||
#[cfg(feature = "std")]
|
||||
fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result {
|
||||
write!(f, "CheckWeight")
|
||||
@@ -316,11 +316,11 @@ mod tests {
|
||||
use frame_support::weights::{Weight, Pays};
|
||||
|
||||
fn normal_weight_limit() -> Weight {
|
||||
<Test as Trait>::AvailableBlockRatio::get() * <Test as Trait>::MaximumBlockWeight::get()
|
||||
<Test as Config>::AvailableBlockRatio::get() * <Test as Config>::MaximumBlockWeight::get()
|
||||
}
|
||||
|
||||
fn normal_length_limit() -> u32 {
|
||||
<Test as Trait>::AvailableBlockRatio::get() * <Test as Trait>::MaximumBlockLength::get()
|
||||
<Test as Config>::AvailableBlockRatio::get() * <Test as Config>::MaximumBlockLength::get()
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -341,7 +341,7 @@ mod tests {
|
||||
check(|max, len| {
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(max, len));
|
||||
assert_eq!(System::block_weight().total(), Weight::max_value());
|
||||
assert!(System::block_weight().total() > <Test as Trait>::MaximumBlockWeight::get());
|
||||
assert!(System::block_weight().total() > <Test as Config>::MaximumBlockWeight::get());
|
||||
});
|
||||
check(|max, len| {
|
||||
assert_ok!(CheckWeight::<Test>::do_validate(max, len));
|
||||
@@ -352,7 +352,7 @@ mod tests {
|
||||
fn normal_extrinsic_limited_by_maximum_extrinsic_weight() {
|
||||
new_test_ext().execute_with(|| {
|
||||
let max = DispatchInfo {
|
||||
weight: <Test as Trait>::MaximumExtrinsicWeight::get() + 1,
|
||||
weight: <Test as Config>::MaximumExtrinsicWeight::get() + 1,
|
||||
class: DispatchClass::Normal,
|
||||
..Default::default()
|
||||
};
|
||||
@@ -370,9 +370,9 @@ mod tests {
|
||||
new_test_ext().execute_with(|| {
|
||||
let operational_limit = CheckWeight::<Test>::get_dispatch_limit_ratio(
|
||||
DispatchClass::Operational
|
||||
) * <Test as Trait>::MaximumBlockWeight::get();
|
||||
let base_weight = <Test as Trait>::ExtrinsicBaseWeight::get();
|
||||
let block_base = <Test as Trait>::BlockExecutionWeight::get();
|
||||
) * <Test as Config>::MaximumBlockWeight::get();
|
||||
let base_weight = <Test as Config>::ExtrinsicBaseWeight::get();
|
||||
let block_base = <Test as Config>::BlockExecutionWeight::get();
|
||||
|
||||
let weight = operational_limit - base_weight - block_base;
|
||||
let okay = DispatchInfo {
|
||||
@@ -406,7 +406,7 @@ mod tests {
|
||||
new_test_ext().execute_with(|| {
|
||||
System::register_extra_weight_unchecked(Weight::max_value(), DispatchClass::Normal);
|
||||
assert_eq!(System::block_weight().total(), Weight::max_value());
|
||||
assert!(System::block_weight().total() > <Test as Trait>::MaximumBlockWeight::get());
|
||||
assert!(System::block_weight().total() > <Test as Config>::MaximumBlockWeight::get());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -426,8 +426,8 @@ mod tests {
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(&max_normal, len));
|
||||
assert_eq!(System::block_weight().total(), 768);
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(&rest_operational, len));
|
||||
assert_eq!(<Test as Trait>::MaximumBlockWeight::get(), 1024);
|
||||
assert_eq!(System::block_weight().total(), <Test as Trait>::MaximumBlockWeight::get());
|
||||
assert_eq!(<Test as Config>::MaximumBlockWeight::get(), 1024);
|
||||
assert_eq!(System::block_weight().total(), <Test as Config>::MaximumBlockWeight::get());
|
||||
// Checking single extrinsic should not take current block weight into account.
|
||||
assert_eq!(CheckWeight::<Test>::check_extrinsic_weight(&rest_operational), Ok(()));
|
||||
});
|
||||
@@ -446,8 +446,8 @@ mod tests {
|
||||
// Extra 15 here from block execution + base extrinsic weight
|
||||
assert_eq!(System::block_weight().total(), 266);
|
||||
assert_ok!(CheckWeight::<Test>::do_pre_dispatch(&max_normal, len));
|
||||
assert_eq!(<Test as Trait>::MaximumBlockWeight::get(), 1024);
|
||||
assert_eq!(System::block_weight().total(), <Test as Trait>::MaximumBlockWeight::get());
|
||||
assert_eq!(<Test as Config>::MaximumBlockWeight::get(), 1024);
|
||||
assert_eq!(System::block_weight().total(), <Test as Config>::MaximumBlockWeight::get());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -553,11 +553,11 @@ mod tests {
|
||||
let normal_limit = normal_weight_limit();
|
||||
let small = DispatchInfo { weight: 100, ..Default::default() };
|
||||
let medium = DispatchInfo {
|
||||
weight: normal_limit - <Test as Trait>::ExtrinsicBaseWeight::get(),
|
||||
weight: normal_limit - <Test as Config>::ExtrinsicBaseWeight::get(),
|
||||
..Default::default()
|
||||
};
|
||||
let big = DispatchInfo {
|
||||
weight: normal_limit - <Test as Trait>::ExtrinsicBaseWeight::get() + 1,
|
||||
weight: normal_limit - <Test as Config>::ExtrinsicBaseWeight::get() + 1,
|
||||
..Default::default()
|
||||
};
|
||||
let len = 0_usize;
|
||||
@@ -589,7 +589,7 @@ mod tests {
|
||||
|
||||
// We allow 75% for normal transaction, so we put 25% - extrinsic base weight
|
||||
BlockWeight::mutate(|current_weight| {
|
||||
current_weight.put(256 - <Test as Trait>::ExtrinsicBaseWeight::get(), DispatchClass::Normal)
|
||||
current_weight.put(256 - <Test as Config>::ExtrinsicBaseWeight::get(), DispatchClass::Normal)
|
||||
});
|
||||
|
||||
let pre = CheckWeight::<Test>(PhantomData).pre_dispatch(&1, CALL, &info, len).unwrap();
|
||||
@@ -623,7 +623,7 @@ mod tests {
|
||||
let pre = CheckWeight::<Test>(PhantomData).pre_dispatch(&1, CALL, &info, len).unwrap();
|
||||
assert_eq!(
|
||||
BlockWeight::get().total(),
|
||||
info.weight + 128 + <Test as Trait>::ExtrinsicBaseWeight::get(),
|
||||
info.weight + 128 + <Test as Config>::ExtrinsicBaseWeight::get(),
|
||||
);
|
||||
|
||||
assert!(
|
||||
@@ -632,7 +632,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(
|
||||
BlockWeight::get().total(),
|
||||
info.weight + 128 + <Test as Trait>::ExtrinsicBaseWeight::get(),
|
||||
info.weight + 128 + <Test as Config>::ExtrinsicBaseWeight::get(),
|
||||
);
|
||||
})
|
||||
}
|
||||
@@ -644,12 +644,12 @@ mod tests {
|
||||
let len = 0_usize;
|
||||
|
||||
// Initial weight from `BlockExecutionWeight`
|
||||
assert_eq!(System::block_weight().total(), <Test as Trait>::BlockExecutionWeight::get());
|
||||
assert_eq!(System::block_weight().total(), <Test as Config>::BlockExecutionWeight::get());
|
||||
let r = CheckWeight::<Test>(PhantomData).pre_dispatch(&1, CALL, &free, len);
|
||||
assert!(r.is_ok());
|
||||
assert_eq!(
|
||||
System::block_weight().total(),
|
||||
<Test as Trait>::ExtrinsicBaseWeight::get() + <Test as Trait>::BlockExecutionWeight::get()
|
||||
<Test as Config>::ExtrinsicBaseWeight::get() + <Test as Config>::BlockExecutionWeight::get()
|
||||
);
|
||||
})
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
//! The System module provides low-level access to core types and cross-cutting utilities.
|
||||
//! It acts as the base layer for other pallets to interact with the Substrate framework components.
|
||||
//!
|
||||
//! - [`system::Trait`](./trait.Trait.html)
|
||||
//! - [`system::Config`](./trait.Config.html)
|
||||
//!
|
||||
//! ## Overview
|
||||
//!
|
||||
@@ -74,10 +74,10 @@
|
||||
//! use frame_support::{decl_module, dispatch};
|
||||
//! use frame_system::{self as system, ensure_signed};
|
||||
//!
|
||||
//! pub trait Trait: system::Trait {}
|
||||
//! pub trait Config: system::Config {}
|
||||
//!
|
||||
//! decl_module! {
|
||||
//! pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
//! pub struct Module<T: Config> for enum Call where origin: T::Origin {
|
||||
//! #[weight = 0]
|
||||
//! pub fn system_module_example(origin) -> dispatch::DispatchResult {
|
||||
//! let _sender = ensure_signed(origin)?;
|
||||
@@ -160,7 +160,7 @@ pub fn extrinsics_data_root<H: Hash>(xts: Vec<Vec<u8>>) -> H::Output {
|
||||
H::ordered_trie_root(xts)
|
||||
}
|
||||
|
||||
pub trait Trait: 'static + Eq + Clone {
|
||||
pub trait Config: 'static + Eq + Clone {
|
||||
/// The basic call filter to use in Origin. All origins are built with this filter as base,
|
||||
/// except Root.
|
||||
type BaseCallFilter: Filter<Self::Call>;
|
||||
@@ -270,8 +270,8 @@ pub trait Trait: 'static + Eq + Clone {
|
||||
type SystemWeightInfo: WeightInfo;
|
||||
}
|
||||
|
||||
pub type DigestOf<T> = generic::Digest<<T as Trait>::Hash>;
|
||||
pub type DigestItemOf<T> = generic::DigestItem<<T as Trait>::Hash>;
|
||||
pub type DigestOf<T> = generic::Digest<<T as Config>::Hash>;
|
||||
pub type DigestItemOf<T> = generic::DigestItem<<T as Config>::Hash>;
|
||||
|
||||
pub type Key = Vec<u8>;
|
||||
pub type KeyValue = (Vec<u8>, Vec<u8>);
|
||||
@@ -329,7 +329,7 @@ impl<AccountId> From<Option<AccountId>> for RawOrigin<AccountId> {
|
||||
}
|
||||
|
||||
/// Exposed trait-generic origin type.
|
||||
pub type Origin<T> = RawOrigin<<T as Trait>::AccountId>;
|
||||
pub type Origin<T> = RawOrigin<<T as Config>::AccountId>;
|
||||
|
||||
// Create a Hash with 69 for each byte,
|
||||
// only used to build genesis config.
|
||||
@@ -390,7 +390,7 @@ impl From<sp_version::RuntimeVersion> for LastRuntimeUpgradeInfo {
|
||||
}
|
||||
|
||||
decl_storage! {
|
||||
trait Store for Module<T: Trait> as System {
|
||||
trait Store for Module<T: Config> as System {
|
||||
/// The full account information for a particular account ID.
|
||||
pub Account get(fn account):
|
||||
map hasher(blake2_128_concat) T::AccountId => AccountInfo<T::Index, T::AccountData>;
|
||||
@@ -478,7 +478,7 @@ decl_storage! {
|
||||
|
||||
decl_event!(
|
||||
/// Event for the System module.
|
||||
pub enum Event<T> where AccountId = <T as Trait>::AccountId {
|
||||
pub enum Event<T> where AccountId = <T as Config>::AccountId {
|
||||
/// An extrinsic completed successfully. \[info\]
|
||||
ExtrinsicSuccess(DispatchInfo),
|
||||
/// An extrinsic failed. \[error, info\]
|
||||
@@ -494,7 +494,7 @@ decl_event!(
|
||||
|
||||
decl_error! {
|
||||
/// Error for the System module
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// The name of specification does not match between the current runtime
|
||||
/// and the new runtime.
|
||||
InvalidSpecName,
|
||||
@@ -513,7 +513,7 @@ decl_error! {
|
||||
}
|
||||
|
||||
decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin, system=self {
|
||||
pub struct Module<T: Config> for enum Call where origin: T::Origin, system=self {
|
||||
type Error = Error<T>;
|
||||
|
||||
/// The maximum number of blocks to allow in mortal eras.
|
||||
@@ -897,7 +897,7 @@ pub enum RefStatus {
|
||||
Unreferenced,
|
||||
}
|
||||
|
||||
impl<T: Trait> Module<T> {
|
||||
impl<T: Config> Module<T> {
|
||||
/// Deposits an event into this block's event record.
|
||||
pub fn deposit_event(event: impl Into<T::Event>) {
|
||||
Self::deposit_event_indexed(&[], event.into());
|
||||
@@ -1252,7 +1252,7 @@ impl<T: Trait> Module<T> {
|
||||
|
||||
/// Event handler which calls on_created_account when it happens.
|
||||
pub struct CallOnCreatedAccount<T>(PhantomData<T>);
|
||||
impl<T: Trait> Happened<T::AccountId> for CallOnCreatedAccount<T> {
|
||||
impl<T: Config> Happened<T::AccountId> for CallOnCreatedAccount<T> {
|
||||
fn happened(who: &T::AccountId) {
|
||||
Module::<T>::on_created_account(who.clone());
|
||||
}
|
||||
@@ -1260,15 +1260,15 @@ impl<T: Trait> Happened<T::AccountId> for CallOnCreatedAccount<T> {
|
||||
|
||||
/// Event handler which calls kill_account when it happens.
|
||||
pub struct CallKillAccount<T>(PhantomData<T>);
|
||||
impl<T: Trait> Happened<T::AccountId> for CallKillAccount<T> {
|
||||
impl<T: Config> Happened<T::AccountId> for CallKillAccount<T> {
|
||||
fn happened(who: &T::AccountId) {
|
||||
Module::<T>::kill_account(who)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> BlockNumberProvider for Module<T>
|
||||
impl<T: Config> BlockNumberProvider for Module<T>
|
||||
{
|
||||
type BlockNumber = <T as Trait>::BlockNumber;
|
||||
type BlockNumber = <T as Config>::BlockNumber;
|
||||
|
||||
fn current_block_number() -> Self::BlockNumber {
|
||||
Module::<T>::block_number()
|
||||
@@ -1278,7 +1278,7 @@ impl<T: Trait> BlockNumberProvider for Module<T>
|
||||
// Implement StoredMap for a simple single-item, kill-account-on-remove system. This works fine for
|
||||
// storing a single item which is required to not be empty/default for the account to exist.
|
||||
// Anything more complex will need more sophisticated logic.
|
||||
impl<T: Trait> StoredMap<T::AccountId, T::AccountData> for Module<T> {
|
||||
impl<T: Config> StoredMap<T::AccountId, T::AccountData> for Module<T> {
|
||||
fn get(k: &T::AccountId) -> T::AccountData {
|
||||
Account::<T>::get(k).data
|
||||
}
|
||||
@@ -1345,7 +1345,7 @@ pub fn split_inner<T, R, S>(option: Option<T>, splitter: impl FnOnce(T) -> (R, S
|
||||
}
|
||||
|
||||
|
||||
impl<T: Trait> IsDeadAccount<T::AccountId> for Module<T> {
|
||||
impl<T: Config> IsDeadAccount<T::AccountId> for Module<T> {
|
||||
fn is_dead_account(who: &T::AccountId) -> bool {
|
||||
!Account::<T>::contains_key(who)
|
||||
}
|
||||
@@ -1358,7 +1358,7 @@ impl<T> Default for ChainContext<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Trait> Lookup for ChainContext<T> {
|
||||
impl<T: Config> Lookup for ChainContext<T> {
|
||||
type Source = <T::Lookup as StaticLookup>::Source;
|
||||
type Target = <T::Lookup as StaticLookup>::Target;
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ pub struct Call;
|
||||
|
||||
impl Dispatchable for Call {
|
||||
type Origin = Origin;
|
||||
type Trait = ();
|
||||
type Config = ();
|
||||
type Info = DispatchInfo;
|
||||
type PostInfo = PostDispatchInfo;
|
||||
fn dispatch(self, _origin: Self::Origin)
|
||||
@@ -80,7 +80,7 @@ impl Dispatchable for Call {
|
||||
}
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Call = Call;
|
||||
@@ -109,16 +109,16 @@ impl Trait for Test {
|
||||
}
|
||||
|
||||
pub type System = Module<Test>;
|
||||
pub type SysEvent = <Test as Trait>::Event;
|
||||
pub type SysEvent = <Test as Config>::Event;
|
||||
|
||||
pub const CALL: &<Test as Trait>::Call = &Call;
|
||||
pub const CALL: &<Test as Config>::Call = &Call;
|
||||
|
||||
/// Create new externalities for `System` module tests.
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
let mut ext: sp_io::TestExternalities = GenesisConfig::default().build_storage::<Test>().unwrap().into();
|
||||
// Add to each test the initial weight of a block
|
||||
ext.execute_with(|| System::register_extra_weight_unchecked(
|
||||
<Test as Trait>::BlockExecutionWeight::get(),
|
||||
<Test as Config>::BlockExecutionWeight::get(),
|
||||
DispatchClass::Mandatory
|
||||
));
|
||||
ext
|
||||
|
||||
@@ -447,7 +447,7 @@ pub trait AppCrypto<Public, Signature> {
|
||||
///
|
||||
// TODO [#5663] Could this be just `T::Signature as traits::Verify>::Signer`?
|
||||
// Seems that this may cause issues with bounds resolution.
|
||||
pub trait SigningTypes: crate::Trait {
|
||||
pub trait SigningTypes: crate::Config {
|
||||
/// A public key that is capable of identifing `AccountId`s.
|
||||
///
|
||||
/// Usually that's either a raw crypto public key (e.g. `sr25519::Public`) or
|
||||
|
||||
@@ -54,7 +54,7 @@ pub trait WeightInfo {
|
||||
|
||||
/// Weights for frame_system using the Substrate node and recommended hardware.
|
||||
pub struct SubstrateWeight<T>(PhantomData<T>);
|
||||
impl<T: crate::Trait> WeightInfo for SubstrateWeight<T> {
|
||||
impl<T: crate::Config> WeightInfo for SubstrateWeight<T> {
|
||||
fn remark(_b: u32, ) -> Weight {
|
||||
(1_973_000 as Weight)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user