mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 12:31:17 +00:00
XCM v2: Scripting, Query responses, Exception handling and Error reporting (#3629)
* Intoduce XCM v2 Also some minor fix for v0/v1 * Minor version cleanup * Minor version cleanup * Introduce SendError for XcmSend trait to avoid cycles with having Outcome in Xcm * comment * Corrent type * Docs * Fix build * Fixes * Introduce the basic impl * Docs * Add function * Basic implementation * Weighed responses and on_report * Make XCM more script-like * Remove BuyExecution::orders * Fixes * Fixes * Fixes * Formatting * Initial draft and make pallet-xcm build * fix XCM tests * Formatting * Fixes * Formatting * spelling * Fixes * Fixes * spelling * tests for translation * extra fields to XCM pallet * Formatting * Fixes * spelling * first integration test * Another integration test * Formatting * fix tests * all tests * Fixes * Fixes * Formatting * Fixes * Fixes * Formatting * Bump * Remove unneeded structuring * add instruction * Fixes * spelling * Fixes * Fixes * Formatting * Fixes * Fixes * Formatting * Introduce and use VersionedResponse * Introduce versioning to dispatchables' params * Fixes * Formatting * Rest of merge * more work * Formatting * Basic logic * Fixes * Fixes * Add test * Fixes * Formatting * Fixes * Fixes * Fixes * Nits * Simplify * Spelling * Formatting * Return weight of unexecuted instructions in case of error as surplus * Formatting * Fixes * Test for instruction count limiting * Formatting * Docs
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
use parity_scale_codec::Encode;
|
||||
use runtime_parachains::{configuration, dmp};
|
||||
use sp_std::marker::PhantomData;
|
||||
use xcm::opaque::latest::*;
|
||||
use xcm::latest::prelude::*;
|
||||
|
||||
/// XCM sender for relay chain. It only sends downward message.
|
||||
pub struct ChildParachainRouter<T, W>(PhantomData<(T, W)>);
|
||||
@@ -27,22 +27,22 @@ pub struct ChildParachainRouter<T, W>(PhantomData<(T, W)>);
|
||||
impl<T: configuration::Config + dmp::Config, W: xcm::WrapVersion> SendXcm
|
||||
for ChildParachainRouter<T, W>
|
||||
{
|
||||
fn send_xcm(dest: MultiLocation, msg: Xcm) -> Result {
|
||||
fn send_xcm(dest: MultiLocation, msg: Xcm<()>) -> SendResult {
|
||||
match dest {
|
||||
MultiLocation { parents: 0, interior: Junctions::X1(Junction::Parachain(id)) } => {
|
||||
MultiLocation { parents: 0, interior: X1(Parachain(id)) } => {
|
||||
// Downward message passing.
|
||||
let versioned_xcm =
|
||||
W::wrap_version(&dest, msg).map_err(|()| Error::DestinationUnsupported)?;
|
||||
W::wrap_version(&dest, msg).map_err(|()| SendError::DestinationUnsupported)?;
|
||||
let config = <configuration::Pallet<T>>::config();
|
||||
<dmp::Pallet<T>>::queue_downward_message(
|
||||
&config,
|
||||
id.into(),
|
||||
versioned_xcm.encode(),
|
||||
)
|
||||
.map_err(Into::<Error>::into)?;
|
||||
.map_err(Into::<SendError>::into)?;
|
||||
Ok(())
|
||||
},
|
||||
dest => Err(Error::CannotReachDestination(dest, msg)),
|
||||
dest => Err(SendError::CannotReachDestination(dest, msg)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user