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
@@ -14,9 +14,9 @@ mod mock;
|
||||
mod tests;
|
||||
|
||||
/// Configure the pallet by specifying the parameters and types on which it depends.
|
||||
pub trait Trait: frame_system::Trait {
|
||||
pub trait Config: frame_system::Config {
|
||||
/// Because this pallet emits events, it depends on the runtime's definition of an event.
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Trait>::Event>;
|
||||
type Event: From<Event<Self>> + Into<<Self as frame_system::Config>::Event>;
|
||||
}
|
||||
|
||||
// The pallet's runtime storage items.
|
||||
@@ -25,7 +25,7 @@ decl_storage! {
|
||||
// A unique name is used to ensure that the pallet's storage items are isolated.
|
||||
// This name may be updated, but each pallet in the runtime must use a unique name.
|
||||
// ---------------------------------vvvvvvvvvvvvvv
|
||||
trait Store for Module<T: Trait> as TemplateModule {
|
||||
trait Store for Module<T: Config> as TemplateModule {
|
||||
// Learn more about declaring storage items:
|
||||
// https://substrate.dev/docs/en/knowledgebase/runtime/storage#declaring-storage-items
|
||||
Something get(fn something): Option<u32>;
|
||||
@@ -35,7 +35,7 @@ decl_storage! {
|
||||
// Pallets use events to inform users when important changes are made.
|
||||
// https://substrate.dev/docs/en/knowledgebase/runtime/events
|
||||
decl_event!(
|
||||
pub enum Event<T> where AccountId = <T as frame_system::Trait>::AccountId {
|
||||
pub enum Event<T> where AccountId = <T as frame_system::Config>::AccountId {
|
||||
/// Event documentation should end with an array that provides descriptive names for event
|
||||
/// parameters. [something, who]
|
||||
SomethingStored(u32, AccountId),
|
||||
@@ -44,7 +44,7 @@ decl_event!(
|
||||
|
||||
// Errors inform users that something went wrong.
|
||||
decl_error! {
|
||||
pub enum Error for Module<T: Trait> {
|
||||
pub enum Error for Module<T: Config> {
|
||||
/// Error names should be descriptive.
|
||||
NoneValue,
|
||||
/// Errors should have helpful documentation associated with them.
|
||||
@@ -56,7 +56,7 @@ decl_error! {
|
||||
// These functions materialize as "extrinsics", which are often compared to transactions.
|
||||
// Dispatchable functions must be annotated with a weight and must return a DispatchResult.
|
||||
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 {
|
||||
// Errors must be initialized if they are used by the pallet.
|
||||
type Error = Error<T>;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{Module, Trait};
|
||||
use crate::{Module, Config};
|
||||
use sp_core::H256;
|
||||
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
|
||||
use sp_runtime::{
|
||||
@@ -21,7 +21,7 @@ parameter_types! {
|
||||
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
|
||||
}
|
||||
|
||||
impl system::Trait for Test {
|
||||
impl system::Config for Test {
|
||||
type BaseCallFilter = ();
|
||||
type Origin = Origin;
|
||||
type Call = ();
|
||||
@@ -49,7 +49,7 @@ impl system::Trait for Test {
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
|
||||
impl Trait for Test {
|
||||
impl Config for Test {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ parameter_types! {
|
||||
|
||||
// Configure FRAME pallets to include in runtime.
|
||||
|
||||
impl frame_system::Trait for Runtime {
|
||||
impl frame_system::Config for Runtime {
|
||||
/// The basic call filter to use in dispatchable.
|
||||
type BaseCallFilter = ();
|
||||
/// The identifier used to distinguish between accounts.
|
||||
@@ -199,11 +199,11 @@ impl frame_system::Trait for Runtime {
|
||||
type SystemWeightInfo = ();
|
||||
}
|
||||
|
||||
impl pallet_aura::Trait for Runtime {
|
||||
impl pallet_aura::Config for Runtime {
|
||||
type AuthorityId = AuraId;
|
||||
}
|
||||
|
||||
impl pallet_grandpa::Trait for Runtime {
|
||||
impl pallet_grandpa::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
|
||||
@@ -226,7 +226,7 @@ parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||
}
|
||||
|
||||
impl pallet_timestamp::Trait for Runtime {
|
||||
impl pallet_timestamp::Config for Runtime {
|
||||
/// A timestamp: milliseconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = Aura;
|
||||
@@ -239,7 +239,7 @@ parameter_types! {
|
||||
pub const MaxLocks: u32 = 50;
|
||||
}
|
||||
|
||||
impl pallet_balances::Trait for Runtime {
|
||||
impl pallet_balances::Config for Runtime {
|
||||
type MaxLocks = MaxLocks;
|
||||
/// The type for recording an account's balance.
|
||||
type Balance = Balance;
|
||||
@@ -255,20 +255,20 @@ parameter_types! {
|
||||
pub const TransactionByteFee: Balance = 1;
|
||||
}
|
||||
|
||||
impl pallet_transaction_payment::Trait for Runtime {
|
||||
impl pallet_transaction_payment::Config for Runtime {
|
||||
type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
|
||||
type TransactionByteFee = TransactionByteFee;
|
||||
type WeightToFee = IdentityFee<Balance>;
|
||||
type FeeMultiplierUpdate = ();
|
||||
}
|
||||
|
||||
impl pallet_sudo::Trait for Runtime {
|
||||
impl pallet_sudo::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Call = Call;
|
||||
}
|
||||
|
||||
/// Configure the pallet template in pallets/template.
|
||||
impl template::Trait for Runtime {
|
||||
impl template::Config for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ impl_runtime_apis! {
|
||||
use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey};
|
||||
|
||||
use frame_system_benchmarking::Module as SystemBench;
|
||||
impl frame_system_benchmarking::Trait for Runtime {}
|
||||
impl frame_system_benchmarking::Config for Runtime {}
|
||||
|
||||
let whitelist: Vec<TrackedStorageKey> = vec![
|
||||
// Block Number
|
||||
|
||||
Reference in New Issue
Block a user