mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 12:17:58 +00:00
Adds derive_impl to relay-chain and parachain runtimes (#2476)
This commit is contained in:
@@ -206,6 +206,7 @@ pub mod pallet {
|
||||
/// Default implementations of [`DefaultConfig`], which can be used to implement [`Config`].
|
||||
pub mod config_preludes {
|
||||
use super::{inject_runtime_type, DefaultConfig};
|
||||
use frame_support::derive_impl;
|
||||
|
||||
/// Provides a viable default config that can be used with
|
||||
/// [`derive_impl`](`frame_support::derive_impl`) to derive a testing pallet config
|
||||
@@ -258,39 +259,98 @@ pub mod pallet {
|
||||
/// if you use `pallet-balances` or similar.
|
||||
/// * Make sure to overwrite [`DefaultConfig::Version`].
|
||||
/// * 2s block time, and a default 5mb block size is used.
|
||||
#[cfg(feature = "experimental")]
|
||||
pub struct SolochainDefaultConfig;
|
||||
|
||||
#[cfg(feature = "experimental")]
|
||||
#[frame_support::register_default_impl(SolochainDefaultConfig)]
|
||||
impl DefaultConfig for SolochainDefaultConfig {
|
||||
/// The default type for storing how many extrinsics an account has signed.
|
||||
type Nonce = u32;
|
||||
|
||||
/// The default type for hashing blocks and tries.
|
||||
type Hash = sp_core::hash::H256;
|
||||
|
||||
/// The default hashing algorithm used.
|
||||
type Hashing = sp_runtime::traits::BlakeTwo256;
|
||||
|
||||
/// The default identifier used to distinguish between accounts.
|
||||
type AccountId = sp_runtime::AccountId32;
|
||||
|
||||
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
|
||||
type Lookup = sp_runtime::traits::AccountIdLookup<Self::AccountId, ()>;
|
||||
|
||||
/// The maximum number of consumers allowed on a single account. Using 128 as default.
|
||||
type MaxConsumers = frame_support::traits::ConstU32<128>;
|
||||
|
||||
/// The default data to be stored in an account.
|
||||
type AccountData = crate::AccountInfo<Self::Nonce, ()>;
|
||||
|
||||
/// What to do if a new account is created.
|
||||
type OnNewAccount = ();
|
||||
|
||||
/// What to do if an account is fully reaped from the system.
|
||||
type OnKilledAccount = ();
|
||||
|
||||
/// Weight information for the extrinsics of this pallet.
|
||||
type SystemWeightInfo = ();
|
||||
|
||||
/// This is used as an identifier of the chain.
|
||||
type SS58Prefix = ();
|
||||
|
||||
/// Version of the runtime.
|
||||
type Version = ();
|
||||
|
||||
/// Block & extrinsics weights: base values and limits.
|
||||
type BlockWeights = ();
|
||||
|
||||
/// The maximum length of a block (in bytes).
|
||||
type BlockLength = ();
|
||||
|
||||
/// The weight of database operations that the runtime can invoke.
|
||||
type DbWeight = ();
|
||||
|
||||
/// The ubiquitous event type injected by `construct_runtime!`.
|
||||
#[inject_runtime_type]
|
||||
type RuntimeEvent = ();
|
||||
|
||||
/// The ubiquitous origin type injected by `construct_runtime!`.
|
||||
#[inject_runtime_type]
|
||||
type RuntimeOrigin = ();
|
||||
|
||||
/// The aggregated dispatch type available for extrinsics, injected by
|
||||
/// `construct_runtime!`.
|
||||
#[inject_runtime_type]
|
||||
type RuntimeCall = ();
|
||||
|
||||
/// Converts a module to the index of the module, injected by `construct_runtime!`.
|
||||
#[inject_runtime_type]
|
||||
type PalletInfo = ();
|
||||
|
||||
/// The basic call filter to use in dispatchable. Supports everything as the default.
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
|
||||
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
|
||||
/// Using 256 as default.
|
||||
type BlockHashCount = frame_support::traits::ConstU32<256>;
|
||||
|
||||
/// The set code logic, just the default since we're not a parachain.
|
||||
type OnSetCode = ();
|
||||
}
|
||||
|
||||
/// Default configurations of this pallet in a relay-chain environment.
|
||||
pub struct RelayChainDefaultConfig;
|
||||
|
||||
/// It currently uses the same configuration as `SolochainDefaultConfig`.
|
||||
#[derive_impl(SolochainDefaultConfig as DefaultConfig, no_aggregated_types)]
|
||||
#[frame_support::register_default_impl(RelayChainDefaultConfig)]
|
||||
impl DefaultConfig for RelayChainDefaultConfig {}
|
||||
|
||||
/// Default configurations of this pallet in a parachain environment.
|
||||
pub struct ParaChainDefaultConfig;
|
||||
|
||||
/// It currently uses the same configuration as `SolochainDefaultConfig`.
|
||||
#[derive_impl(SolochainDefaultConfig as DefaultConfig, no_aggregated_types)]
|
||||
#[frame_support::register_default_impl(ParaChainDefaultConfig)]
|
||||
impl DefaultConfig for ParaChainDefaultConfig {}
|
||||
}
|
||||
|
||||
/// System configuration trait. Implemented by runtime.
|
||||
|
||||
Reference in New Issue
Block a user