mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
Integrate a governance XCM origin (#407)
* Introduce the converter into the hub * Parachain recognises Rococo governance body as admin * Whitespace * Use UsingComponents for fee payment in XCM * Fixes * Fixes for XCM permissions * Remove encode_call test * Fixes * Fixes * Fixes
This commit is contained in:
Generated
+27
-9
@@ -1428,6 +1428,7 @@ dependencies = [
|
|||||||
"frame-system",
|
"frame-system",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"serde",
|
"serde",
|
||||||
|
"sp-io",
|
||||||
"sp-runtime",
|
"sp-runtime",
|
||||||
"sp-std",
|
"sp-std",
|
||||||
"xcm",
|
"xcm",
|
||||||
@@ -1528,6 +1529,7 @@ dependencies = [
|
|||||||
"frame-support",
|
"frame-support",
|
||||||
"frame-system",
|
"frame-system",
|
||||||
"hex",
|
"hex",
|
||||||
|
"hex-literal 0.3.1",
|
||||||
"log",
|
"log",
|
||||||
"pallet-balances",
|
"pallet-balances",
|
||||||
"pallet-randomness-collective-flip",
|
"pallet-randomness-collective-flip",
|
||||||
@@ -1598,7 +1600,10 @@ dependencies = [
|
|||||||
"frame-executive",
|
"frame-executive",
|
||||||
"frame-support",
|
"frame-support",
|
||||||
"frame-system",
|
"frame-system",
|
||||||
|
"hex",
|
||||||
|
"hex-literal 0.3.1",
|
||||||
"log",
|
"log",
|
||||||
|
"pallet-assets",
|
||||||
"pallet-balances",
|
"pallet-balances",
|
||||||
"pallet-randomness-collective-flip",
|
"pallet-randomness-collective-flip",
|
||||||
"pallet-sudo",
|
"pallet-sudo",
|
||||||
@@ -3885,9 +3890,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libp2p-mdns"
|
name = "libp2p-mdns"
|
||||||
version = "0.30.1"
|
version = "0.30.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "41e282f974c4bea56db8acca50387f05189406e346318cb30190b0bde662961e"
|
checksum = "c221897b3fd7f215de7ecfec215c5eba598e5b61c605b5f8b56fe8a4fb507724"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-io",
|
"async-io",
|
||||||
"data-encoding",
|
"data-encoding",
|
||||||
@@ -4790,6 +4795,19 @@ dependencies = [
|
|||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pallet-assets"
|
||||||
|
version = "3.0.0"
|
||||||
|
source = "git+https://github.com/paritytech/substrate?branch=master#282d57c0745b530fe7a9ebaffcd6ac36c09d0554"
|
||||||
|
dependencies = [
|
||||||
|
"frame-benchmarking",
|
||||||
|
"frame-support",
|
||||||
|
"frame-system",
|
||||||
|
"parity-scale-codec",
|
||||||
|
"sp-runtime",
|
||||||
|
"sp-std",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pallet-authority-discovery"
|
name = "pallet-authority-discovery"
|
||||||
version = "3.0.0"
|
version = "3.0.0"
|
||||||
@@ -9436,7 +9454,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-consensus-aura"
|
name = "sp-consensus-aura"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/paritytech/substrate?branch=master#8060a437dc01cc247a757fb318a46f81c8e40d5c"
|
source = "git+https://github.com/paritytech/substrate?branch=master#282d57c0745b530fe7a9ebaffcd6ac36c09d0554"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"sp-api",
|
"sp-api",
|
||||||
@@ -9845,7 +9863,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "sp-test-primitives"
|
name = "sp-test-primitives"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
source = "git+https://github.com/paritytech/substrate?branch=master#8060a437dc01cc247a757fb318a46f81c8e40d5c"
|
source = "git+https://github.com/paritytech/substrate?branch=master#282d57c0745b530fe7a9ebaffcd6ac36c09d0554"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
"parity-util-mem",
|
"parity-util-mem",
|
||||||
@@ -10170,7 +10188,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-test-runtime"
|
name = "substrate-test-runtime"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
source = "git+https://github.com/paritytech/substrate?branch=master#8060a437dc01cc247a757fb318a46f81c8e40d5c"
|
source = "git+https://github.com/paritytech/substrate?branch=master#282d57c0745b530fe7a9ebaffcd6ac36c09d0554"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"frame-support",
|
"frame-support",
|
||||||
@@ -10211,7 +10229,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-test-runtime-client"
|
name = "substrate-test-runtime-client"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
source = "git+https://github.com/paritytech/substrate?branch=master#8060a437dc01cc247a757fb318a46f81c8e40d5c"
|
source = "git+https://github.com/paritytech/substrate?branch=master#282d57c0745b530fe7a9ebaffcd6ac36c09d0554"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures 0.3.14",
|
"futures 0.3.14",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
@@ -10232,7 +10250,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-test-utils"
|
name = "substrate-test-utils"
|
||||||
version = "3.0.0"
|
version = "3.0.0"
|
||||||
source = "git+https://github.com/paritytech/substrate?branch=master#8060a437dc01cc247a757fb318a46f81c8e40d5c"
|
source = "git+https://github.com/paritytech/substrate?branch=master#282d57c0745b530fe7a9ebaffcd6ac36c09d0554"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures 0.3.14",
|
"futures 0.3.14",
|
||||||
"substrate-test-utils-derive",
|
"substrate-test-utils-derive",
|
||||||
@@ -10242,7 +10260,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-test-utils-derive"
|
name = "substrate-test-utils-derive"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "git+https://github.com/paritytech/substrate?branch=master#8060a437dc01cc247a757fb318a46f81c8e40d5c"
|
source = "git+https://github.com/paritytech/substrate?branch=master#282d57c0745b530fe7a9ebaffcd6ac36c09d0554"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro-crate 1.0.0",
|
"proc-macro-crate 1.0.0",
|
||||||
"quote 1.0.9",
|
"quote 1.0.9",
|
||||||
@@ -10268,7 +10286,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-wasm-builder"
|
name = "substrate-wasm-builder"
|
||||||
version = "4.0.0"
|
version = "4.0.0"
|
||||||
source = "git+https://github.com/paritytech/substrate?branch=master#8060a437dc01cc247a757fb318a46f81c8e40d5c"
|
source = "git+https://github.com/paritytech/substrate?branch=master#282d57c0745b530fe7a9ebaffcd6ac36c09d0554"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term 0.12.1",
|
"ansi_term 0.12.1",
|
||||||
"atty",
|
"atty",
|
||||||
|
|||||||
@@ -471,7 +471,7 @@ impl<T: Config> Module<T> {
|
|||||||
assert_eq!(
|
assert_eq!(
|
||||||
params.relay_parent_storage_root,
|
params.relay_parent_storage_root,
|
||||||
validation_data.relay_parent_storage_root,
|
validation_data.relay_parent_storage_root,
|
||||||
"Relay parent stoarage root doesn't match",
|
"Relay parent storage root doesn't match",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -485,25 +485,38 @@ impl<T: Config> Module<T> {
|
|||||||
downward_messages: Vec<InboundDownwardMessage>,
|
downward_messages: Vec<InboundDownwardMessage>,
|
||||||
) -> Result<Weight, DispatchError> {
|
) -> Result<Weight, DispatchError> {
|
||||||
let dm_count = downward_messages.len() as u32;
|
let dm_count = downward_messages.len() as u32;
|
||||||
|
|
||||||
let mut weight_used = 0;
|
let mut weight_used = 0;
|
||||||
|
|
||||||
// Reference fu to avoid the `move` capture.
|
if dm_count != 0 {
|
||||||
let weight_used_mut_ref = &mut weight_used;
|
let mut processed_count = 0;
|
||||||
let result_mqc_head = LastDmqMqcHead::mutate(move |mqc| {
|
|
||||||
for downward_message in downward_messages {
|
|
||||||
mqc.extend_downward(&downward_message);
|
|
||||||
*weight_used_mut_ref += T::DownwardMessageHandlers::handle_downward_message(downward_message);
|
|
||||||
}
|
|
||||||
mqc.0
|
|
||||||
});
|
|
||||||
|
|
||||||
// After hashing each message in the message queue chain submitted by the collator, we should
|
Self::deposit_event(RawEvent::DownwardMessagesReceived(dm_count));
|
||||||
// arrive to the MQC head provided by the relay chain.
|
|
||||||
ensure!(
|
// Reference fu to avoid the `move` capture.
|
||||||
result_mqc_head == expected_dmq_mqc_head,
|
let weight_used_ref = &mut weight_used;
|
||||||
Error::<T>::DmpMqcMismatch
|
let processed_count_ref = &mut processed_count;
|
||||||
);
|
let result_mqc_head = LastDmqMqcHead::mutate(move |mqc| {
|
||||||
|
for downward_message in downward_messages {
|
||||||
|
mqc.extend_downward(&downward_message);
|
||||||
|
*weight_used_ref += T::DownwardMessageHandlers::handle_downward_message(downward_message);
|
||||||
|
*processed_count_ref += 1;
|
||||||
|
}
|
||||||
|
mqc.0
|
||||||
|
});
|
||||||
|
|
||||||
|
Self::deposit_event(RawEvent::DownwardMessagesProcessed(
|
||||||
|
processed_count,
|
||||||
|
weight_used,
|
||||||
|
result_mqc_head.clone(),
|
||||||
|
expected_dmq_mqc_head.clone(),
|
||||||
|
));
|
||||||
|
|
||||||
|
// After hashing each message in the message queue chain submitted by the collator, we should
|
||||||
|
// arrive to the MQC head provided by the relay chain.
|
||||||
|
assert_eq!(result_mqc_head, expected_dmq_mqc_head);
|
||||||
|
} else {
|
||||||
|
assert_eq!(LastDmqMqcHead::get().0, expected_dmq_mqc_head);
|
||||||
|
}
|
||||||
|
|
||||||
// Store the processed_downward_messages here so that it will be accessible from
|
// Store the processed_downward_messages here so that it will be accessible from
|
||||||
// PVF's `validate_block` wrapper and collation pipeline.
|
// PVF's `validate_block` wrapper and collation pipeline.
|
||||||
@@ -791,12 +804,18 @@ impl<T: Config> ProvideInherent for Module<T> {
|
|||||||
|
|
||||||
decl_event! {
|
decl_event! {
|
||||||
pub enum Event<T> where Hash = <T as frame_system::Config>::Hash {
|
pub enum Event<T> where Hash = <T as frame_system::Config>::Hash {
|
||||||
// The validation function has been scheduled to apply as of the contained relay chain block number.
|
/// The validation function has been scheduled to apply as of the contained relay chain block number.
|
||||||
ValidationFunctionStored(RelayChainBlockNumber),
|
ValidationFunctionStored(RelayChainBlockNumber),
|
||||||
// The validation function was applied as of the contained relay chain block number.
|
/// The validation function was applied as of the contained relay chain block number.
|
||||||
ValidationFunctionApplied(RelayChainBlockNumber),
|
ValidationFunctionApplied(RelayChainBlockNumber),
|
||||||
// An upgrade has been authorized.
|
/// An upgrade has been authorized.
|
||||||
UpgradeAuthorized(Hash),
|
UpgradeAuthorized(Hash),
|
||||||
|
/// Downward messages were processed using the given weight.
|
||||||
|
/// \[ count, weight_used, result_mqc_head, expected_mqc_head \]
|
||||||
|
DownwardMessagesProcessed(u32, Weight, relay_chain::Hash, relay_chain::Hash),
|
||||||
|
/// Some downward messages have been received and will be processed.
|
||||||
|
/// \[ count \]
|
||||||
|
DownwardMessagesReceived(u32),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ codec = { package = "parity-scale-codec", version = "2.0.0", default-features =
|
|||||||
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
serde = { version = "1.0.101", optional = true, features = ["derive"] }
|
||||||
|
|
||||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
|
sp-io = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
sp-runtime = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
|
|||||||
@@ -20,13 +20,17 @@
|
|||||||
|
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
use cumulus_primitives_core::ParaId;
|
use sp_std::convert::TryFrom;
|
||||||
|
use cumulus_primitives_core::{ParaId, DownwardMessageHandler, InboundDownwardMessage};
|
||||||
use codec::{Encode, Decode};
|
use codec::{Encode, Decode};
|
||||||
use sp_runtime::traits::BadOrigin;
|
use sp_runtime::traits::BadOrigin;
|
||||||
|
use xcm::{VersionedXcm, v0::{Xcm, Junction, Outcome, ExecuteXcm}};
|
||||||
|
use frame_support::{traits::Get, dispatch::Weight};
|
||||||
pub use pallet::*;
|
pub use pallet::*;
|
||||||
|
|
||||||
#[frame_support::pallet]
|
#[frame_support::pallet]
|
||||||
pub mod pallet {
|
pub mod pallet {
|
||||||
|
use super::*;
|
||||||
use frame_support::pallet_prelude::*;
|
use frame_support::pallet_prelude::*;
|
||||||
use frame_system::pallet_prelude::*;
|
use frame_system::pallet_prelude::*;
|
||||||
|
|
||||||
@@ -36,16 +40,68 @@ pub mod pallet {
|
|||||||
|
|
||||||
/// The module configuration trait.
|
/// The module configuration trait.
|
||||||
#[pallet::config]
|
#[pallet::config]
|
||||||
pub trait Config: frame_system::Config {}
|
pub trait Config: frame_system::Config {
|
||||||
|
/// The overarching event type.
|
||||||
|
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
|
||||||
|
|
||||||
|
type XcmExecutor: ExecuteXcm<Self::Call>;
|
||||||
|
|
||||||
|
#[pallet::constant]
|
||||||
|
type MaxWeight: Get<Weight>;
|
||||||
|
}
|
||||||
|
|
||||||
#[pallet::error]
|
#[pallet::error]
|
||||||
pub enum Error<T> {}
|
pub enum Error<T> {
|
||||||
|
}
|
||||||
|
|
||||||
#[pallet::hooks]
|
#[pallet::hooks]
|
||||||
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
|
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {}
|
||||||
|
|
||||||
#[pallet::call]
|
#[pallet::call]
|
||||||
impl<T: Config> Pallet<T> {}
|
impl<T: Config> Pallet<T> {}
|
||||||
|
|
||||||
|
#[pallet::event]
|
||||||
|
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||||
|
#[pallet::metadata(T::BlockNumber = "BlockNumber")]
|
||||||
|
pub enum Event<T: Config> {
|
||||||
|
/// Downward message is invalid XCM.
|
||||||
|
/// \[ id \]
|
||||||
|
InvalidFormat([u8; 8]),
|
||||||
|
/// Downward message is unsupported version of XCM.
|
||||||
|
/// \[ id \]
|
||||||
|
UnsupportedVersion([u8; 8]),
|
||||||
|
/// Downward message executed with the given outcome.
|
||||||
|
/// \[ id, outcome \]
|
||||||
|
ExecutedDownward([u8; 8], Outcome),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// For an incoming downward message, this just adapts an XCM executor and executes DMP messages
|
||||||
|
/// immediately up until some `MaxWeight` at which point it errors. Their origin is asserted to be
|
||||||
|
/// the Parent location.
|
||||||
|
impl<T: Config> DownwardMessageHandler for Pallet<T> {
|
||||||
|
fn handle_downward_message(msg: InboundDownwardMessage) -> Weight {
|
||||||
|
let id = sp_io::hashing::twox_64(&msg.msg[..]);
|
||||||
|
let msg = VersionedXcm::<T::Call>::decode(&mut &msg.msg[..])
|
||||||
|
.map(Xcm::<T::Call>::try_from);
|
||||||
|
match msg {
|
||||||
|
Ok(Ok(x)) => {
|
||||||
|
let weight_limit = T::MaxWeight::get();
|
||||||
|
let outcome = T::XcmExecutor::execute_xcm(Junction::Parent.into(), x, weight_limit);
|
||||||
|
let weight_used = outcome.weight_used();
|
||||||
|
Self::deposit_event(Event::ExecutedDownward(id, outcome));
|
||||||
|
weight_used
|
||||||
|
}
|
||||||
|
Ok(Err(())) => {
|
||||||
|
Self::deposit_event(Event::UnsupportedVersion(id));
|
||||||
|
0
|
||||||
|
},
|
||||||
|
Err(_) => {
|
||||||
|
Self::deposit_event(Event::InvalidFormat(id));
|
||||||
|
0
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Origin for the parachains module.
|
/// Origin for the parachains module.
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ sp-inherents = { git = "https://github.com/paritytech/substrate", default-featur
|
|||||||
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-support = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-executive = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
|
pallet-assets = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
pallet-balances = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||||
@@ -48,6 +49,10 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot", default-features
|
|||||||
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
xcm-executor = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
hex-literal = "0.3.1"
|
||||||
|
hex = "0.4.3"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
substrate-wasm-builder = "3.0.0"
|
substrate-wasm-builder = "3.0.0"
|
||||||
|
|
||||||
@@ -71,6 +76,7 @@ std = [
|
|||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-executive/std",
|
"frame-executive/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
|
"pallet-assets/std",
|
||||||
"pallet-balances/std",
|
"pallet-balances/std",
|
||||||
"pallet-randomness-collective-flip/std",
|
"pallet-randomness-collective-flip/std",
|
||||||
"pallet-timestamp/std",
|
"pallet-timestamp/std",
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use sp_api::impl_runtime_apis;
|
|||||||
use sp_core::OpaqueMetadata;
|
use sp_core::OpaqueMetadata;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
create_runtime_str, generic, impl_opaque_keys,
|
create_runtime_str, generic, impl_opaque_keys,
|
||||||
traits::{BlakeTwo256, Block as BlockT, IdentityLookup},
|
traits::{BlakeTwo256, Block as BlockT, AccountIdLookup},
|
||||||
transaction_validity::{TransactionSource, TransactionValidity},
|
transaction_validity::{TransactionSource, TransactionValidity},
|
||||||
ApplyExtrinsicResult,
|
ApplyExtrinsicResult,
|
||||||
};
|
};
|
||||||
@@ -55,15 +55,16 @@ pub use sp_runtime::{Perbill, Permill};
|
|||||||
|
|
||||||
// XCM imports
|
// XCM imports
|
||||||
use polkadot_parachain::primitives::Sibling;
|
use polkadot_parachain::primitives::Sibling;
|
||||||
use xcm::v0::{Junction, MultiLocation, NetworkId};
|
use xcm::v0::{Junction::*, MultiLocation, MultiLocation::*, NetworkId, BodyId};
|
||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
AccountId32Aliases, CurrencyAdapter, LocationInverter, ParentIsDefault, RelayChainAsNative,
|
AccountId32Aliases, CurrencyAdapter, LocationInverter, ParentIsDefault, RelayChainAsNative,
|
||||||
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
SiblingParachainAsNative, SiblingParachainConvertsVia, SignedAccountId32AsNative,
|
||||||
SovereignSignedViaLocation, FixedRateOfConcreteFungible, EnsureXcmOrigin,
|
SovereignSignedViaLocation, EnsureXcmOrigin, AllowUnpaidExecutionFrom, ParentAsSuperuser,
|
||||||
AllowTopLevelPaidExecutionFrom, TakeWeightCredit, FixedWeightBounds, IsConcrete, NativeAsset,
|
AllowTopLevelPaidExecutionFrom, TakeWeightCredit, FixedWeightBounds, IsConcrete, NativeAsset,
|
||||||
AllowUnpaidExecutionFrom, ParentAsSuperuser,
|
UsingComponents,
|
||||||
};
|
};
|
||||||
use xcm_executor::{Config, XcmExecutor};
|
use xcm_executor::{Config, XcmExecutor};
|
||||||
|
use pallet_xcm::{XcmPassthrough, EnsureXcm, IsMajorityOfBody};
|
||||||
|
|
||||||
pub type SessionHandlers = ();
|
pub type SessionHandlers = ();
|
||||||
|
|
||||||
@@ -73,10 +74,10 @@ impl_opaque_keys! {
|
|||||||
|
|
||||||
/// This runtime version.
|
/// This runtime version.
|
||||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||||
spec_name: create_runtime_str!("cumulus-test-parachain"),
|
spec_name: create_runtime_str!("test-parachain"),
|
||||||
impl_name: create_runtime_str!("cumulus-test-parachain"),
|
impl_name: create_runtime_str!("test-parachain"),
|
||||||
authoring_version: 1,
|
authoring_version: 1,
|
||||||
spec_version: 18,
|
spec_version: 9,
|
||||||
impl_version: 0,
|
impl_version: 0,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
transaction_version: 1,
|
transaction_version: 1,
|
||||||
@@ -93,15 +94,13 @@ pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
|
|||||||
pub const HOURS: BlockNumber = MINUTES * 60;
|
pub const HOURS: BlockNumber = MINUTES * 60;
|
||||||
pub const DAYS: BlockNumber = HOURS * 24;
|
pub const DAYS: BlockNumber = HOURS * 24;
|
||||||
|
|
||||||
|
pub const ROC: Balance = 1_000_000_000_000;
|
||||||
|
pub const MILLIROC: Balance = 1_000_000_000;
|
||||||
|
pub const MICROROC: Balance = 1_000_000;
|
||||||
|
|
||||||
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
|
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
|
||||||
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
||||||
|
|
||||||
#[derive(codec::Encode, codec::Decode)]
|
|
||||||
pub enum XCMPMessage<XAccountId, XBalance> {
|
|
||||||
/// Transfer tokens to the given account from the Parachain account.
|
|
||||||
TransferToken(XAccountId, XBalance),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 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 {
|
||||||
@@ -152,7 +151,7 @@ impl frame_system::Config for Runtime {
|
|||||||
/// The aggregated dispatch type that is available for extrinsics.
|
/// The aggregated dispatch type that is available for extrinsics.
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
|
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
|
||||||
type Lookup = IdentityLookup<AccountId>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
/// The index type for blocks.
|
||||||
@@ -198,10 +197,10 @@ impl pallet_timestamp::Config for Runtime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const ExistentialDeposit: u128 = 500;
|
pub const ExistentialDeposit: u128 = 1 * MILLIROC;
|
||||||
pub const TransferFee: u128 = 0;
|
pub const TransferFee: u128 = 1 * MILLIROC;
|
||||||
pub const CreationFee: u128 = 0;
|
pub const CreationFee: u128 = 1 * MILLIROC;
|
||||||
pub const TransactionByteFee: u128 = 1;
|
pub const TransactionByteFee: u128 = 1 * MICROROC;
|
||||||
pub const MaxLocks: u32 = 50;
|
pub const MaxLocks: u32 = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -237,11 +236,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
|
|||||||
type Event = Event;
|
type Event = Event;
|
||||||
type OnValidationData = ();
|
type OnValidationData = ();
|
||||||
type SelfParaId = parachain_info::Module<Runtime>;
|
type SelfParaId = parachain_info::Module<Runtime>;
|
||||||
type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<
|
type DownwardMessageHandlers = CumulusXcm;
|
||||||
MaxDownwardMessageWeight,
|
|
||||||
XcmExecutor<XcmConfig>,
|
|
||||||
Call,
|
|
||||||
>;
|
|
||||||
type OutboundXcmpMessageSource = XcmpQueue;
|
type OutboundXcmpMessageSource = XcmpQueue;
|
||||||
type XcmpMessageHandler = XcmpQueue;
|
type XcmpMessageHandler = XcmpQueue;
|
||||||
type ReservedXcmpWeight = ReservedXcmpWeight;
|
type ReservedXcmpWeight = ReservedXcmpWeight;
|
||||||
@@ -250,12 +245,10 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
|
|||||||
impl parachain_info::Config for Runtime {}
|
impl parachain_info::Config for Runtime {}
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub const RococoLocation: MultiLocation = MultiLocation::X1(Junction::Parent);
|
pub const RocLocation: MultiLocation = X1(Parent);
|
||||||
pub const RococoNetwork: NetworkId = NetworkId::Polkadot;
|
pub const RococoNetwork: NetworkId = NetworkId::Polkadot;
|
||||||
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
|
pub RelayChainOrigin: Origin = cumulus_pallet_xcm::Origin::Relay.into();
|
||||||
pub Ancestry: MultiLocation = Junction::Parachain(
|
pub Ancestry: MultiLocation = X1(Parachain(ParachainInfo::parachain_id().into()));
|
||||||
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 `AccountId`. This is used
|
||||||
@@ -275,7 +268,7 @@ pub type LocalAssetTransactor = CurrencyAdapter<
|
|||||||
// Use this currency:
|
// Use this currency:
|
||||||
Balances,
|
Balances,
|
||||||
// Use this currency when it is a fungible asset matching the given location or name:
|
// Use this currency when it is a fungible asset matching the given location or name:
|
||||||
IsConcrete<RococoLocation>,
|
IsConcrete<RocLocation>,
|
||||||
// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
|
// Do a simple punn to convert an AccountId32 MultiLocation into a native chain account ID:
|
||||||
LocationToAccountId,
|
LocationToAccountId,
|
||||||
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
// Our chain's account ID type (we can't get away without mentioning it explicitly):
|
||||||
@@ -302,23 +295,39 @@ pub type XcmOriginToTransactDispatchOrigin = (
|
|||||||
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
// Native signed account converter; this just converts an `AccountId32` origin into a normal
|
||||||
// `Origin::Signed` origin of the same 32-byte value.
|
// `Origin::Signed` origin of the same 32-byte value.
|
||||||
SignedAccountId32AsNative<RococoNetwork, Origin>,
|
SignedAccountId32AsNative<RococoNetwork, Origin>,
|
||||||
|
// Xcm origins can be represented natively under the Xcm pallet's Xcm origin.
|
||||||
|
XcmPassthrough<Origin>,
|
||||||
);
|
);
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
pub UnitWeightCost: Weight = 1_000;
|
// One XCM operation is 1_000_000 weight - almost certainly a conservative estimate.
|
||||||
|
pub UnitWeightCost: Weight = 1_000_000;
|
||||||
|
// One ROC buys 1 second of weight.
|
||||||
|
pub const WeightPrice: (MultiLocation, u128) = (X1(Parent), ROC);
|
||||||
}
|
}
|
||||||
|
|
||||||
parameter_types! {
|
macro_rules! match_type {
|
||||||
// 1_000_000_000_000 => 1 unit of asset for 1 unit of Weight.
|
( pub type $n:ident: impl Contains<$t:ty> = { $phead:pat $( | $ptail:pat )* } ; ) => {
|
||||||
// TODO: Should take the actual weight price. This is just 1_000 ROC per second of weight.
|
pub struct $n;
|
||||||
pub const WeightPrice: (MultiLocation, u128) = (MultiLocation::X1(Junction::Parent), 1_000);
|
impl frame_support::traits::Contains<$t> for $n {
|
||||||
pub AllowUnpaidFrom: Vec<MultiLocation> = vec![ MultiLocation::X1(Junction::Parent) ];
|
fn contains(l: &$t) -> bool {
|
||||||
|
matches!(l, $phead $( | $ptail )* )
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
match_type! {
|
||||||
|
pub type ParentOrParentsUnitPlurality: impl Contains<MultiLocation> = {
|
||||||
|
X1(Parent) | X2(Parent, Plurality { id: BodyId::Unit, .. })
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Barrier = (
|
pub type Barrier = (
|
||||||
TakeWeightCredit,
|
TakeWeightCredit,
|
||||||
AllowTopLevelPaidExecutionFrom<All<MultiLocation>>,
|
AllowTopLevelPaidExecutionFrom<All<MultiLocation>>,
|
||||||
AllowUnpaidExecutionFrom<IsInVec<AllowUnpaidFrom>>, // <- Parent gets free execution
|
AllowUnpaidExecutionFrom<ParentOrParentsUnitPlurality>,
|
||||||
|
// ^^^ Parent & its unit plurality gets free execution
|
||||||
);
|
);
|
||||||
|
|
||||||
pub struct XcmConfig;
|
pub struct XcmConfig;
|
||||||
@@ -333,7 +342,7 @@ impl Config for XcmConfig {
|
|||||||
type LocationInverter = LocationInverter<Ancestry>;
|
type LocationInverter = LocationInverter<Ancestry>;
|
||||||
type Barrier = Barrier;
|
type Barrier = Barrier;
|
||||||
type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
|
type Weigher = FixedWeightBounds<UnitWeightCost, Call>;
|
||||||
type Trader = FixedRateOfConcreteFungible<WeightPrice, ()>;
|
type Trader = UsingComponents<IdentityFee<Balance>, RocLocation, AccountId, Balances, ()>;
|
||||||
type ResponseHandler = (); // Don't handle responses for now.
|
type ResponseHandler = (); // Don't handle responses for now.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,7 +370,11 @@ impl pallet_xcm::Config for Runtime {
|
|||||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_pallet_xcm::Config for Runtime {}
|
impl cumulus_pallet_xcm::Config for Runtime {
|
||||||
|
type Event = Event;
|
||||||
|
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||||
|
type MaxWeight = MaxDownwardMessageWeight;
|
||||||
|
}
|
||||||
|
|
||||||
impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
@@ -376,6 +389,34 @@ impl cumulus_ping::Config for Runtime {
|
|||||||
type XcmSender = XcmRouter;
|
type XcmSender = XcmRouter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parameter_types! {
|
||||||
|
pub const AssetDeposit: Balance = 1 * ROC;
|
||||||
|
pub const ApprovalDeposit: Balance = 100 * MILLIROC;
|
||||||
|
pub const StringLimit: u32 = 50;
|
||||||
|
pub const MetadataDepositBase: Balance = 1 * ROC;
|
||||||
|
pub const MetadataDepositPerByte: Balance = 10 * MILLIROC;
|
||||||
|
pub const UnitBody: BodyId = BodyId::Unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// A majority of the Unit body from Rococo over XCM is our required administration origin.
|
||||||
|
pub type AdminOrigin = EnsureXcm<IsMajorityOfBody<RocLocation, UnitBody>>;
|
||||||
|
|
||||||
|
impl pallet_assets::Config for Runtime {
|
||||||
|
type Event = Event;
|
||||||
|
type Balance = u64;
|
||||||
|
type AssetId = u32;
|
||||||
|
type Currency = Balances;
|
||||||
|
type ForceOrigin = AdminOrigin;
|
||||||
|
type AssetDeposit = AssetDeposit;
|
||||||
|
type MetadataDepositBase = MetadataDepositBase;
|
||||||
|
type MetadataDepositPerByte = MetadataDepositPerByte;
|
||||||
|
type ApprovalDeposit = ApprovalDeposit;
|
||||||
|
type StringLimit = StringLimit;
|
||||||
|
type Freezer = ();
|
||||||
|
type Extra = ();
|
||||||
|
type WeightInfo = pallet_assets::weights::SubstrateWeight<Runtime>;
|
||||||
|
}
|
||||||
|
|
||||||
construct_runtime! {
|
construct_runtime! {
|
||||||
pub enum Runtime where
|
pub enum Runtime where
|
||||||
Block = Block,
|
Block = Block,
|
||||||
@@ -384,24 +425,27 @@ construct_runtime! {
|
|||||||
{
|
{
|
||||||
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
System: frame_system::{Pallet, Call, Storage, Config, Event<T>},
|
||||||
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
Timestamp: pallet_timestamp::{Pallet, Call, Storage, Inherent},
|
||||||
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>},
|
|
||||||
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
|
Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>},
|
||||||
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
|
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Pallet, Call, Storage},
|
||||||
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>},
|
|
||||||
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
|
TransactionPayment: pallet_transaction_payment::{Pallet, Storage},
|
||||||
ParachainInfo: parachain_info::{Pallet, Storage, Config},
|
|
||||||
|
ParachainSystem: cumulus_pallet_parachain_system::{Pallet, Call, Storage, Inherent, Event<T>} = 20,
|
||||||
|
ParachainInfo: parachain_info::{Pallet, Storage, Config} = 21,
|
||||||
|
|
||||||
|
Balances: pallet_balances::{Pallet, Call, Storage, Config<T>, Event<T>} = 30,
|
||||||
|
Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 31,
|
||||||
|
|
||||||
// XCM helpers.
|
// XCM helpers.
|
||||||
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>},
|
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>} = 50,
|
||||||
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin},
|
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin} = 51,
|
||||||
CumulusXcm: cumulus_pallet_xcm::{Pallet, Origin},
|
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Event<T>, Origin} = 52,
|
||||||
|
|
||||||
Spambot: cumulus_ping::{Pallet, Call, Storage, Event<T>} = 99,
|
Spambot: cumulus_ping::{Pallet, Call, Storage, Event<T>} = 99,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The address format for describing accounts.
|
/// The address format for describing accounts.
|
||||||
pub type Address = AccountId;
|
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||||
/// Block header type as expected by this runtime.
|
/// Block header type as expected by this runtime.
|
||||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||||
/// Block type as expected by this runtime.
|
/// Block type as expected by this runtime.
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ pallet-xcm = { git = "https://github.com/paritytech/polkadot", default-features
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
hex = "0.4.3"
|
hex = "0.4.3"
|
||||||
|
hex-literal = "0.3.1"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
substrate-wasm-builder = "3.0.0"
|
substrate-wasm-builder = "3.0.0"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use sp_api::impl_runtime_apis;
|
|||||||
use sp_core::OpaqueMetadata;
|
use sp_core::OpaqueMetadata;
|
||||||
use sp_runtime::{
|
use sp_runtime::{
|
||||||
create_runtime_str, generic, impl_opaque_keys,
|
create_runtime_str, generic, impl_opaque_keys,
|
||||||
traits::{BlakeTwo256, Block as BlockT, IdentityLookup},
|
traits::{BlakeTwo256, Block as BlockT, AccountIdLookup},
|
||||||
transaction_validity::{TransactionSource, TransactionValidity},
|
transaction_validity::{TransactionSource, TransactionValidity},
|
||||||
ApplyExtrinsicResult,
|
ApplyExtrinsicResult,
|
||||||
};
|
};
|
||||||
@@ -65,18 +65,16 @@ use xcm_builder::{
|
|||||||
};
|
};
|
||||||
use xcm_executor::{Config, XcmExecutor};
|
use xcm_executor::{Config, XcmExecutor};
|
||||||
|
|
||||||
pub type SessionHandlers = ();
|
|
||||||
|
|
||||||
impl_opaque_keys! {
|
impl_opaque_keys! {
|
||||||
pub struct SessionKeys {}
|
pub struct SessionKeys {}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This runtime version.
|
/// This runtime version.
|
||||||
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||||
spec_name: create_runtime_str!("cumulus-test-parachain"),
|
spec_name: create_runtime_str!("shell"),
|
||||||
impl_name: create_runtime_str!("cumulus-test-parachain"),
|
impl_name: create_runtime_str!("shell"),
|
||||||
authoring_version: 1,
|
authoring_version: 1,
|
||||||
spec_version: 18,
|
spec_version: 2,
|
||||||
impl_version: 0,
|
impl_version: 0,
|
||||||
apis: RUNTIME_API_VERSIONS,
|
apis: RUNTIME_API_VERSIONS,
|
||||||
transaction_version: 1,
|
transaction_version: 1,
|
||||||
@@ -96,12 +94,6 @@ pub const DAYS: BlockNumber = HOURS * 24;
|
|||||||
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
|
// 1 in 4 blocks (on average, not counting collisions) will be primary babe blocks.
|
||||||
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4);
|
||||||
|
|
||||||
#[derive(codec::Encode, codec::Decode)]
|
|
||||||
pub enum XCMPMessage<XAccountId, XBalance> {
|
|
||||||
/// Transfer tokens to the given account from the Parachain account.
|
|
||||||
TransferToken(XAccountId, XBalance),
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 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 {
|
||||||
@@ -152,7 +144,7 @@ impl frame_system::Config for Runtime {
|
|||||||
/// The aggregated dispatch type that is available for extrinsics.
|
/// The aggregated dispatch type that is available for extrinsics.
|
||||||
type Call = Call;
|
type Call = Call;
|
||||||
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
|
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
|
||||||
type Lookup = IdentityLookup<AccountId>;
|
type Lookup = AccountIdLookup<AccountId, ()>;
|
||||||
/// The index type for storing how many extrinsics an account has signed.
|
/// The index type for storing how many extrinsics an account has signed.
|
||||||
type Index = Index;
|
type Index = Index;
|
||||||
/// The index type for blocks.
|
/// The index type for blocks.
|
||||||
@@ -232,11 +224,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
|
|||||||
type Event = Event;
|
type Event = Event;
|
||||||
type OnValidationData = ();
|
type OnValidationData = ();
|
||||||
type SelfParaId = parachain_info::Module<Runtime>;
|
type SelfParaId = parachain_info::Module<Runtime>;
|
||||||
type DownwardMessageHandlers = cumulus_primitives_utility::UnqueuedDmpAsParent<
|
type DownwardMessageHandlers = CumulusXcm;
|
||||||
MaxDownwardMessageWeight,
|
|
||||||
XcmExecutor<XcmConfig>,
|
|
||||||
Call,
|
|
||||||
>;
|
|
||||||
type OutboundXcmpMessageSource = XcmpQueue;
|
type OutboundXcmpMessageSource = XcmpQueue;
|
||||||
type XcmpMessageHandler = XcmpQueue;
|
type XcmpMessageHandler = XcmpQueue;
|
||||||
type ReservedXcmpWeight = ReservedXcmpWeight;
|
type ReservedXcmpWeight = ReservedXcmpWeight;
|
||||||
@@ -356,7 +344,11 @@ impl pallet_xcm::Config for Runtime {
|
|||||||
type XcmExecutor = XcmExecutor<XcmConfig>;
|
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl cumulus_pallet_xcm::Config for Runtime {}
|
impl cumulus_pallet_xcm::Config for Runtime {
|
||||||
|
type Event = Event;
|
||||||
|
type XcmExecutor = XcmExecutor<XcmConfig>;
|
||||||
|
type MaxWeight = MaxDownwardMessageWeight;
|
||||||
|
}
|
||||||
|
|
||||||
impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
impl cumulus_pallet_xcmp_queue::Config for Runtime {
|
||||||
type Event = Event;
|
type Event = Event;
|
||||||
@@ -380,13 +372,13 @@ construct_runtime! {
|
|||||||
|
|
||||||
// XCM helpers.
|
// XCM helpers.
|
||||||
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>},
|
XcmpQueue: cumulus_pallet_xcmp_queue::{Pallet, Call, Storage, Event<T>},
|
||||||
PolkadotXcm: pallet_xcm::{Pallet, Call, Event<T>, Origin},
|
PolkadotXcm: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},
|
||||||
CumulusXcm: cumulus_pallet_xcm::{Pallet, Origin},
|
CumulusXcm: cumulus_pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The address format for describing accounts.
|
/// The address format for describing accounts.
|
||||||
pub type Address = AccountId;
|
pub type Address = sp_runtime::MultiAddress<AccountId, ()>;
|
||||||
/// Block header type as expected by this runtime.
|
/// Block header type as expected by this runtime.
|
||||||
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
|
||||||
/// Block type as expected by this runtime.
|
/// Block type as expected by this runtime.
|
||||||
|
|||||||
Reference in New Issue
Block a user