mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-15 22:01:04 +00:00
Add Basic XCM (#1934)
* basic setup * fix compile * add back xcmsink * Update primitives.rs * add downward xcm for sudo * Update paras_sudo_wrapper.rs * Update Cargo.lock * some cleanups * Add error log Co-authored-by: Sergei Shulepov <sergei@parity.io>
This commit is contained in:
@@ -28,6 +28,7 @@ use runtime_parachains::{
|
||||
configuration, dmp, ump, hrmp, paras::{self, ParaGenesisArgs},
|
||||
};
|
||||
use primitives::v1::Id as ParaId;
|
||||
use parity_scale_codec::Encode;
|
||||
|
||||
/// The module's configuration trait.
|
||||
pub trait Config:
|
||||
@@ -73,16 +74,16 @@ decl_module! {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Send a downward message to the given para.
|
||||
/// Send a downward XCM to the given para.
|
||||
///
|
||||
/// The given parachain should exist and the payload should not exceed the preconfigured size
|
||||
/// `config.max_downward_message_size`.
|
||||
#[weight = (1_000, DispatchClass::Operational)]
|
||||
pub fn sudo_queue_downward_message(origin, id: ParaId, payload: Vec<u8>) -> DispatchResult {
|
||||
pub fn sudo_queue_downward_xcm(origin, id: ParaId, xcm: xcm::VersionedXcm) -> DispatchResult {
|
||||
ensure_root(origin)?;
|
||||
ensure!(<paras::Module<T>>::is_valid_para(id), Error::<T>::ParaDoesntExist);
|
||||
let config = <configuration::Module<T>>::config();
|
||||
<dmp::Module<T>>::queue_downward_message(&config, id, payload)
|
||||
<dmp::Module<T>>::queue_downward_message(&config, id, xcm.encode())
|
||||
.map_err(|e| match e {
|
||||
dmp::QueueDownwardMessageError::ExceedsMaxMessageSize =>
|
||||
Error::<T>::ExceedsMaxMessageSize.into(),
|
||||
|
||||
Reference in New Issue
Block a user