mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 02:21:14 +00:00
DMP Queue pallet (#416)
* 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 * Rococo Collator supports Shell runtime * Fixes * Fixes * Initial draft of DMP Queue pallet * DMP Queue builds. * Companion for Polkadot gav-allow-xcm-exec * Bump * Fix std * Fixes * fix and improve docs * fix compile errors in tests * add test for try_service_message * update cargo.lock * Fixes * Make test name read well * Fixes * Add a couple of simple tests * Tests * Tests * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> * Chain ID and ParaID don't collide * Fixes * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Update pallets/dmp-queue/src/lib.rs Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> * Fixes Co-authored-by: Alexander Popiak <alexander.popiak@parity.io> Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
This commit is contained in:
@@ -19,11 +19,10 @@
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
use sp_std::{marker::PhantomData, convert::TryFrom};
|
||||
use codec::{Encode, Decode};
|
||||
use cumulus_primitives_core::{UpwardMessageSender, DownwardMessageHandler, InboundDownwardMessage};
|
||||
use xcm::{VersionedXcm, v0::{Xcm, MultiLocation, Junction, SendXcm, Error as XcmError, ExecuteXcm}};
|
||||
use frame_support::{traits::Get, dispatch::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
use codec::Encode;
|
||||
use cumulus_primitives_core::UpwardMessageSender;
|
||||
use xcm::{VersionedXcm, v0::{Xcm, MultiLocation, Junction, SendXcm, Error as XcmError}};
|
||||
|
||||
/// Xcm router which recognises the `Parent` destination and handles it by sending the message into
|
||||
/// the given UMP `UpwardMessageSender` implementation. Thus this essentially adapts an
|
||||
@@ -51,27 +50,3 @@ impl<T: UpwardMessageSender> SendXcm for ParentAsUmp<T> {
|
||||
}
|
||||
}
|
||||
|
||||
/// 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.
|
||||
pub struct UnqueuedDmpAsParent<MaxWeight, XcmExecutor, Call>(
|
||||
PhantomData<(MaxWeight, XcmExecutor, Call)>
|
||||
);
|
||||
impl<
|
||||
MaxWeight: Get<Weight>,
|
||||
XcmExecutor: ExecuteXcm<Call>,
|
||||
Call,
|
||||
> DownwardMessageHandler for UnqueuedDmpAsParent<MaxWeight, XcmExecutor, Call> {
|
||||
fn handle_downward_message(msg: InboundDownwardMessage) -> Weight {
|
||||
let msg = VersionedXcm::<Call>::decode(&mut &msg.msg[..])
|
||||
.map(Xcm::<Call>::try_from);
|
||||
match msg {
|
||||
Ok(Ok(x)) => {
|
||||
let weight_limit = MaxWeight::get();
|
||||
XcmExecutor::execute_xcm(Junction::Parent.into(), x, weight_limit).weight_used()
|
||||
}
|
||||
Ok(Err(..)) => 0,
|
||||
Err(..) => 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user