Merge pull request #8 from OpenZeppelin/plain-cumulus-fmt

cargo fmt on plain-cumulus template
This commit is contained in:
Özgün Özerk
2023-11-15 17:43:47 +03:00
committed by GitHub
18 changed files with 1712 additions and 1697 deletions
+4 -2
View File
@@ -41,7 +41,8 @@ type AccountPublic = <Signature as Verify>::Signer;
/// Generate collator keys from seed. /// Generate collator keys from seed.
/// ///
/// This function's return type must always match the session keys of the chain in tuple format. /// This function's return type must always match the session keys of the chain
/// in tuple format.
pub fn get_collator_keys_from_seed(seed: &str) -> AuraId { pub fn get_collator_keys_from_seed(seed: &str) -> AuraId {
get_from_seed::<AuraId>(seed) get_from_seed::<AuraId>(seed)
} }
@@ -56,7 +57,8 @@ where
/// Generate the session keys from individual elements. /// Generate the session keys from individual elements.
/// ///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key). /// The input must be a tuple of individual keys (a single arg for now since we
/// have just one key).
pub fn template_session_keys(keys: AuraId) -> parachain_template_runtime::SessionKeys { pub fn template_session_keys(keys: AuraId) -> parachain_template_runtime::SessionKeys {
parachain_template_runtime::SessionKeys { aura: keys } parachain_template_runtime::SessionKeys { aura: keys }
} }
+4 -2
View File
@@ -37,7 +37,8 @@ pub enum Subcommand {
/// Try-runtime has migrated to a standalone /// Try-runtime has migrated to a standalone
/// [CLI](<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and /// [CLI](<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and
/// deprecation notice. It will be removed entirely some time after Janurary 2024. /// deprecation notice. It will be removed entirely some time after Janurary
/// 2024.
TryRuntime, TryRuntime,
} }
@@ -95,7 +96,8 @@ pub struct RelayChainCli {
} }
impl RelayChainCli { impl RelayChainCli {
/// Parse the relay chain CLI parameters using the para chain `Configuration`. /// Parse the relay chain CLI parameters using the para chain
/// `Configuration`.
pub fn new<'a>( pub fn new<'a>(
para_config: &sc_service::Configuration, para_config: &sc_service::Configuration,
relay_chain_args: impl Iterator<Item = &'a String>, relay_chain_args: impl Iterator<Item = &'a String>,
+3 -8
View File
@@ -39,8 +39,7 @@ impl SubstrateCli for Cli {
format!( format!(
"Parachain Collator Template\n\nThe command-line arguments provided first will be \ "Parachain Collator Template\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \ passed to the parachain node, while the arguments provided after -- will be passed \
to the relay chain node.\n\n\ to the relay chain node.\n\n{} <parachain-args> -- <relay-chain-args>",
{} <parachain-args> -- <relay-chain-args>",
Self::executable_name() Self::executable_name()
) )
} }
@@ -75,8 +74,7 @@ impl SubstrateCli for RelayChainCli {
format!( format!(
"Parachain Collator Template\n\nThe command-line arguments provided first will be \ "Parachain Collator Template\n\nThe command-line arguments provided first will be \
passed to the parachain node, while the arguments provided after -- will be passed \ passed to the parachain node, while the arguments provided after -- will be passed \
to the relay chain node.\n\n\ to the relay chain node.\n\n{} <parachain-args> -- <relay-chain-args>",
{} <parachain-args> -- <relay-chain-args>",
Self::executable_name() Self::executable_name()
) )
} }
@@ -300,10 +298,7 @@ impl CliConfiguration<Self> for RelayChainCli {
} }
fn base_path(&self) -> Result<Option<BasePath>> { fn base_path(&self) -> Result<Option<BasePath>> {
Ok(self Ok(self.shared_params().base_path()?.or_else(|| self.base_path.clone().map(Into::into)))
.shared_params()
.base_path()?
.or_else(|| self.base_path.clone().map(Into::into)))
} }
fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> { fn rpc_addr(&self, default_listen_port: u16) -> Result<Option<SocketAddr>> {
+1 -2
View File
@@ -8,9 +8,8 @@
use std::sync::Arc; use std::sync::Arc;
use parachain_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; use parachain_template_runtime::{opaque::Block, AccountId, Balance, Nonce};
use sc_client_api::AuxStore; use sc_client_api::AuxStore;
pub use sc_rpc::{DenyUnsafe}; pub use sc_rpc::DenyUnsafe;
use sc_transaction_pool_api::TransactionPool; use sc_transaction_pool_api::TransactionPool;
use sp_api::ProvideRuntimeApi; use sp_api::ProvideRuntimeApi;
use sp_block_builder::BlockBuilder; use sp_block_builder::BlockBuilder;
+19 -17
View File
@@ -1,15 +1,10 @@
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service. //! Service and ServiceFactory implementation. Specialized wrapper over
//! substrate service.
// std // std
use std::{sync::Arc, time::Duration}; use std::{sync::Arc, time::Duration};
use cumulus_client_cli::CollatorOptions; use cumulus_client_cli::CollatorOptions;
// Local Runtime Types
use parachain_template_runtime::{
opaque::{Block, Hash},
RuntimeApi,
};
// Cumulus Imports // Cumulus Imports
use cumulus_client_collator::service::CollatorService; use cumulus_client_collator::service::CollatorService;
use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport; use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport;
@@ -20,9 +15,13 @@ use cumulus_client_service::{
}; };
use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId}; use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId};
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface}; use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
// Substrate Imports // Substrate Imports
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE; use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
// Local Runtime Types
use parachain_template_runtime::{
opaque::{Block, Hash},
RuntimeApi,
};
use sc_client_api::Backend; use sc_client_api::Backend;
use sc_consensus::ImportQueue; use sc_consensus::ImportQueue;
use sc_executor::{ use sc_executor::{
@@ -61,8 +60,8 @@ type ParachainBlockImport = TParachainBlockImport<Block, Arc<ParachainClient>, P
/// Starts a `ServiceBuilder` for a full service. /// Starts a `ServiceBuilder` for a full service.
/// ///
/// Use this macro if you don't actually need the full service, but just the builder in order to /// Use this macro if you don't actually need the full service, but just the
/// be able to perform chain operations. /// builder in order to be able to perform chain operations.
pub fn new_partial( pub fn new_partial(
config: &Configuration, config: &Configuration,
) -> Result< ) -> Result<
@@ -146,9 +145,11 @@ pub fn new_partial(
}) })
} }
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`. /// Start a node with the given parachain `Configuration` and relay chain
/// `Configuration`.
/// ///
/// This is the actual implementation that is abstract over the executor and the runtime api. /// This is the actual implementation that is abstract over the executor and the
/// runtime api.
#[sc_tracing::logging::prefix_logs_with("Parachain")] #[sc_tracing::logging::prefix_logs_with("Parachain")]
async fn start_node_impl( async fn start_node_impl(
parachain_config: Configuration, parachain_config: Configuration,
@@ -252,9 +253,10 @@ async fn start_node_impl(
if let Some(hwbench) = hwbench { if let Some(hwbench) = hwbench {
sc_sysinfo::print_hwbench(&hwbench); sc_sysinfo::print_hwbench(&hwbench);
// Here you can check whether the hardware meets your chains' requirements. Putting a link // Here you can check whether the hardware meets your chains' requirements.
// in there and swapping out the requirements for your own are probably a good idea. The // Putting a link in there and swapping out the requirements for your
// requirements for a para-chain are dictated by its relay-chain. // own are probably a good idea. The requirements for a para-chain are
// dictated by its relay-chain.
if !SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && validator { if !SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && validator {
log::warn!( log::warn!(
"⚠️ The hardware does not meet the minimal requirements for role 'Authority'." "⚠️ The hardware does not meet the minimal requirements for role 'Authority'."
@@ -373,8 +375,8 @@ fn start_consensus(
self as basic_aura, Params as BasicAuraParams, self as basic_aura, Params as BasicAuraParams,
}; };
// NOTE: because we use Aura here explicitly, we can use `CollatorSybilResistance::Resistant` // NOTE: because we use Aura here explicitly, we can use
// when starting the network. // `CollatorSybilResistance::Resistant` when starting the network.
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
+4 -4
View File
@@ -1,12 +1,12 @@
//! Benchmarking setup for pallet-parachain-template //! Benchmarking setup for pallet-parachain-template
use super::*;
#[allow(unused)]
use crate::Pallet as Template;
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller};
use frame_system::RawOrigin; use frame_system::RawOrigin;
use super::*;
#[allow(unused)]
use crate::Pallet as Template;
benchmarks! { benchmarks! {
do_something { do_something {
let s in 0 .. 100; let s in 0 .. 100;
+14 -10
View File
@@ -19,10 +19,12 @@ pub mod pallet {
use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*}; use frame_support::{dispatch::DispatchResultWithPostInfo, pallet_prelude::*};
use frame_system::pallet_prelude::*; use frame_system::pallet_prelude::*;
/// Configure the pallet by specifying the parameters and types on which it depends. /// Configure the pallet by specifying the parameters and types on which it
/// depends.
#[pallet::config] #[pallet::config]
pub trait Config: frame_system::Config { pub trait Config: frame_system::Config {
/// Because this pallet emits events, it depends on the runtime's definition of an event. /// Because this pallet emits events, it depends on the runtime's
/// definition of an event.
type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>; type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
} }
@@ -42,8 +44,8 @@ pub mod pallet {
#[pallet::event] #[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)] #[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> { pub enum Event<T: Config> {
/// Event documentation should end with an array that provides descriptive names for event /// Event documentation should end with an array that provides
/// parameters. [something, who] /// descriptive names for event parameters. [something, who]
SomethingStored(u32, T::AccountId), SomethingStored(u32, T::AccountId),
} }
@@ -59,13 +61,15 @@ pub mod pallet {
#[pallet::hooks] #[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {} impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
// Dispatchable functions allows users to interact with the pallet and invoke state changes. // Dispatchable functions allows users to interact with the pallet and invoke
// These functions materialize as "extrinsics", which are often compared to transactions. // state changes. These functions materialize as "extrinsics", which are
// Dispatchable functions must be annotated with a weight and must return a DispatchResult. // often compared to transactions. Dispatchable functions must be annotated
// with a weight and must return a DispatchResult.
#[pallet::call] #[pallet::call]
impl<T: Config> Pallet<T> { impl<T: Config> Pallet<T> {
/// An example dispatchable that takes a singles value as a parameter, writes the value to /// An example dispatchable that takes a singles value as a parameter,
/// storage and emits an event. This function must be dispatched by a signed extrinsic. /// writes the value to storage and emits an event. This
/// function must be dispatched by a signed extrinsic.
#[pallet::call_index(0)] #[pallet::call_index(0)]
#[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))] #[pallet::weight(Weight::from_parts(10_000, 0) + T::DbWeight::get().writes(1))]
pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResultWithPostInfo { pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResultWithPostInfo {
@@ -99,7 +103,7 @@ pub mod pallet {
// Update the value in storage with the incremented result. // Update the value in storage with the incremented result.
<Something<T>>::put(new); <Something<T>>::put(new);
Ok(().into()) Ok(().into())
}, }
} }
} }
} }
+16 -16
View File
@@ -23,29 +23,29 @@ parameter_types! {
} }
impl system::Config for Test { impl system::Config for Test {
type AccountData = ();
type AccountId = u64;
type BaseCallFilter = Everything; type BaseCallFilter = Everything;
type BlockWeights = (); type Block = Block;
type BlockHashCount = BlockHashCount;
type BlockLength = (); type BlockLength = ();
type BlockWeights = ();
type DbWeight = (); type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Nonce = u64;
type Hash = H256; type Hash = H256;
type Hashing = BlakeTwo256; type Hashing = BlakeTwo256;
type AccountId = u64;
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Block = Block;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = SS58Prefix;
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>; type MaxConsumers = frame_support::traits::ConstU32<16>;
type Nonce = u64;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
type PalletInfo = PalletInfo;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type SS58Prefix = SS58Prefix;
type SystemWeightInfo = ();
type Version = ();
} }
impl crate::Config for Test { impl crate::Config for Test {
+2 -1
View File
@@ -1,6 +1,7 @@
use crate::{mock::*, Error};
use frame_support::{assert_noop, assert_ok}; use frame_support::{assert_noop, assert_ok};
use crate::{mock::*, Error};
#[test] #[test]
fn it_works_for_default_value() { fn it_works_for_default_value() {
new_test_ext().execute_with(|| { new_test_ext().execute_with(|| {
+141 -137
View File
@@ -11,22 +11,6 @@ pub mod xcm_config;
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases; use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
use cumulus_primitives_core::ParaId; use cumulus_primitives_core::ParaId;
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
use smallvec::smallvec;
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, MultiSignature,
};
use sp_std::prelude::*;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use frame_support::{ use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
@@ -43,31 +27,41 @@ use frame_system::{
limits::{BlockLength, BlockWeights}, limits::{BlockLength, BlockWeights},
EnsureRoot, EnsureRoot,
}; };
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{RelayLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
// Polkadot imports
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
// XCM Imports
use xcm::latest::prelude::BodyId;
use xcm_executor::XcmExecutor;
/// Import the template pallet. /// Import the template pallet.
pub use pallet_parachain_template; pub use pallet_parachain_template;
use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_common::xcm_sender::NoPriceForMessageDelivery;
// Polkadot imports
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use smallvec::smallvec;
use sp_api::impl_runtime_apis;
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify},
transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, MultiSignature,
};
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use sp_std::prelude::*;
#[cfg(feature = "std")]
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
// XCM Imports
use xcm::latest::prelude::BodyId;
use xcm_config::{RelayLocation, XcmConfig, XcmOriginToTransactDispatchOrigin};
use xcm_executor::XcmExecutor;
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain. /// Alias to 512-bit hash when used in the context of a transaction signature on
/// the chain.
pub type Signature = MultiSignature; pub type Signature = MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent /// Some way of identifying an account on the chain. We intentionally make it
/// to the public key of our transaction signing scheme. /// equivalent to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId; pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
/// Balance of an account. /// Balance of an account.
@@ -122,22 +116,25 @@ pub type Executive = frame_executive::Executive<
AllPalletsWithSystem, AllPalletsWithSystem,
>; >;
/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the /// Handles converting a weight scalar to a fee value, based on the scale and
/// node's balance type. /// granularity of the node's balance type.
/// ///
/// This should typically create a mapping between the following ranges: /// This should typically create a mapping between the following ranges:
/// - `[0, MAXIMUM_BLOCK_WEIGHT]` /// - `[0, MAXIMUM_BLOCK_WEIGHT]`
/// - `[Balance::min, Balance::max]` /// - `[Balance::min, Balance::max]`
/// ///
/// Yet, it can be used for any other sort of change to weight-fee. Some examples being: /// Yet, it can be used for any other sort of change to weight-fee. Some
/// examples being:
/// - Setting it to `0` will essentially disable the weight fee. /// - Setting it to `0` will essentially disable the weight fee.
/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged. /// - Setting it to `1` will cause the literal `#[weight = x]` values to be
/// charged.
pub struct WeightToFee; pub struct WeightToFee;
impl WeightToFeePolynomial for WeightToFee { impl WeightToFeePolynomial for WeightToFee {
type Balance = Balance; type Balance = Balance;
fn polynomial() -> WeightToFeeCoefficients<Self::Balance> { fn polynomial() -> WeightToFeeCoefficients<Self::Balance> {
// in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1 MILLIUNIT: // in Rococo, extrinsic base weight (smallest non-zero weight) is mapped to 1
// in our template, we map to 1/10 of that, or 1/10 MILLIUNIT // MILLIUNIT: in our template, we map to 1/10 of that, or 1/10 MILLIUNIT
let p = MILLIUNIT / 10; let p = MILLIUNIT / 10;
let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time()); let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
smallvec![WeightToFeeCoefficient { smallvec![WeightToFeeCoefficient {
@@ -149,18 +146,19 @@ impl WeightToFeePolynomial for WeightToFee {
} }
} }
/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know /// Opaque types. These are used by the CLI to instantiate machinery that don't
/// the specifics of the runtime. They can then be made to be agnostic over specific formats /// need to know the specifics of the runtime. They can then be made to be
/// of data like extrinsics, allowing for them to continue syncing the network through upgrades /// agnostic over specific formats of data like extrinsics, allowing for them to
/// to even the core data structures. /// continue syncing the network through upgrades to even the core data
/// structures.
pub mod opaque { pub mod opaque {
use super::*; pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic;
use sp_runtime::{ use sp_runtime::{
generic, generic,
traits::{BlakeTwo256, Hash as HashT}, traits::{BlakeTwo256, Hash as HashT},
}; };
pub use sp_runtime::OpaqueExtrinsic as UncheckedExtrinsic; use super::*;
/// Opaque block header type. /// Opaque block header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>; pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Opaque block type. /// Opaque block type.
@@ -197,8 +195,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
/// Change this to adjust the block time. /// Change this to adjust the block time.
pub const MILLISECS_PER_BLOCK: u64 = 12000; pub const MILLISECS_PER_BLOCK: u64 = 12000;
// NOTE: Currently it is not possible to change the slot duration after the chain has started. // NOTE: Currently it is not possible to change the slot duration after the
// Attempting to do so will brick block production. // chain has started. Attempting to do so will brick block production.
pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK; pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;
// Time is measured by number of blocks. // Time is measured by number of blocks.
@@ -214,12 +212,12 @@ pub const MICROUNIT: Balance = 1_000_000;
/// The existential deposit. Set to 1/10 of the Connected Relay Chain. /// The existential deposit. Set to 1/10 of the Connected Relay Chain.
pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT; pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT;
/// We assume that ~5% of the block weight is consumed by `on_initialize` handlers. This is /// We assume that ~5% of the block weight is consumed by `on_initialize`
/// used to limit the maximal weight of a single extrinsic. /// handlers. This is used to limit the maximal weight of a single extrinsic.
const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5); const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(5);
/// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be used by /// We allow `Normal` extrinsics to fill up the block up to 75%, the rest can be
/// `Operational` extrinsics. /// used by `Operational` extrinsics.
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75); const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 0.5 of a second of compute with a 12 second average block time. /// We allow for 0.5 of a second of compute with a 12 second average block time.
@@ -228,16 +226,17 @@ const MAXIMUM_BLOCK_WEIGHT: Weight = Weight::from_parts(
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64, cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64,
); );
/// Maximum number of blocks simultaneously accepted by the Runtime, not yet included /// Maximum number of blocks simultaneously accepted by the Runtime, not yet
/// into the relay chain. /// included into the relay chain.
const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1; const UNINCLUDED_SEGMENT_CAPACITY: u32 = 1;
/// How many parachain blocks are processed by the relay chain per parent. Limits the /// How many parachain blocks are processed by the relay chain per parent.
/// number of blocks authored per slot. /// Limits the number of blocks authored per slot.
const BLOCK_PROCESSING_VELOCITY: u32 = 1; const BLOCK_PROCESSING_VELOCITY: u32 = 1;
/// Relay chain slot duration, in milliseconds. /// Relay chain slot duration, in milliseconds.
const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000; const RELAY_CHAIN_SLOT_DURATION_MILLIS: u32 = 6000;
/// The version information used to identify this runtime when compiled natively. /// The version information used to identify this runtime when compiled
/// natively.
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub fn native_version() -> NativeVersion { pub fn native_version() -> NativeVersion {
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
@@ -276,64 +275,67 @@ parameter_types! {
// Configure FRAME pallets to include in runtime. // Configure FRAME pallets to include in runtime.
impl frame_system::Config for Runtime { impl frame_system::Config for Runtime {
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// The identifier used to distinguish between accounts. /// The identifier used to distinguish between accounts.
type AccountId = AccountId; type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics. /// The basic call filter to use in dispatchable.
type RuntimeCall = RuntimeCall; type BaseCallFilter = Everything;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers. /// The block type.
type Lookup = AccountIdLookup<AccountId, ()>; type Block = Block;
/// The index type for storing how many extrinsics an account has signed. /// Maximum number of block number to block hash mappings to keep (oldest
type Nonce = Nonce; /// pruned first).
type BlockHashCount = BlockHashCount;
/// The maximum length of a block (in bytes).
type BlockLength = RuntimeBlockLength;
/// Block & extrinsics weights: base values and limits.
type BlockWeights = RuntimeBlockWeights;
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
/// The type for hashing blocks and tries. /// The type for hashing blocks and tries.
type Hash = Hash; type Hash = Hash;
/// The hashing algorithm used. /// The hashing algorithm used.
type Hashing = BlakeTwo256; type Hashing = BlakeTwo256;
/// The block type. /// The lookup mechanism to get account ID from whatever is passed in
type Block = Block; /// dispatchers.
type Lookup = AccountIdLookup<AccountId, ()>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
/// The index type for storing how many extrinsics an account has signed.
type Nonce = Nonce;
/// What to do if an account is fully reaped from the system.
type OnKilledAccount = ();
/// What to do if a new account is created.
type OnNewAccount = ();
/// The action to take on a Runtime Upgrade
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
/// Converts a module to an index of this module in the runtime.
type PalletInfo = PalletInfo;
/// The aggregated dispatch type that is available for extrinsics.
type RuntimeCall = RuntimeCall;
/// The ubiquitous event type. /// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
/// The ubiquitous origin type. /// The ubiquitous origin type.
type RuntimeOrigin = RuntimeOrigin; type RuntimeOrigin = RuntimeOrigin;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first). /// This is used as an identifier of the chain. 42 is the generic substrate
type BlockHashCount = BlockHashCount; /// prefix.
/// Runtime version. type SS58Prefix = SS58Prefix;
type Version = Version;
/// Converts a module to an index of this module in the runtime.
type PalletInfo = PalletInfo;
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// 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 = ();
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
/// The basic call filter to use in dispatchable.
type BaseCallFilter = Everything;
/// Weight information for the extrinsics of this pallet. /// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = (); type SystemWeightInfo = ();
/// Block & extrinsics weights: base values and limits. /// Runtime version.
type BlockWeights = RuntimeBlockWeights; type Version = Version;
/// The maximum length of a block (in bytes).
type BlockLength = RuntimeBlockLength;
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix;
/// The action to take on a Runtime Upgrade
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
} }
impl pallet_timestamp::Config for Runtime { impl pallet_timestamp::Config for Runtime {
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
/// A timestamp: milliseconds since the unix epoch. /// A timestamp: milliseconds since the unix epoch.
type Moment = u64; type Moment = u64;
type OnTimestampSet = Aura; type OnTimestampSet = Aura;
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
type WeightInfo = (); type WeightInfo = ();
} }
impl pallet_authorship::Config for Runtime { impl pallet_authorship::Config for Runtime {
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
type EventHandler = (CollatorSelection,); type EventHandler = (CollatorSelection,);
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
} }
parameter_types! { parameter_types! {
@@ -341,22 +343,22 @@ parameter_types! {
} }
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
type MaxLocks = ConstU32<50>; type AccountStore = System;
/// The type for recording an account's balance. /// The type for recording an account's balance.
type Balance = Balance; type Balance = Balance;
/// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent;
type DustRemoval = (); type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type FreezeIdentifier = ();
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>; type MaxFreezes = ConstU32<0>;
type MaxHolds = ConstU32<0>;
type MaxLocks = ConstU32<50>;
type MaxReserves = ConstU32<50>; type MaxReserves = ConstU32<50>;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
type RuntimeHoldReason = RuntimeHoldReason; /// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent;
type RuntimeFreezeReason = RuntimeFreezeReason; type RuntimeFreezeReason = RuntimeFreezeReason;
type FreezeIdentifier = (); type RuntimeHoldReason = RuntimeHoldReason;
type MaxHolds = ConstU32<0>; type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type MaxFreezes = ConstU32<0>;
} }
parameter_types! { parameter_types! {
@@ -365,17 +367,17 @@ parameter_types! {
} }
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type WeightToFee = WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>; type FeeMultiplierUpdate = SlowAdjustingFeeUpdate<Self>;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = ConstU8<5>; type OperationalFeeMultiplier = ConstU8<5>;
type RuntimeEvent = RuntimeEvent;
type WeightToFee = WeightToFee;
} }
impl pallet_sudo::Config for Runtime { impl pallet_sudo::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall; type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = (); type WeightInfo = ();
} }
@@ -385,14 +387,6 @@ parameter_types! {
} }
impl cumulus_pallet_parachain_system::Config for Runtime { impl cumulus_pallet_parachain_system::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type OnSystemEvent = ();
type SelfParaId = parachain_info::Pallet<Runtime>;
type OutboundXcmpMessageSource = XcmpQueue;
type DmpMessageHandler = DmpQueue;
type ReservedDmpWeight = ReservedDmpWeight;
type XcmpMessageHandler = XcmpQueue;
type ReservedXcmpWeight = ReservedXcmpWeight;
type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases; type CheckAssociatedRelayNumber = RelayNumberStrictlyIncreases;
type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook< type ConsensusHook = cumulus_pallet_aura_ext::FixedVelocityConsensusHook<
Runtime, Runtime,
@@ -400,6 +394,14 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
BLOCK_PROCESSING_VELOCITY, BLOCK_PROCESSING_VELOCITY,
UNINCLUDED_SEGMENT_CAPACITY, UNINCLUDED_SEGMENT_CAPACITY,
>; >;
type DmpMessageHandler = DmpQueue;
type OnSystemEvent = ();
type OutboundXcmpMessageSource = XcmpQueue;
type ReservedDmpWeight = ReservedDmpWeight;
type ReservedXcmpWeight = ReservedXcmpWeight;
type RuntimeEvent = RuntimeEvent;
type SelfParaId = parachain_info::Pallet<Runtime>;
type XcmpMessageHandler = XcmpQueue;
} }
impl parachain_info::Config for Runtime {} impl parachain_info::Config for Runtime {}
@@ -407,21 +409,21 @@ impl parachain_info::Config for Runtime {}
impl cumulus_pallet_aura_ext::Config for Runtime {} impl cumulus_pallet_aura_ext::Config for Runtime {}
impl cumulus_pallet_xcmp_queue::Config for Runtime { impl cumulus_pallet_xcmp_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>;
type ChannelInfo = ParachainSystem; type ChannelInfo = ParachainSystem;
type VersionWrapper = ();
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type ControllerOrigin = EnsureRoot<AccountId>; type ControllerOrigin = EnsureRoot<AccountId>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin; type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type WeightInfo = (); type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>; type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
type RuntimeEvent = RuntimeEvent;
type VersionWrapper = ();
type WeightInfo = ();
type XcmExecutor = XcmExecutor<XcmConfig>;
} }
impl cumulus_pallet_dmp_queue::Config for Runtime { impl cumulus_pallet_dmp_queue::Config for Runtime {
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type XcmExecutor = XcmExecutor<XcmConfig>; type XcmExecutor = XcmExecutor<XcmConfig>;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
} }
parameter_types! { parameter_types! {
@@ -430,24 +432,24 @@ parameter_types! {
} }
impl pallet_session::Config for Runtime { impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
// Essentially just Aura, but let's be pedantic.
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type SessionManager = CollatorSelection;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type ValidatorId = <Self as frame_system::Config>::AccountId; type ValidatorId = <Self as frame_system::Config>::AccountId;
// we don't have stash and controller, thus we don't need the convert as well. // we don't have stash and controller, thus we don't need the convert as well.
type ValidatorIdOf = pallet_collator_selection::IdentityCollator; type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;
type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;
type SessionManager = CollatorSelection;
// Essentially just Aura, but let's be pedantic.
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
type Keys = SessionKeys;
type WeightInfo = (); type WeightInfo = ();
} }
impl pallet_aura::Config for Runtime { impl pallet_aura::Config for Runtime {
type AllowMultipleBlocksPerSlot = ConstBool<false>;
type AuthorityId = AuraId; type AuthorityId = AuraId;
type DisabledValidators = (); type DisabledValidators = ();
type MaxAuthorities = ConstU32<100_000>; type MaxAuthorities = ConstU32<100_000>;
type AllowMultipleBlocksPerSlot = ConstBool<false>;
#[cfg(feature = "experimental")] #[cfg(feature = "experimental")]
type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Self>; type SlotDuration = pallet_aura::MinimumPeriodTimesTwo<Self>;
} }
@@ -459,22 +461,23 @@ parameter_types! {
pub const StakingAdminBodyId: BodyId = BodyId::Defense; pub const StakingAdminBodyId: BodyId = BodyId::Defense;
} }
/// We allow root and the StakingAdmin to execute privileged collator selection operations. /// We allow root and the StakingAdmin to execute privileged collator selection
/// operations.
pub type CollatorSelectionUpdateOrigin = EitherOfDiverse< pub type CollatorSelectionUpdateOrigin = EitherOfDiverse<
EnsureRoot<AccountId>, EnsureRoot<AccountId>,
EnsureXcm<IsVoiceOfBody<RelayLocation, StakingAdminBodyId>>, EnsureXcm<IsVoiceOfBody<RelayLocation, StakingAdminBodyId>>,
>; >;
impl pallet_collator_selection::Config for Runtime { impl pallet_collator_selection::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances; type Currency = Balances;
type UpdateOrigin = CollatorSelectionUpdateOrigin;
type PotId = PotId;
type MaxCandidates = ConstU32<100>;
type MinEligibleCollators = ConstU32<4>;
type MaxInvulnerables = ConstU32<20>;
// should be a multiple of session or things will get inconsistent // should be a multiple of session or things will get inconsistent
type KickThreshold = Period; type KickThreshold = Period;
type MaxCandidates = ConstU32<100>;
type MaxInvulnerables = ConstU32<20>;
type MinEligibleCollators = ConstU32<4>;
type PotId = PotId;
type RuntimeEvent = RuntimeEvent;
type UpdateOrigin = CollatorSelectionUpdateOrigin;
type ValidatorId = <Self as frame_system::Config>::AccountId; type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_collator_selection::IdentityCollator; type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
type ValidatorRegistration = Session; type ValidatorRegistration = Session;
@@ -486,7 +489,8 @@ impl pallet_parachain_template::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
} }
// Create the runtime by composing the FRAME pallets that were previously configured. // Create the runtime by composing the FRAME pallets that were previously
// configured.
construct_runtime!( construct_runtime!(
pub enum Runtime pub enum Runtime
{ {
+2 -1
View File
@@ -32,9 +32,10 @@ pub mod constants {
#[cfg(test)] #[cfg(test)]
mod test_db_weights { mod test_db_weights {
use super::constants::ParityDbWeight as W;
use frame_support::weights::constants; use frame_support::weights::constants;
use super::constants::ParityDbWeight as W;
/// Checks that all weights exist and have sane values. /// Checks that all weights exist and have sane values.
// NOTE: If this test fails but you are sure that the generated values are fine, // NOTE: If this test fails but you are sure that the generated values are fine,
// you can delete it. // you can delete it.
+2 -1
View File
@@ -32,9 +32,10 @@ pub mod constants {
#[cfg(test)] #[cfg(test)]
mod test_db_weights { mod test_db_weights {
use super::constants::RocksDbWeight as W;
use frame_support::weights::constants; use frame_support::weights::constants;
use super::constants::RocksDbWeight as W;
/// Checks that all weights exist and have sane values. /// Checks that all weights exist and have sane values.
// NOTE: If this test fails but you are sure that the generated values are fine, // NOTE: If this test fails but you are sure that the generated values are fine,
// you can delete it. // you can delete it.
+57 -53
View File
@@ -1,7 +1,3 @@
use super::{
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
use frame_support::{ use frame_support::{
match_types, parameter_types, match_types, parameter_types,
traits::{ConstU32, Everything, Nothing}, traits::{ConstU32, Everything, Nothing},
@@ -22,6 +18,11 @@ use xcm_builder::{
}; };
use xcm_executor::XcmExecutor; use xcm_executor::XcmExecutor;
use super::{
AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};
parameter_types! { parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent(); pub const RelayLocation: MultiLocation = MultiLocation::parent();
pub const RelayNetwork: Option<NetworkId> = None; pub const RelayNetwork: Option<NetworkId> = None;
@@ -29,9 +30,10 @@ parameter_types! {
pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into(); pub UniversalLocation: InteriorMultiLocation = Parachain(ParachainInfo::parachain_id().into()).into();
} }
/// Type for specifying how a `MultiLocation` can be converted into an `AccountId`. This is used /// Type for specifying how a `MultiLocation` can be converted into an
/// when determining ownership of accounts for asset transacting and when attempting to use XCM /// `AccountId`. This is used when determining ownership of accounts for asset
/// `Transact` in order to determine the dispatch Origin. /// transacting and when attempting to use XCM `Transact` in order to determine
/// the dispatch Origin.
pub type LocationToAccountId = ( pub type LocationToAccountId = (
// The parent (Relay-chain) origin converts to the parent `AccountId`. // The parent (Relay-chain) origin converts to the parent `AccountId`.
ParentIsPreset<AccountId>, ParentIsPreset<AccountId>,
@@ -55,9 +57,10 @@ pub type LocalAssetTransactor = CurrencyAdapter<
(), (),
>; >;
/// This is the type we use to convert an (incoming) XCM origin into a local `Origin` instance, /// This is the type we use to convert an (incoming) XCM origin into a local
/// ready for dispatching a transaction with Xcm's `Transact`. There is an `OriginKind` which can /// `Origin` instance, ready for dispatching a transaction with Xcm's
/// biases the kind of local `Origin` it will become. /// `Transact`. There is an `OriginKind` which can biases the kind of local
/// `Origin` it will become.
pub type XcmOriginToTransactDispatchOrigin = ( pub type XcmOriginToTransactDispatchOrigin = (
// Sovereign account converter; this attempts to derive an `AccountId` from the origin location // Sovereign account converter; this attempts to derive an `AccountId` from the origin location
// using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for // using `LocationToAccountId` and then turn that into the usual `Signed` origin. Useful for
@@ -110,39 +113,40 @@ pub type Barrier = TrailingSetTopicAsId<
pub struct XcmConfig; pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig { impl xcm_executor::Config for XcmConfig {
type RuntimeCall = RuntimeCall; type Aliasers = Nothing;
type XcmSender = XcmRouter; type AssetClaims = PolkadotXcm;
type AssetExchanger = ();
type AssetLocker = ();
// How to withdraw and deposit an asset. // How to withdraw and deposit an asset.
type AssetTransactor = LocalAssetTransactor; type AssetTransactor = LocalAssetTransactor;
type OriginConverter = XcmOriginToTransactDispatchOrigin; type AssetTrap = PolkadotXcm;
type IsReserve = NativeAsset;
type IsTeleporter = (); // Teleporting is disabled.
type UniversalLocation = UniversalLocation;
type Barrier = Barrier; type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>; type CallDispatcher = RuntimeCall;
type FeeManager = ();
type IsReserve = NativeAsset;
type IsTeleporter = ();
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type MessageExporter = ();
type OriginConverter = XcmOriginToTransactDispatchOrigin;
type PalletInstancesInfo = AllPalletsWithSystem;
type ResponseHandler = PolkadotXcm;
type RuntimeCall = RuntimeCall;
type SafeCallFilter = Everything;
type SubscriptionService = PolkadotXcm;
type Trader = type Trader =
UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>; UsingComponents<WeightToFee, RelayLocation, AccountId, Balances, ToAuthor<Runtime>>;
type ResponseHandler = PolkadotXcm;
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
type PalletInstancesInfo = AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing; type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall; // Teleporting is disabled.
type SafeCallFilter = Everything; type UniversalLocation = UniversalLocation;
type Aliasers = Nothing; type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type XcmSender = XcmRouter;
} }
/// No local origins on this chain are allowed to dispatch XCM sends/executions. /// No local origins on this chain are allowed to dispatch XCM sends/executions.
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>; pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
/// The means for routing XCM messages which are not for local execution into the right message /// The means for routing XCM messages which are not for local execution into
/// queues. /// the right message queues.
pub type XcmRouter = WithUniqueTopic<( pub type XcmRouter = WithUniqueTopic<(
// Two routers - use UMP to communicate with the relay chain: // Two routers - use UMP to communicate with the relay chain:
cumulus_primitives_utility::ParentAsUmp<ParachainSystem, (), ()>, cumulus_primitives_utility::ParentAsUmp<ParachainSystem, (), ()>,
@@ -156,35 +160,35 @@ parameter_types! {
} }
impl pallet_xcm::Config for Runtime { impl pallet_xcm::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type AdminOrigin = EnsureRoot<AccountId>;
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmRouter = XcmRouter;
type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type XcmExecuteFilter = Nothing;
// ^ Disable dispatchable execute on the XCM pallet.
// Needs to be `Everything` for local testing.
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmTeleportFilter = Everything;
type XcmReserveTransferFilter = Nothing;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type UniversalLocation = UniversalLocation;
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
// ^ Override for AdvertisedXcmVersion default // ^ Override for AdvertisedXcmVersion default
type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion; type AdvertisedXcmVersion = pallet_xcm::CurrentXcmVersion;
type Currency = Balances; type Currency = Balances;
type CurrencyMatcher = (); type CurrencyMatcher = ();
type TrustedLockers = (); type ExecuteXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type SovereignAccountOf = LocationToAccountId;
type MaxLockers = ConstU32<8>; type MaxLockers = ConstU32<8>;
type WeightInfo = pallet_xcm::TestWeightInfo; type MaxRemoteLockConsumers = ConstU32<0>;
#[cfg(feature = "runtime-benchmarks")] #[cfg(feature = "runtime-benchmarks")]
type ReachableDest = ReachableDest; type ReachableDest = ReachableDest;
type AdminOrigin = EnsureRoot<AccountId>;
type MaxRemoteLockConsumers = ConstU32<0>;
type RemoteLockConsumerIdentifier = (); type RemoteLockConsumerIdentifier = ();
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type RuntimeOrigin = RuntimeOrigin;
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
type SovereignAccountOf = LocationToAccountId;
type TrustedLockers = ();
type UniversalLocation = UniversalLocation;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type WeightInfo = pallet_xcm::TestWeightInfo;
type XcmExecuteFilter = Nothing;
// ^ Disable dispatchable execute on the XCM pallet.
// Needs to be `Everything` for local testing.
type XcmExecutor = XcmExecutor<XcmConfig>;
type XcmReserveTransferFilter = Nothing;
type XcmRouter = XcmRouter;
type XcmTeleportFilter = Everything;
const VERSION_DISCOVERY_QUEUE_SIZE: u32 = 100;
} }
impl cumulus_pallet_xcm::Config for Runtime { impl cumulus_pallet_xcm::Config for Runtime {